From 26b2f3255dea0ee13c562ffcfd8d641fd976d5f8 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 16 Nov 2026 17:31:03 +0100 Subject: fix(xbox): a refused console list no longer blanks the tab; tab icon xccs answers 403 from its gateway while every other Xbox Live endpoint answers, and that one failure marked the whole tab offline. The console list now fails on its own, the tab says console control is unavailable, and the rest reads. The Xbox tab gets the Xbox glyph like the others. Co-Authored-By: Claude Opus 5.5 --- deckit/modules/xbox.py | 8 +++++++- static/app.js | 2 +- static/modules/xbox.js | 3 +++ tests/test_xbox.py | 10 ++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/deckit/modules/xbox.py b/deckit/modules/xbox.py index 8efa426..c8fb581 100644 --- a/deckit/modules/xbox.py +++ b/deckit/modules/xbox.py @@ -354,7 +354,13 @@ class Xbox: # --- reads ---------------------------------------------------------- def read_fast(self): presence = summarize_presence(self.api(PRESENCE, 3)) - consoles = summarize_consoles(self.api(DEVICES, 4, extra=SG)) + try: + consoles = summarize_consoles(self.api(DEVICES, 4, extra=SG)) + except HttpError as e: + # xccs sits behind its own gateway and can refuse alone; the rest still reads. + if e.status == 401: + raise + consoles, self.reason = self.data.get("consoles") or [], f"consoles: {e}" self.data = {**self.data, "presence": presence, "consoles": consoles} def read_slow(self): diff --git a/static/app.js b/static/app.js index bb30814..3249d64 100644 --- a/static/app.js +++ b/static/app.js @@ -29,7 +29,7 @@ const tabs = {}; // Tab icons, glyphs in the Nerd Font the server serves, or a brand logo from // static/logos; a tab with neither shows its name. The name also shows next // to the active one. -const TAB_ICONS = { Dashboard: "\uf0e4", Windows: "\uf2d2", Assistant: "\uf086", K1C: "\u{f0e5b}", VMs: "\uf233" }; +const TAB_ICONS = { Dashboard: "\uf0e4", Windows: "\uf2d2", Assistant: "\uf086", K1C: "\u{f0e5b}", VMs: "\uf233", Xbox: "\u{F05B9}" }; const TAB_LOGOS = { OBS: "obs" }; function ensureTab(name) { diff --git a/static/modules/xbox.js b/static/modules/xbox.js index ec4a14a..65aa7f7 100644 --- a/static/modules/xbox.js +++ b/static/modules/xbox.js @@ -213,6 +213,9 @@ function render(box, st) { const top = h("div", "xb-top"); if (st.playing) top.append(nowPlaying(st)); for (const c of st.consoles ?? []) top.append(consoleCard(c)); + if (!st.consoles?.length && st.reason?.startsWith("consoles")) { + top.append(h("div", "xb-stale", "Console control is unavailable: Xbox Live refused the console list.")); + } box.append(top); box.append(h("div", "xb-section", "Recent games")); diff --git a/tests/test_xbox.py b/tests/test_xbox.py index 748d0ca..1b73a2d 100644 --- a/tests/test_xbox.py +++ b/tests/test_xbox.py @@ -280,6 +280,16 @@ class Tick(Base): self.assertTrue(st["stale"]) self.assertEqual(st["profile"]["gamertag"], "Player") + def test_a_refused_console_list_keeps_the_rest(self): + x = self.xbox() + self.fake.fail["/lists/devices"] = xb.HttpError(403, {}) + x.tick() + st = x.state() + self.assertFalse(st["stale"]) + self.assertEqual(st["consoles"], []) + self.assertEqual(st["profile"]["gamertag"], "Player") + self.assertIn("consoles", st["reason"]) + def test_one_failing_part_keeps_the_rest(self): x = self.xbox() self.fake.fail["peoplehub"] = xb.HttpError(403, {}) -- cgit v1.2.3