From 4afd37e7dde785e2a6a8663930a72c39d204cc2a Mon Sep 17 00:00:00 2001 From: Nibu Date: Sat, 7 Nov 2026 20:25:02 +0000 Subject: [PATCH] preview: hash router and base-relative manifest link Previews are static dirs with no SPA fallback; a reload or shared link on /login/matrix.org was an nginx 404. preview-config now enables the hash router, and index.html's manifest link follows the base path. Co-Authored-By: Claude Sonnet 5.5 --- index.html | 2 +- scripts/preview-config.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 7242f309..ec7f4e39 100644 --- a/index.html +++ b/index.html @@ -23,7 +23,7 @@ - + diff --git a/scripts/preview-config.js b/scripts/preview-config.js index 75746f98..26f55b06 100644 --- a/scripts/preview-config.js +++ b/scripts/preview-config.js @@ -1,5 +1,6 @@ // Preview builds: set the background scene tier in dist/config.json (default 'low'); config.json -// in the repo stays 'off'. Usage: node scripts/preview-config.js [tier] [style] +// in the repo stays 'off'. Previews are static directories with no SPA fallback, so they also switch +// to the hash router: a reload on /login/matrix.org would otherwise be an nginx 404. Usage: node scripts/preview-config.js [tier] [style] import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; @@ -8,6 +9,7 @@ const tier = process.argv[2] ?? 'low'; const style = process.argv[3]; const file = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'dist', 'config.json'); const config = JSON.parse(fs.readFileSync(file, 'utf8')); +config.hashRouter = { enabled: true, basename: '/' }; config.backgroundScene = { ...config.backgroundScene, tier, ...(style ? { style } : {}) }; fs.writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`); console.log(`${file}: backgroundScene.tier = ${tier}${style ? `, style = ${style}` : ''}`);