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"
|
"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 {
|
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",
|
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())
|
linux_android_version(), device_string())
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{login::DHLIdToken, LibraryResult};
|
use crate::{login::DHLIdToken, LibraryError, LibraryResult};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct TrackingParams {
|
pub struct TrackingParams {
|
||||||
|
@ -32,15 +32,16 @@ impl crate::WebClient {
|
||||||
endpoint_data_search,
|
endpoint_data_search,
|
||||||
query(&query_parameters_data_search(¶ms, ids)),
|
query(&query_parameters_data_search(¶ms, ids)),
|
||||||
header(api_key.0, api_key.1),
|
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 {
|
} else {
|
||||||
request!(
|
return Err(LibraryError::InvalidArgument("only supported with a logged-in session".to_string()));
|
||||||
self.web_client,
|
|
||||||
endpoint_data_search,
|
|
||||||
query(&query_parameters_data_search(¶ms, ids)),
|
|
||||||
header(api_key.0, api_key.1)
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let resp = parse_json_response!(res, Response);
|
let resp = parse_json_response!(res, Response);
|
||||||
|
@ -414,13 +415,17 @@ fn query_parameters_data_search(
|
||||||
params: &TrackingParams,
|
params: &TrackingParams,
|
||||||
mut shippingnumbers: Vec<String>,
|
mut shippingnumbers: Vec<String>,
|
||||||
) -> Vec<(String, 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() {
|
if let Some(lang) = params.language.as_ref() {
|
||||||
out.push(("language".to_string(), lang.clone()));
|
out.push(("language".to_string(), lang.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if shippingnumbers.len() > 0 {
|
if shippingnumbers.len() > 0 {
|
||||||
|
out.push(("inputSearch".to_string(), "true".to_string()));
|
||||||
let mut shippingnumbers_string = shippingnumbers.pop().unwrap();
|
let mut shippingnumbers_string = shippingnumbers.pop().unwrap();
|
||||||
for number in shippingnumbers {
|
for number in shippingnumbers {
|
||||||
shippingnumbers_string = format!(",{}", number);
|
shippingnumbers_string = format!(",{}", number);
|
||||||
|
|
Loading…
Reference in a new issue