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 <noreply@anthropic.com>
This commit is contained in:
parent
9e34664550
commit
4afd37e7dd
2 changed files with 4 additions and 2 deletions
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<link id="favicon" rel="shortcut icon" href="./public/favicon.ico" />
|
||||
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<link rel="manifest" href="%BASE_URL%manifest.json" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="Ratatoskr" />
|
||||
<meta name="apple-mobile-web-app-title" content="Ratatoskr" />
|
||||
|
|
|
|||
|
|
@ -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}` : ''}`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue