From 2dfa155469338ef219aa3bd642e0a11320d2f189 Mon Sep 17 00:00:00 2001 From: david raistrick <1108844+keen99@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:44:29 -0400 Subject: [PATCH] Add /display manifest for Android home-screen install Android Chrome only reads manifest at install time from current page. Root manifest has start_url '.' (root). Installing from /display launched root. Fix: separate display-manifest.json (start_url /display, scope /, landscape). App.js swaps link[rel=manifest] href when on /display path. Install from /display now launches /display standalone. --- public/display-manifest.json | 27 +++++++++++++++++++++++++++ src/App.js | 6 +++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 public/display-manifest.json diff --git a/public/display-manifest.json b/public/display-manifest.json new file mode 100644 index 0000000..369bc38 --- /dev/null +++ b/public/display-manifest.json @@ -0,0 +1,27 @@ +{ + "short_name": "TTRPG Display", + "name": "TTRPG Initiative Tracker — Player Display", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": "/display", + "scope": "/", + "display": "standalone", + "orientation": "landscape", + "theme_color": "#1A202C", + "background_color": "#1A202C" +} diff --git a/src/App.js b/src/App.js index 7be5c77..4082b06 100644 --- a/src/App.js +++ b/src/App.js @@ -3519,8 +3519,12 @@ function App() { useEffect(() => { const queryParams = new URLSearchParams(window.location.search); - if (queryParams.get('playerView') === 'true' || window.location.pathname === '/display') { + const isDisplay = queryParams.get('playerView') === 'true' || window.location.pathname === '/display'; + if (isDisplay) { setIsPlayerViewOnlyMode(true); + // swap manifest so Android home-screen installs launch /display + const link = document.querySelector('link[rel="manifest"]'); + if (link) link.href = `${process.env.PUBLIC_URL || ''}/display-manifest.json`; } if (window.location.pathname === '/logs') { setIsLogsMode(true);