change user agent

This commit is contained in:
4cuck committed 2023-10-16 23:32:09 +02:00
1 parent a06dc24494
commit b1f3d71fea
3 files changed
+6 -8

No files matched your search

+3 -3
View File
@@ -24,8 +24,8 @@ pub struct Config {
pub additional_hosts: Vec<String>,
/// Country to use for additional hosts
pub additional_host_country: String,
/// Referer to use
pub referrer: String,
/// Website URL of this service
pub website_url: String,
/// Duration to average the ping/response times over
pub ping_range: chrono::Duration,
/// don't emit errors for hosts which are already listed as down
@@ -52,7 +52,7 @@ impl Config {
rss_content: String::from(r#"<rss xmlns\:atom"#),
additional_hosts: vec![String::from("https://nitter.net")],
additional_host_country: String::from("🇳🇱"),
referrer: String::from(""),
website_url: String::from(""),
ping_range: chrono::Duration::hours(3),
auto_mute: true,
source_git_branch: String::from("master"),
+2 -4
View File
@@ -39,8 +39,6 @@ mod version_check;
const CAPTCHA_TEXT: &'static str = "Enable JavaScript and cookies to continue";
const CAPTCHA_CODE: u16 = 403;
static USER_AGENT: &str =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0";
static ACCEPT: &str =
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
static LANGUAGE: &str = "de,en-US;q=0.7,en;q=0.3";
@@ -140,13 +138,13 @@ impl Scanner {
for header in HEADERS {
headers.insert(header[0], HeaderValue::from_static(header[1]));
}
headers.insert("Referer", HeaderValue::from_str(&config.referrer).unwrap());
let user_agent = format!("nitter-status (+{}/about)",config.website_url);
let http_client = Client::builder()
.cookie_store(true)
.brotli(true)
.deflate(true)
.gzip(true)
.user_agent(USER_AGENT)
.user_agent(user_agent)
.connect_timeout(std::time::Duration::from_secs(3))
.timeout(std::time::Duration::from_secs(10))
.default_headers(headers);
+1 -1
View File
@@ -137,7 +137,7 @@ fn read_scanner_cfg() -> miette::Result<ScannerConfig> {
rss_content,
additional_hosts,
additional_host_country,
referrer,
website_url: require_env_str("SITE_URL")?,
ping_range: chrono::Duration::hours(ping_range as _),
auto_mute,
source_git_branch,