Skip to content

Commit 72b7661

Browse files
committed
add missing X-Apple-I-Client-Time, X-Apple-I-TimeZone, X-Apple-Locale headers for V1 requests
1 parent a0f26de commit 72b7661

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ base64 = "0.21"
2323
bytestring = "1.3"
2424
parking_lot = "0.12"
2525
clap = { version = "4.1", features = ["derive"] }
26+
chrono = "0.4"
2627

2728
log = "0.4"
2829
simplelog = "0.12"

src/provider_instance.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ impl ProviderInstance {
126126
self.set_identifier(self.original_identifier, None)?;
127127
self.set_path(self.original_path.clone())?;
128128
let mut headers = self.provider.get_anisette_headers(false).await?;
129+
129130
// Provision servers give X-MMe-Client-Info because AltServer gives X-MMe-Client-Info.
130131
// However, it's actually incorrect, and omnisette will normalize it to be X-Mme-Client-Info when using provider.get_authentication_headers().
131132
// To maintain backwards compatibility with V1 (and older versions of SideStore), we clone the header to ensure it is in both the correct and incorrect header key.
@@ -135,6 +136,17 @@ impl ProviderInstance {
135136
} else if let Some(client_info) = headers.get("X-MMe-Client-Info") {
136137
headers.insert("X-Mme-Client-Info".to_string(), client_info.clone());
137138
}
139+
140+
// omnisette doesn't provide X-Apple-I-Client-Time, X-Apple-I-TimeZone or X-Apple-Locale headers because the client should provide them
141+
// for V1 requests, we need to manually add them
142+
let time = chrono::Utc::now();
143+
headers.insert(
144+
"X-Apple-I-Client-Time".to_string(),
145+
time.to_rfc3339_opts(chrono::SecondsFormat::Secs, true), // .format("%Y-%m-%dT%H:%M:%SZ"), // Manually format to ISO 8601 because DateTime's to_rfc3339_opts is too smart
146+
);
147+
headers.insert("X-Apple-I-TimeZone".to_string(), "UTC".to_string());
148+
headers.insert("X-Apple-Locale".to_string(), "en_US".to_string());
149+
138150
Ok(headers)
139151
}
140152

0 commit comments

Comments
 (0)