Ratatoskr/scripts/preview-config.js
Void 9c5af7aede
Some checks failed
Build pull request / Build pull request (pull_request) Has been cancelled
config.json is the live chat.gamecult.org config
Fetched from https://chat.gamecult.org/config.json 2026-11-11: one homeserver, custom homeservers off, gamecult featured space, hash router on, scene tier full with style terrain. dings and registration (keys the live release predates) keep the repo's off defaults. A release built from the repo now ships its own config.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 21:08:15 +00:00

33 lines
1.5 KiB
JavaScript

// Preview builds: set the background scene tier in dist/config.json (default 'low'); config.json
// in the repo is the live chat.gamecult.org config. 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. With --demo it
// also switches on the pretend homeserver (src/preview-demo): previewDemo true, and the pretend
// server as the only homeserver. Usage:
// node scripts/preview-config.js [tier] [style] [--demo]
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const args = process.argv.slice(2);
const demo = args.includes('--demo');
const [tier = 'low', style] = args.filter((a) => !a.startsWith('--'));
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 } : {}) };
if (demo) {
config.previewDemo = true;
config.defaultHomeserver = 0;
config.homeserverList = ['demo.invalid'];
config.allowCustomHomeservers = false;
config.featuredCommunities = {
openAsDefault: false,
spaces: ['#gamecult:demo.invalid'],
rooms: [],
servers: ['demo.invalid'],
};
}
fs.writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`);
console.log(
`${file}: backgroundScene.tier = ${tier}${style ? `, style = ${style}` : ''}${demo ? ', previewDemo on' : ''}`
);