mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Nexus moved its Xodus changes from patch files in xodus-nexus into a backend fork (domsvoboda/nexus-backend, GPL-3.0). prepare.py now fetches that fork at backend-v0.2.15 (e7884a27, same Xodus base 53ea781d, same Rust 1.99.0) and applies the DroidDeck patches, rebased onto it: - droiddeck-credentials, -launch-view, -library-subscriptions: same rebase as Bannerlator's 0.2.15 update (identical patches before and after). - droiddeck-credential-fallback, -credential-diagnostics: applied unchanged. - droiddeck-cloud-token: session::prepare now also returns the account snapshot; the ticket checks it like upstream's profile/social commands. - droiddeck-licensing-device-ticket: upstream 0.2.15 already formats delegation-compact device tickets for Store license tokens (27c335e), so only the content licensing path is patched. Upstream now writes compact JWE delegation tickets as t=, so the d= prefix check is replaced by the token type, the same rule as upstream's store_license.rs. droiddeck-xbox-ticket.patch is dropped: upstream sends compact JWE delegation tickets to Xbox Live sign-in in a form it accepts, with tests. Runtime: domsvoboda/nexus-runtime runtime-11.0-20261102-g76c6dd13 (was xodus-nexus runtime-11.0-20261018). Same six modules at the same path; xgameruntime.dll is the C++ implementation (nexus-xgameruntime 455b1ba9). Archive sha512 from the release's .sha512sum, source sha256 from its candidate.json, module sha256 from the extracted files. The PlayFab Game Saves proxy is a newer build at the same path and still passes droiddeck-xbox's export checks; its license moved to share/doc/nexus-runtime/. DLC mounting: the C++ runtime mounts downloadable content only inside a host-managed workspace named by XODUS_MOUNT_ROOT (src/System/Package/Mount.h returns E_NOTIMPL without it). DroidDeck starts Wine itself (droiddeck:prepare), so droiddeck-dlc-mount.patch (ported from Bannerlator) creates the workspace in the launch directory for the prepare session and reports it as mountRoot; XboxRuntime passes it in the xbox-prepare reply and droiddeck-xbox sets XODUS_MOUNT_ROOT to its Z: path. XODUS_CONTENT_ROOTS is unchanged and still read by the runtime. Upstream fixes since the old pins include sign-in for some accounts, offline play, cloud-save conflict handling, DLC mounting, duplicate token requests and per-game fixes (Ori, AoE, MSFS, Forza Motorsport).
96 lines
5.1 KiB
Diff
96 lines
5.1 KiB
Diff
diff --git a/crates/xodus-cli/src/commands/library.rs b/crates/xodus-cli/src/commands/library.rs
|
|
index 0c88129..36191bf 100644
|
|
--- a/crates/xodus-cli/src/commands/library.rs
|
|
+++ b/crates/xodus-cli/src/commands/library.rs
|
|
@@ -99,6 +99,48 @@ fn diagnostic(stage: &'static str, status: u16, count: usize) {
|
|
eprintln!("NEXUS_LIBRARY_DIAGNOSTIC_V1 {stage} {status} {count}");
|
|
}
|
|
|
|
+const SUBSCRIPTION_PLANS: &[&str] = &[
|
|
+ "CFQ7TTC0KGQ8", "CFQ7TTC0KHS0", "CFQ7TTC0P85B",
|
|
+ "CFQ7TTC0K5DJ", "CFQ7TTC0K6L8", "CFQ7TTC10QFD",
|
|
+];
|
|
+
|
|
+fn subscription_rows(body: &Value) -> Result<Vec<Value>, &'static str> {
|
|
+ let rows = body["entitlements"].as_object().ok_or("subscriptions-shape")?;
|
|
+ if rows.len() > SUBSCRIPTION_PLANS.len() { return Err("subscriptions-count"); }
|
|
+ let mut plans = Vec::new();
|
|
+ for (id, row) in rows {
|
|
+ if !SUBSCRIPTION_PLANS.contains(&id.as_str()) { return Err("subscriptions-product"); }
|
|
+ let status = row["status"].as_str().ok_or("subscriptions-status")?;
|
|
+ if status != "Active" { continue; }
|
|
+ let expiry = row["endDate"].as_str().filter(|s| s.len() < 50)
|
|
+ .filter(|s| chrono::DateTime::parse_from_rfc3339(s).is_ok()).ok_or("subscriptions-expiry")?;
|
|
+ plans.push(json!({"productId":id,"status":status,"endDate":expiry}));
|
|
+ }
|
|
+ Ok(plans)
|
|
+}
|
|
+
|
|
+async fn subscriptions(client: &reqwest::Client, ticket: &str, market: &str) -> Result<Vec<Value>, &'static str> {
|
|
+ let url = format!("https://beige.xboxservices.com/PCGAFD/entitlements/subscriptions?market={market}&language=en-US&appVersion=0.2.3");
|
|
+ let cv = format!("{}.0", STANDARD_NO_PAD.encode(uuid::Uuid::new_v4().as_bytes()));
|
|
+ let mut response = client.post(url)
|
|
+ .header("Authorization", ticket).header("X-MS-API-Version", "1.1")
|
|
+ .header("Calling-App-Name", "Xodus-Nexus").header("MS-CV", cv)
|
|
+ .json(&json!({"productIds":SUBSCRIPTION_PLANS}))
|
|
+ .send().await.map_err(|_| "subscriptions-request")?;
|
|
+ if !response.status().is_success() {
|
|
+ diagnostic("subscriptions-http", response.status().as_u16(), 0);
|
|
+ return Err("subscriptions-http");
|
|
+ }
|
|
+ if response.content_length().is_some_and(|n| n > 262_144) { return Err("subscriptions-size"); }
|
|
+ let mut bytes = Vec::new();
|
|
+ while let Some(chunk) = response.chunk().await.map_err(|_| "subscriptions-read")? {
|
|
+ if bytes.len() + chunk.len() > 262_144 { return Err("subscriptions-size"); }
|
|
+ bytes.extend_from_slice(&chunk);
|
|
+ }
|
|
+ let body: Value = serde_json::from_slice(&bytes).map_err(|_| "subscriptions-json")?;
|
|
+ subscription_rows(&body)
|
|
+}
|
|
+
|
|
async fn query(tokens: &TokenManager, market: &str) -> Result<Value, &'static str> {
|
|
if market.len() != 2 || !market.bytes().all(|b| b.is_ascii_uppercase()) {
|
|
return Err("market");
|
|
@@ -158,12 +200,13 @@ async fn query(tokens: &TokenManager, market: &str) -> Result<Value, &'static st
|
|
let page: Value = serde_json::from_slice(&bytes).map_err(|_| "entitlements-json")?;
|
|
all.add(&page)?;
|
|
if continuation.is_none() {
|
|
+ let subscriptions = subscriptions(&client, &ticket, market).await?;
|
|
tokens.validate_user_token_snapshot(&snapshot).map_err(|_|"account-changed")?;
|
|
all.finish();
|
|
for (reason, count) in &all.reasons { diagnostic(reason, 0, *count); }
|
|
diagnostic(if all.skipped > 0 { "partial" } else { "complete" }, 0, all.skipped);
|
|
return Ok(json!({"schema":1,"account":account,"market":market,
|
|
- "checkedAt":chrono::Utc::now().to_rfc3339(),"skippedEntitlements":all.skipped,
|
|
+ "checkedAt":chrono::Utc::now().to_rfc3339(),"skippedEntitlements":all.skipped,"subscriptions":subscriptions,
|
|
"entitlements":all.entries.into_values().collect::<Vec<_>>()}));
|
|
}
|
|
}
|
|
@@ -201,6 +244,26 @@ pub async fn run(tokens: &TokenManager, json_output: bool, market: String) -> Ex
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
+ #[test]
|
|
+ fn subscription_membership_is_separate_from_product_entitlements() {
|
|
+ let body = json!({"entitlements":{"CFQ7TTC0KGQ8":{
|
|
+ "status":"Active","endDate":"2099-01-01T00:00:00Z","autoRenew":true,"private":"not-output"}}});
|
|
+ assert_eq!(subscription_rows(&body).unwrap(), vec![json!({"productId":"CFQ7TTC0KGQ8",
|
|
+ "status":"Active","endDate":"2099-01-01T00:00:00Z"})]);
|
|
+ assert!(subscription_rows(&json!({"entitlements":{}})).unwrap().is_empty());
|
|
+ assert!(subscription_rows(&json!({"entitlements":{"CFQ7TTC0KGQ8":{"status":"Expired"}}})).unwrap().is_empty());
|
|
+ }
|
|
+
|
|
+ #[test]
|
|
+ fn malformed_membership_is_an_error_not_an_empty_subscription_list() {
|
|
+ for body in [json!({}), json!({"entitlements":[]}),
|
|
+ json!({"entitlements":{"unknown":{"status":"Active"}}}),
|
|
+ json!({"entitlements":{"CFQ7TTC0KGQ8":{"status":true}}}),
|
|
+ json!({"entitlements":{"CFQ7TTC0KGQ8":{"status":"Active","endDate":"invalid"}}})] {
|
|
+ assert!(subscription_rows(&body).is_err());
|
|
+ }
|
|
+ }
|
|
+
|
|
const A: &str = "9AAAAAAAAAAA";
|
|
const B: &str = "9BBBBBBBBBBB";
|
|
const C: &str = "9CCCCCCCCCCC";
|