From d4b1130931a430395b4172c28130693cc05c77c0 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 16 Nov 2026 17:17:52 +0100 Subject: feat(xbox): switch to the Xbox tab once per game session Co-Authored-By: Claude Opus 5.5 --- static/modules/xbox.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 static/modules/xbox.js (limited to 'static/modules/xbox.js') diff --git a/static/modules/xbox.js b/static/modules/xbox.js new file mode 100644 index 0000000..3350f52 --- /dev/null +++ b/static/modules/xbox.js @@ -0,0 +1,28 @@ +// deck-it - the Xbox tab: Xbox Live profile, games, friends and the console +// Copyright (C) 2026 Danilo M. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +const SESSION_KEY = "deckit-xbox-session"; + +// A game session on the Xbox brings this tab forward once and leaves it +// there (app.js reads Infinity as "stay"). The session is remembered, so a +// reload, or leaving the tab, does not bring it back until the next one. +export function sessionPeek(st, store = globalThis.localStorage) { + if (!st.session || store.getItem(SESSION_KEY) === String(st.session)) return 0; + store.setItem(SESSION_KEY, st.session); + return Infinity; +} + +export default { title: "Xbox", tab: "Xbox", interval: 5, peek: (st) => sessionPeek(st) }; -- cgit v1.2.3