Skip to content

Commit a7fab47

Browse files
committed
Bugfixes
1 parent 6f4e8dd commit a7fab47

4 files changed

Lines changed: 43 additions & 10 deletions

File tree

src/auth.rs

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ struct AuthRequest {
3434
password: String
3535
}
3636

37+
#[derive(Serialize)]
38+
#[serde(rename_all = "camelCase")]
39+
struct V2AuthRequest {
40+
delegates: Value,
41+
protocol_version: String,
42+
user_info: V2AuthUserInfo,
43+
}
44+
45+
#[derive(Serialize)]
46+
#[serde(rename_all = "kebab-case")]
47+
struct V2AuthUserInfo {
48+
client_id: String,
49+
language: String,
50+
timezone: String,
51+
}
52+
3753
#[derive(Clone, Copy)]
3854
pub enum LoginDelegate {
3955
IDS,
@@ -189,7 +205,7 @@ pub struct IDSDelegateResponse {
189205
#[derive(Deserialize)]
190206
pub struct MobileMeDelegateResponse {
191207
pub tokens: HashMap<String, String>,
192-
#[serde(rename = "com.apple.mobileme")]
208+
#[serde(default)]
193209
pub config: Dictionary,
194210
}
195211

@@ -350,11 +366,21 @@ pub async fn login_apple_delegates<T: AnisetteProvider>(account: &AppleAccount<T
350366

351367
let username = account.username.as_ref().unwrap();
352368

353-
let request = AuthRequest {
354-
apple_id: username.to_string(),
355-
client_id: Uuid::new_v4().to_string(),
369+
// let request = AuthRequest {
370+
// apple_id: username.to_string(),
371+
// client_id: Uuid::new_v4().to_string(),
372+
// delegates: Value::Dictionary(Dictionary::from_iter(delegates.iter().map(|d| d.delegate()))),
373+
// password: pet.to_string()
374+
// };
375+
376+
let request = V2AuthRequest {
356377
delegates: Value::Dictionary(Dictionary::from_iter(delegates.iter().map(|d| d.delegate()))),
357-
password: pet.to_string()
378+
protocol_version: "1.0".to_string(),
379+
user_info: V2AuthUserInfo {
380+
client_id: Uuid::new_v4().to_string().to_uppercase(),
381+
language: "en-US".to_string(),
382+
timezone: "America/New_York".to_string(),
383+
}
358384
};
359385

360386
let validation_data = os_config.generate_validation_data().await?;
@@ -414,9 +440,15 @@ pub async fn login_apple_delegates<T: AnisetteProvider>(account: &AppleAccount<T
414440

415441
let delegates = parsed_dict.get("delegates").unwrap().as_dictionary().unwrap();
416442

443+
let mut mme: Option<MobileMeDelegateResponse> = get_delegate(delegates, "com.apple.mobileme")?;
444+
445+
if let Some(mme) = &mut mme {
446+
mme.config = get_delegate(delegates, "com.apple.mobileme")?.expect("No MME??");
447+
}
448+
417449
Ok(DelegateResponses {
418450
ids: get_delegate(delegates, "com.apple.private.ids")?,
419-
mobileme: get_delegate(delegates, "com.apple.mobileme")?,
451+
mobileme: mme,
420452
})
421453
}
422454

src/imessage/aps_client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,9 @@ impl IMClient {
333333
};
334334
drop(ident_cache);
335335

336-
// if we have multiple people, but not a single target going to not us, we cannot "send" this message.
337-
if targets.len() > 1 && !message_targets.iter().any(|target| !handles.contains(&target.participant)) {
336+
// if we have other people, but not a single target going to not us, we cannot "send" this message.
337+
if targets.iter().any(|target| !handles.contains(target)) &&
338+
!message_targets.iter().any(|target| !handles.contains(&target.participant)) {
338339
return Err(PushError::NoValidTargets);
339340
}
340341

src/macos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl OSConfig for MacOSConfig {
151151
}
152152

153153
fn get_login_url(&self) -> &'static str {
154-
"https://setup.icloud.com/setup/prefpane/loginDelegates"
154+
"https://setup.icloud.com/setup/signin/v2/login"
155155
}
156156

157157
fn get_private_data(&self) -> Dictionary {

src/relay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl OSConfig for RelayConfig {
125125
}
126126

127127
fn get_login_url(&self) -> &'static str {
128-
"https://setup.icloud.com/setup/prefpane/loginDelegates"
128+
"https://setup.icloud.com/setup/signin/v2/login"
129129
}
130130

131131
fn get_activation_device(&self) -> String {

0 commit comments

Comments
 (0)