map change

This commit is contained in:
2026-11-15 20:05:02 +01:00
parent 319436a5f9
commit 3e565cf8c7
15 changed files with 242 additions and 26 deletions

View File

@@ -65,10 +65,13 @@ for (const [token, tag] of await Promise.all(scriptJobs)) html = html.replace(to
html = html.replace(/url\((['"]?)(assets\/[^'")]+)\1\)/g, (m, q, p) => (assets[p] ? `url('${assets[p]}')` : m));
html = html.replace(/(src|href)="(assets\/[^"]+)"/g, (m, a, p) => (assets[p] ? `${a}="${assets[p]}"` : m));
// everything the scripts load at runtime: must come before the first other <script>
html = html.replace('<script>', () => `<script>window.KIT_ASSETS = ${JSON.stringify(assets)};</script>\n<script>`);
// build stamp: identifies this exact release, so a leaked copy can be traced back
const BUILD = new Date().toISOString().slice(0, 16).replace('T', '.').replace(/[:-]/g, '');
html = html.replace('<script>', () => `<script>window.RC_BUILD = ${JSON.stringify(BUILD)};window.KIT_ASSETS = ${JSON.stringify(assets)};</script>\n<script>`);
html = html.replace('<head>', () => '<head><!-- Robot Clash (c) 2026 Michael Media | https://michael-media.de | build ' + BUILD + ' | Alle Rechte vorbehalten. Weitergabe oder Neuveroeffentlichung dieser Datei ist nicht gestattet. -->');
const out = path.join(root, 'release', 'robotclash.html');
fs.mkdirSync(path.dirname(out), { recursive: true });
fs.writeFileSync(out, html);
const mb = n => (n / 1024 / 1024).toFixed(1);
console.log(`Fertig: ${out} (${mb(fs.statSync(out).size)} MB, ${Object.keys(assets).length} Assets, ${mb(bytes)} MB roh)`);
console.log(`Fertig: ${out} (${mb(fs.statSync(out).size)} MB, ${Object.keys(assets).length} Assets, ${mb(bytes)} MB roh, Build ${BUILD})`);