web/website/scripts/build-account.mjs
unimatrixgit 9dcd9b084a Integrate shared planetary inventories and account sales with the current site
Merge the supplied inventory/exchange package into the latest DuneRealms source.
Keep community-reward receipts, verified UUID linking, native menus and current
website artwork, Dutch naming and account controls. Wire the inventory/sales
adapters into the real CP session and verified-link schema, with isolated reads
and honest unconfigured states. Preserve lobby/ender separation and Core-owned
atomic exchange checkpoints.

Validation: website build and 56 tests; 12 inventory/market adapter tests;
Core/Essentials and NPC/Terrain/Lobby builds and tests; local browser inspection
of the themed inventory, mannequin and History of sales with fictional fixtures.
Paper 1.21.8 source only: live 1.21.4 binaries and databases are unchanged.
2026-10-27 19:44:22 +01:00

7 lines
2.2 KiB
JavaScript

import {readFileSync,writeFileSync,readdirSync} from 'node:fs';
const web=new URL('../web/',import.meta.url),home=readFileSync(new URL('index.html',web),'utf8');
const header=home.match(/<header>[\s\S]*?<\/header>/)[0].replace(/ aria-current="page"/g,'');
const footer=home.match(/<footer>[\s\S]*?<\/footer>/)[0];
writeFileSync(new URL('account.html',web),'<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Your account — dunerealms.com</title><link rel="stylesheet" href="styles.css"><link rel="stylesheet" href="pages.css"><link rel="stylesheet" href="minecraft.css"><link rel="stylesheet" href="lore.css"><script src="pages.js" defer></script><script src="account-embed.js" defer></script></head><body>'+header+'<main id="main" class="account-embedded"><p class="eyebrow">DUNEREALMS.COM / YOUR ACCOUNT</p><h1>Your place in the caravan</h1><p>Sign in, register, link your Minecraft UUID and manage your community rewards. <a href="https://cp.dunerealms.com/" target="_blank" rel="noopener">Open the standalone account panel ↗</a></p><iframe id="account-panel" src="https://cp.dunerealms.com/?embedded=1" title="dunerealms.com account control panel" height="1400" referrerpolicy="no-referrer" allow="clipboard-write https://cp.dunerealms.com"></iframe><noscript><p><a href="https://cp.dunerealms.com/">Open the account panel</a>. JavaScript is required to use account features.</p></noscript></main>'+footer+'</body></html>');
for(const file of readdirSync(web).filter(file=>file.endsWith('.html'))){const url=new URL(file,web);let html=readFileSync(url,'utf8');html=html.replace(/<a href="account.html" class="account-nav">Account<\/a>/g,'');html=html.replace(/(<nav[^>]*aria-label="Main navigation"[^>]*>)/,'$1<a href="account.html" class="account-nav">Account</a>');writeFileSync(url,html);}
const portal=new URL('portal.html',web);let html=readFileSync(portal,'utf8');html=html.replace(/<p class="account-panel-entry">[\s\S]*?<\/p>/g,'').replace('<main>','<main><p class="account-panel-entry"><a href="account.html">Account control panel: UUID linking, rewards & security →</a></p>');writeFileSync(portal,html);