Skip to content

Commit

Permalink
Use Firefox user-agent header and add some additional headers (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 committed Apr 7, 2023
1 parent 36f6cc3 commit ac94912
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions native/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ use std::path::PathBuf;
use anyhow::{Context, Result};
use log::warn;
use reqwest::blocking::Client;
use reqwest::header::{HeaderMap, HeaderValue};
use reqwest::Certificate;

const APP_USER_AGENT: &str = concat!(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0 PWAsForFirefox/",
env!("CARGO_PKG_VERSION")
);
const APP_USER_AGENT: &str =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0";

/// Load DER and PEM certificates from files.
///
Expand Down Expand Up @@ -64,8 +63,13 @@ pub fn construct_client(
danger_accept_invalid_certs: bool,
danger_accept_invalid_hostnames: bool,
) -> reqwest::Result<Client> {
let mut headers = HeaderMap::new();
headers.insert("Sec-Fetch-Site", HeaderValue::from_static("none"));
headers.insert("Sec-Fetch-Dest", HeaderValue::from_static("manifest"));

let mut builder = Client::builder()
.user_agent(APP_USER_AGENT)
.default_headers(headers)
.danger_accept_invalid_certs(danger_accept_invalid_certs)
.danger_accept_invalid_hostnames(danger_accept_invalid_hostnames);

Expand Down

0 comments on commit ac94912

Please sign in to comment.