fix: add more paramters to tracking (fingers crossed)
This commit is contained in:
parent
ec5896df52
commit
5b205ce1e0
2 changed files with 22 additions and 9 deletions
|
@ -15,6 +15,14 @@ pub fn device_string() -> &'static str {
|
|||
"OnePlus 6T Build/RQ3A.211001.001"
|
||||
}
|
||||
|
||||
pub fn okhttp_user_agent() -> String {
|
||||
format!(
|
||||
"okhttp/4.11.0 Post & DHL/{} ({})",
|
||||
app_version(),
|
||||
linux_android_version()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn web_user_agent() -> String {
|
||||
format!("Mozilla/5.0 ({}; {}; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.0.0 Mobile Safari/537.36",
|
||||
linux_android_version(), device_string())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{login::DHLIdToken, LibraryResult};
|
||||
use crate::{login::DHLIdToken, LibraryError, LibraryResult};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TrackingParams {
|
||||
|
@ -32,15 +32,16 @@ impl crate::WebClient {
|
|||
endpoint_data_search,
|
||||
query(&query_parameters_data_search(¶ms, ids)),
|
||||
header(api_key.0, api_key.1),
|
||||
header("Cookie", cookie_value)
|
||||
header("cookie", cookie_value),
|
||||
header("x-requested-with", "de.dhl.paket"),
|
||||
header("sec-ch-ua-platform", "\"Android\""),
|
||||
header("sec-ch-ua", r#""Chromium";v="122", "Not(A:Brand";v="24", "Android WebView";v="122""#),
|
||||
header("sec-ch-ua-mobile", "?1"),
|
||||
header("content-type", "application/json"),
|
||||
header("accept", "application/json")
|
||||
)
|
||||
} else {
|
||||
request!(
|
||||
self.web_client,
|
||||
endpoint_data_search,
|
||||
query(&query_parameters_data_search(¶ms, ids)),
|
||||
header(api_key.0, api_key.1)
|
||||
)
|
||||
return Err(LibraryError::InvalidArgument("only supported with a logged-in session".to_string()));
|
||||
};
|
||||
|
||||
let resp = parse_json_response!(res, Response);
|
||||
|
@ -414,13 +415,17 @@ fn query_parameters_data_search(
|
|||
params: &TrackingParams,
|
||||
mut shippingnumbers: Vec<String>,
|
||||
) -> Vec<(String, String)> {
|
||||
let mut out = vec![("noRedirect".to_string(), "true".to_string())];
|
||||
let mut out = vec![
|
||||
("noRedirect".to_string(), "true".to_string()),
|
||||
("cid".to_string(), "app".to_string()),
|
||||
];
|
||||
|
||||
if let Some(lang) = params.language.as_ref() {
|
||||
out.push(("language".to_string(), lang.clone()));
|
||||
}
|
||||
|
||||
if shippingnumbers.len() > 0 {
|
||||
out.push(("inputSearch".to_string(), "true".to_string()));
|
||||
let mut shippingnumbers_string = shippingnumbers.pop().unwrap();
|
||||
for number in shippingnumbers {
|
||||
shippingnumbers_string = format!(",{}", number);
|
||||
|
|
Loading…
Reference in a new issue