aboutsummaryrefslogtreecommitdiffstats
path: root/static/modules/xbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/modules/xbox.js')
-rw-r--r--static/modules/xbox.js28
1 files changed, 28 insertions, 0 deletions
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. <danix@danix.xyz>
+//
+// 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) };