Design an isolated DuneRealms portal comfort preview
This commit is contained in:
parent
1414ab5047
commit
ea786d0365
5 changed files with 147 additions and 56 deletions
|
|
@ -76,3 +76,12 @@ Current priority: implement and test the server-only dev-key executor, starting
|
|||
- Group at least three genuine user requests in a batch; do not count individual technical edits as separate requests. War is one request, POL missions and POL decisions are the other two requests in the current batch.
|
||||
- Include the scope checklist, verification plan, PR/commit and actual live-release evidence in that ticket. Update its progress and complete it only when its stated scope is actually live and verified.
|
||||
- Placeholder pages must be explicitly marked as previews and include all appropriate DuneRealms artwork. Preserve working actions while the remaining consumers are built.
|
||||
|
||||
## Latest owner direction: portal and control-panel redesign (24 November 2026)
|
||||
|
||||
- The owner said “negeer tickets”: skip ticket creation; it must not block work.
|
||||
- Current priority is the public portal preview before further CP redesign. The owner explicitly wants to keep the current site if unsatisfied: do not replace the live homepage before design acceptance.
|
||||
- Use the supplied green/gold portal image as inspiration, not an immutable layout. Preserve the existing logo, seals, awards and avatars. Other layouts, menus and artwork may be redesigned, including the CPs.
|
||||
- Reduce the number of control panels and unify their design, but do not cram everything into one panel. Personal services, organisation management and staff need distinct, understandable workspaces.
|
||||
- The POL backend can retain its existing service contracts independently of presentation changes. The tested political-war backend batch remains on PR 563, separate from this design preview.
|
||||
- Existing hostnames are sufficient for this preview. Discuss a new hostname only if implementation actually needs it.
|
||||
|
|
|
|||
|
|
@ -1,56 +1,59 @@
|
|||
import {publishExchangeAssets} from './public-exchange-assets.mjs';
|
||||
import {createHash} from 'node:crypto';
|
||||
import {withRealmSwitch,REALM_SWITCH_CSS} from './realm-switch.mjs';
|
||||
import {HOUSE_STYLE_CSS} from './house-style.mjs';
|
||||
import {bankRatesPage} from './bank-rates-page.mjs';
|
||||
import{withCanonicalMenu,MAIN_MENU}from'./main-menu.mjs';
|
||||
import{withMenuBadges}from'./menu-updates.mjs';
|
||||
import{updatePortalNavigation}from'./portal-navigation.mjs';
|
||||
// Package the authored web and worker sources without rewriting their content.
|
||||
import {readFileSync,writeFileSync as writePlain,renameSync,unlinkSync,openSync,writeSync,closeSync,readdirSync,statSync,mkdirSync,existsSync,rmSync,cpSync} from 'node:fs';import path from 'node:path';import {fileURLToPath} from 'node:url';
|
||||
function writeFileSync(file,content){const temporary=file+'.build-'+process.pid;writePlain(temporary,content);renameSync(temporary,file);}
|
||||
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'),web=path.join(root,'web'),dist=path.join(root,'dist');
|
||||
// Fail before packaging if a public menu destination or illustration is missing.
|
||||
for(const [label,href,icon] of MAIN_MENU){
|
||||
const url=new URL(href);
|
||||
if(url.hostname==='www.dunerealms.com'){
|
||||
const relative=url.pathname==='/'?'index.html':decodeURIComponent(url.pathname.slice(1));
|
||||
if(!existsSync(path.join(web,relative)))throw Error('Broken public menu link: '+label+' -> '+relative);
|
||||
}
|
||||
if(!existsSync(path.join(web,'assets',icon)))throw Error('Missing menu artwork: '+label+' -> '+icon);
|
||||
}
|
||||
for(const [page,dependencies] of [['shop.html',['shop-landing.css','shop-embed.js']],['kits.html',['kits.css','kits.js']]]){
|
||||
for(const file of dependencies)if(!existsSync(path.join(web,file)))throw Error('Missing '+page+' dependency: '+file);
|
||||
}
|
||||
// Menu badges are now published manually through Imperial Bureau.
|
||||
const homepage=readFileSync(path.join(web,'index.html'),'utf8');
|
||||
const legalNotice=homepage.match(/<aside class="legal-notice"[\s\S]*?<\/aside>/)?.[0];
|
||||
if(!legalNotice)throw Error('Homepage legal notice is missing');
|
||||
function preparePublicHtml(html){
|
||||
let result=updatePortalNavigation(html);
|
||||
if(!result.includes('class="legal-notice"')){
|
||||
if(!result.includes('</body>'))throw Error('Public HTML page missing closing body');
|
||||
result=result.replace('</body>',legalNotice+'</body>');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Publish the full shared Exchange module graph on its public origin.
|
||||
publishExchangeAssets(path.join(root,'control-panel/public'),web);
|
||||
writeFileSync(path.join(web,'rates-and-charges.html'),bankRatesPage());
|
||||
let assetCount=0;let assetWriter=null,shardSize=0;const shardNames=[];let shardTemporary;function openShard(){shardTemporary=path.join(dist,'server','.assets-build-'+process.pid);assetWriter=openSync(shardTemporary,'w');writeSync(assetWriter,'export default {');shardSize=0;}function closeShard(){writeSync(assetWriter,'};\n');closeSync(assetWriter);const hash=createHash('sha256').update(readFileSync(shardTemporary)).digest('hex'),name='assets-'+hash+'.mjs',target=path.join(dist,'server',name);if(existsSync(target))unlinkSync(shardTemporary);else renameSync(shardTemporary,target);shardNames.push(name);}function writeAsset(entry){if(shardSize>32*1024*1024){closeShard();openShard();}writeSync(assetWriter,entry);shardSize+=Buffer.byteLength(entry);}const types={'.html':'text/html; charset=utf-8','.css':'text/css; charset=utf-8','.js':'text/javascript; charset=utf-8','.mjs':'text/javascript; charset=utf-8','.json':'application/json; charset=utf-8','.webp':'image/webp','.png':'image/png','.mp4':'video/mp4','.pdf':'application/pdf','.zip':'application/zip','.svg':'image/svg+xml'};
|
||||
function collect(directory){for(const entry of readdirSync(directory).sort()){const p=path.join(directory,entry);if(statSync(p).isDirectory())collect(p);else{const relative=path.relative(web,p).split(path.sep).join('/');if(/^assets\/seals\/[^/]+-provenance\.txt$/.test(relative)||/^assets\/organisation-deed(?:s)?-[a-z0-9-]+\.png$/.test(relative))continue;const type=types[path.extname(entry)];if(!type)throw Error('Unexpected asset: '+entry);const bytes=readFileSync(p);const payload=relative.endsWith('.html')?Buffer.from(preparePublicHtml(bytes.toString('utf8'))):relative==='portal-navigation.js'?Buffer.from(withRealmSwitch(withCanonicalMenu(withMenuBadges(bytes.toString('utf8'))))):relative==='portal-navigation.css'?Buffer.concat([bytes,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS)]):bytes;writeAsset(JSON.stringify('/'+relative)+':['+JSON.stringify(type)+','+JSON.stringify(payload.toString('base64'))+'],');assetCount++}}}
|
||||
mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'.openai'),{recursive:true});const workerTemporary=path.join(dist,'server/index.js.build-'+process.pid);process.once('exit',()=>{if(existsSync(workerTemporary))try{unlinkSync(workerTemporary);}catch{}});openShard();collect(web);const buildCommit=process.env.GITHUB_SHA;if(buildCommit&&/^[0-9a-f]{40}$/.test(buildCommit)){writeAsset(JSON.stringify('/ci-build.json')+':'+JSON.stringify(['application/json; charset=utf-8',Buffer.from(JSON.stringify({commit:buildCommit})).toString('base64')])+',');}closeShard();
|
||||
let api=['public-item-metadata.mjs','feed-api.mjs','exchange-api.mjs','forum-api.mjs','community-api.mjs','portal-api.mjs'].map(file=>readFileSync(path.join(root,'worker',file),'utf8').replace(/^import .*;$/gm,'').replace(/export /g,'')).join('\n');let runtime=readFileSync(path.join(root,'worker/runtime.mjs'),'utf8').replace(/^import .*;$/gm,'');
|
||||
writeFileSync(path.join(dist,'server/index.js'),shardNames.map((name,i)=>'import DATA'+i+' from '+JSON.stringify('./'+name)+';').join('\n')+'\nconst ASSET_DATA=Object.assign({},'+shardNames.map((_,i)=>'DATA'+i).join(',')+');\n'+api+'\n'+runtime);cpSync(path.join(root,'.openai/hosting.json'),path.join(dist,'.openai/hosting.json'));console.log('Built Worker with',assetCount,'embedded website assets');
|
||||
if(existsSync(path.join(root,'drizzle')))cpSync(path.join(root,'drizzle'),path.join(dist,'.openai/drizzle'),{recursive:true});
|
||||
// Native applications consume the same compiled chrome as the public Worker.
|
||||
// nginx follows the atomically promoted current release, so no stale host copy
|
||||
// can retain an old Alpha version, navigation badge or rates page.
|
||||
const shared=path.join(dist,'shared-chrome');mkdirSync(shared,{recursive:true});
|
||||
for(const name of ['portal-navigation.js','portal-navigation.css','release.json','menu-new-items.json','rates-and-charges.html','bank-rates.css']){
|
||||
let content=readFileSync(path.join(web,name));
|
||||
if(name==='portal-navigation.js')content=Buffer.from(withRealmSwitch(withCanonicalMenu(withMenuBadges(content.toString('utf8')))));
|
||||
if(name==='portal-navigation.css')content=Buffer.concat([content,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS)]);
|
||||
if(name.endsWith('.html'))content=Buffer.from(preparePublicHtml(content.toString('utf8')));
|
||||
writeFileSync(path.join(shared,name),content);
|
||||
}
|
||||
import {publishExchangeAssets} from './public-exchange-assets.mjs';
|
||||
import {createHash} from 'node:crypto';
|
||||
import {withRealmSwitch,REALM_SWITCH_CSS} from './realm-switch.mjs';
|
||||
import {HOUSE_STYLE_CSS} from './house-style.mjs';
|
||||
import {bankRatesPage} from './bank-rates-page.mjs';
|
||||
import{withCanonicalMenu,MAIN_MENU}from'./main-menu.mjs';
|
||||
import{withMenuBadges}from'./menu-updates.mjs';
|
||||
import{updatePortalNavigation}from'./portal-navigation.mjs';
|
||||
// Package the authored web and worker sources without rewriting their content.
|
||||
import {readFileSync,writeFileSync as writePlain,renameSync,unlinkSync,openSync,writeSync,closeSync,readdirSync,statSync,mkdirSync,existsSync,rmSync,cpSync} from 'node:fs';import path from 'node:path';import {fileURLToPath} from 'node:url';
|
||||
function writeFileSync(file,content){const temporary=file+'.build-'+process.pid;writePlain(temporary,content);renameSync(temporary,file);}
|
||||
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'),web=path.join(root,'web'),dist=path.join(root,'dist');
|
||||
// Fail before packaging if a public menu destination or illustration is missing.
|
||||
for(const [label,href,icon] of MAIN_MENU){
|
||||
const url=new URL(href);
|
||||
if(url.hostname==='www.dunerealms.com'){
|
||||
const relative=url.pathname==='/'?'index.html':decodeURIComponent(url.pathname.slice(1));
|
||||
if(!existsSync(path.join(web,relative)))throw Error('Broken public menu link: '+label+' -> '+relative);
|
||||
}
|
||||
if(!existsSync(path.join(web,'assets',icon)))throw Error('Missing menu artwork: '+label+' -> '+icon);
|
||||
}
|
||||
for(const [page,dependencies] of [['shop.html',['shop-landing.css','shop-embed.js']],['kits.html',['kits.css','kits.js']]]){
|
||||
for(const file of dependencies)if(!existsSync(path.join(web,file)))throw Error('Missing '+page+' dependency: '+file);
|
||||
}
|
||||
// Menu badges are now published manually through Imperial Bureau.
|
||||
const homepage=readFileSync(path.join(web,'index.html'),'utf8');
|
||||
const legalNotice=homepage.match(/<aside class="legal-notice"[\s\S]*?<\/aside>/)?.[0];
|
||||
if(!legalNotice)throw Error('Homepage legal notice is missing');
|
||||
function preparePublicHtml(html){
|
||||
// Isolated owner-review pages retain their own shell. The live site keeps its
|
||||
// existing navigation until the replacement design has been accepted.
|
||||
if(html.includes('<html lang="en" data-dune-portal-preview>'))return html;
|
||||
let result=updatePortalNavigation(html);
|
||||
if(!result.includes('class="legal-notice"')){
|
||||
if(!result.includes('</body>'))throw Error('Public HTML page missing closing body');
|
||||
result=result.replace('</body>',legalNotice+'</body>');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Publish the full shared Exchange module graph on its public origin.
|
||||
publishExchangeAssets(path.join(root,'control-panel/public'),web);
|
||||
writeFileSync(path.join(web,'rates-and-charges.html'),bankRatesPage());
|
||||
let assetCount=0;let assetWriter=null,shardSize=0;const shardNames=[];let shardTemporary;function openShard(){shardTemporary=path.join(dist,'server','.assets-build-'+process.pid);assetWriter=openSync(shardTemporary,'w');writeSync(assetWriter,'export default {');shardSize=0;}function closeShard(){writeSync(assetWriter,'};\n');closeSync(assetWriter);const hash=createHash('sha256').update(readFileSync(shardTemporary)).digest('hex'),name='assets-'+hash+'.mjs',target=path.join(dist,'server',name);if(existsSync(target))unlinkSync(shardTemporary);else renameSync(shardTemporary,target);shardNames.push(name);}function writeAsset(entry){if(shardSize>32*1024*1024){closeShard();openShard();}writeSync(assetWriter,entry);shardSize+=Buffer.byteLength(entry);}const types={'.html':'text/html; charset=utf-8','.css':'text/css; charset=utf-8','.js':'text/javascript; charset=utf-8','.mjs':'text/javascript; charset=utf-8','.json':'application/json; charset=utf-8','.webp':'image/webp','.png':'image/png','.mp4':'video/mp4','.pdf':'application/pdf','.zip':'application/zip','.svg':'image/svg+xml'};
|
||||
function collect(directory){for(const entry of readdirSync(directory).sort()){const p=path.join(directory,entry);if(statSync(p).isDirectory())collect(p);else{const relative=path.relative(web,p).split(path.sep).join('/');if(/^assets\/seals\/[^/]+-provenance\.txt$/.test(relative)||/^assets\/organisation-deed(?:s)?-[a-z0-9-]+\.png$/.test(relative))continue;const type=types[path.extname(entry)];if(!type)throw Error('Unexpected asset: '+entry);const bytes=readFileSync(p);const payload=relative.endsWith('.html')?Buffer.from(preparePublicHtml(bytes.toString('utf8'))):relative==='portal-navigation.js'?Buffer.from(withRealmSwitch(withCanonicalMenu(withMenuBadges(bytes.toString('utf8'))))):relative==='portal-navigation.css'?Buffer.concat([bytes,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS)]):bytes;writeAsset(JSON.stringify('/'+relative)+':['+JSON.stringify(type)+','+JSON.stringify(payload.toString('base64'))+'],');assetCount++}}}
|
||||
mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'.openai'),{recursive:true});const workerTemporary=path.join(dist,'server/index.js.build-'+process.pid);process.once('exit',()=>{if(existsSync(workerTemporary))try{unlinkSync(workerTemporary);}catch{}});openShard();collect(web);const buildCommit=process.env.GITHUB_SHA;if(buildCommit&&/^[0-9a-f]{40}$/.test(buildCommit)){writeAsset(JSON.stringify('/ci-build.json')+':'+JSON.stringify(['application/json; charset=utf-8',Buffer.from(JSON.stringify({commit:buildCommit})).toString('base64')])+',');}closeShard();
|
||||
let api=['public-item-metadata.mjs','feed-api.mjs','exchange-api.mjs','forum-api.mjs','community-api.mjs','portal-api.mjs'].map(file=>readFileSync(path.join(root,'worker',file),'utf8').replace(/^import .*;$/gm,'').replace(/export /g,'')).join('\n');let runtime=readFileSync(path.join(root,'worker/runtime.mjs'),'utf8').replace(/^import .*;$/gm,'');
|
||||
writeFileSync(path.join(dist,'server/index.js'),shardNames.map((name,i)=>'import DATA'+i+' from '+JSON.stringify('./'+name)+';').join('\n')+'\nconst ASSET_DATA=Object.assign({},'+shardNames.map((_,i)=>'DATA'+i).join(',')+');\n'+api+'\n'+runtime);cpSync(path.join(root,'.openai/hosting.json'),path.join(dist,'.openai/hosting.json'));console.log('Built Worker with',assetCount,'embedded website assets');
|
||||
if(existsSync(path.join(root,'drizzle')))cpSync(path.join(root,'drizzle'),path.join(dist,'.openai/drizzle'),{recursive:true});
|
||||
// Native applications consume the same compiled chrome as the public Worker.
|
||||
// nginx follows the atomically promoted current release, so no stale host copy
|
||||
// can retain an old Alpha version, navigation badge or rates page.
|
||||
const shared=path.join(dist,'shared-chrome');mkdirSync(shared,{recursive:true});
|
||||
for(const name of ['portal-navigation.js','portal-navigation.css','release.json','menu-new-items.json','rates-and-charges.html','bank-rates.css']){
|
||||
let content=readFileSync(path.join(web,name));
|
||||
if(name==='portal-navigation.js')content=Buffer.from(withRealmSwitch(withCanonicalMenu(withMenuBadges(content.toString('utf8')))));
|
||||
if(name==='portal-navigation.css')content=Buffer.concat([content,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS)]);
|
||||
if(name.endsWith('.html'))content=Buffer.from(preparePublicHtml(content.toString('utf8')));
|
||||
writeFileSync(path.join(shared,name),content);
|
||||
}
|
||||
|
|
|
|||
9
website/web/preview/portal.css
Normal file
9
website/web/preview/portal.css
Normal file
File diff suppressed because one or more lines are too long
35
website/web/preview/portal.html
Normal file
35
website/web/preview/portal.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!doctype html>
|
||||
<html lang="en" data-dune-portal-preview>
|
||||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#0b211c"><meta name="robots" content="noindex,nofollow"><title>DuneRealms · Portal preview</title><link rel="icon" href="/assets/favicon.svg"><link rel="stylesheet" href="/preview/portal.css"><script src="/preview/portal.js" defer></script></head>
|
||||
<body>
|
||||
<a class="skip" href="#main">Skip to content</a>
|
||||
<div class="utility"><div class="wrap utility-inner"><span><i class="spark" aria-hidden="true">◆</i> MINECRAFT <span class="muted">/</span> JAVA + BEDROCK</span><span><a href="https://support.dunerealms.com/">Support</a><span class="utility-divider"></span><a href="https://cp.dunerealms.com/">Sign in</a><a href="https://cp.dunerealms.com/?mode=register">Create account <span aria-hidden="true">↗</span></a></span></div></div>
|
||||
<header class="masthead"><div class="masthead-ornament left" aria-hidden="true"><span></span> THE CARAVAN ENDURES <span></span></div><a href="/preview/portal.html" class="brand"><img src="/assets/dunerealms-season-logo-v2.webp" width="1392" height="508" alt="DuneRealms · The Quest for Tavren II Aedrecht"></a><div class="masthead-ornament right" aria-hidden="true"><span></span> WRITE YOUR CHAPTER <span></span></div></header>
|
||||
<div class="nav-bar"><div class="wrap nav-inner"><button class="menu-toggle" type="button" aria-expanded="false" aria-controls="portal-navigation">Menu <span aria-hidden="true">☰</span></button><nav id="portal-navigation" aria-label="Portal navigation"><a class="nav-home" href="/preview/portal.html" aria-current="page">Home</a><details><summary>Discover <span aria-hidden="true">⌄</span></summary><div class="dropdown"><a href="#worlds">Explore the worlds</a><a href="https://www.dunerealms.com/manual.html">New player guide</a><a href="https://wiki.dunerealms.com/">The Dunopedia</a></div></details><details><summary>Community <span aria-hidden="true">⌄</span></summary><div class="dropdown"><a href="https://forums.dunerealms.com/">Forums</a><a href="https://www.dunerealms.com/discord.html">Discord</a><a href="https://www.dunerealms.com/staff.html">People of the realm</a><a href="https://www.dunerealms.com/news-archive.html">News & updates</a></div></details><details><summary>Trade <span aria-hidden="true">⌄</span></summary><div class="dropdown"><a href="https://www.dunerealms.com/exchange.html">Player Exchange</a><a href="https://www.dunerealms.com/kits.html">Equipment & kits</a><a href="https://cp.dunerealms.com/#bank/bank-overview">Imperial Postbank</a><a href="https://shop.dunerealms.com/">Community shop</a></div></details><details><summary>The realm <span aria-hidden="true">⌄</span></summary><div class="dropdown"><a href="https://clans.dunerealms.com/">Clans</a><a href="https://corp.dunerealms.com/">Companies</a><a href="https://www.dunerealms.com/government.html">Politics & Houses</a></div></details></nav><div class="nav-actions"><a class="account-link" href="https://cp.dunerealms.com/"><img src="/assets/nav-account-v2.webp" alt="" width="28" height="28"> My account</a><button class="button gold compact" type="button" data-play><span aria-hidden="true">▶</span> Play now</button></div></div></div>
|
||||
<main id="main" class="wrap">
|
||||
<section class="arrival-grid" aria-label="Welcome to DuneRealms">
|
||||
<div class="hero frame"><div class="hero-content"><span class="eyebrow">YOUR NEXT CHAPTER STARTS HERE</span><h1>Your House.<br>Your destiny.</h1><p>Explore worlds. Build alliances.<br>Write a story worth telling.</p><div class="hero-actions"><button class="button gold" type="button" data-play><span aria-hidden="true">▶</span> Enter the realm</button><a class="button glass" href="https://www.dunerealms.com/manual.html"><span aria-hidden="true">▤</span> New player guide</a></div><span class="hero-caption">Five worlds. One shared universe.</span></div><div class="hero-chapter"><span class="chapter-line"></span> THE QUEST FOR TAVREN II AEDRECHT</div></div>
|
||||
<aside class="welcome-stack">
|
||||
<section class="welcome frame"><div class="section-label"><span>BEGIN YOUR JOURNEY</span><i></i></div><div class="welcome-body"><img src="/assets/nav-account-full-v2.webp" alt="" width="104" height="104"><div><span class="eyebrow small">A PLACE IN THE IMPERIUM</span><h2>Your story<br>starts with you.</h2></div></div><a class="button gold" href="https://cp.dunerealms.com/?mode=register">Create your account <span aria-hidden="true">→</span></a><p class="sign-in">Already a citizen? <a href="https://cp.dunerealms.com/">Sign in</a></p></section>
|
||||
<section class="network frame"><div class="section-label"><span>VAERKRING NETWORK</span><i></i></div><button class="server-address" type="button" data-copy="play.dunerealms.com" aria-label="Copy server address play.dunerealms.com"><img src="/assets/minecraft-items/grass_block.png" alt="" width="42" height="42"><span><strong>play.dunerealms.com</strong><small>Click to copy the server address</small></span><span class="copy-glyph" aria-hidden="true">▣</span></button><div class="network-bottom"><span class="network-state" id="network-state"><i></i> Checking network</span><button class="text-link" type="button" data-play>How to connect <span aria-hidden="true">→</span></button></div></section>
|
||||
</aside>
|
||||
</section>
|
||||
<nav class="realm-shortcuts frame" aria-label="Find your place"><a href="https://clans.dunerealms.com/"><img src="/assets/nav-clan-v2.webp" alt="" width="52" height="52"><span><strong>Find your people</strong><small>Clans, allies and a place to belong.</small></span><span class="shortcut-arrow" aria-hidden="true">↗</span></a><a href="https://corp.dunerealms.com/"><img src="/assets/guild.webp" alt="" width="52" height="52"><span><strong>Build your fortune</strong><small>Companies, trade and opportunity.</small></span><span class="shortcut-arrow" aria-hidden="true">↗</span></a><a href="https://www.dunerealms.com/government.html"><img src="/assets/seals/office-landsraad.png" alt="" width="52" height="52"><span><strong>Shape the realm</strong><small>Houses, politics and your voice.</small></span><span class="shortcut-arrow" aria-hidden="true">↗</span></a><a href="https://www.dunerealms.com/exchange.html"><img src="/assets/nav-exchange-v2.webp" alt="" width="52" height="52"><span><strong>Visit the Exchange</strong><small>Player goods, equipment and kits.</small></span><span class="shortcut-arrow" aria-hidden="true">↗</span></a></nav>
|
||||
<div class="realm-content">
|
||||
<section class="dispatches frame" aria-labelledby="dispatch-title"><div class="section-heading"><h2 id="dispatch-title">Latest dispatches</h2><a class="text-link" href="https://www.dunerealms.com/news-archive.html">All news <span aria-hidden="true">→</span></a></div><div id="news-grid" class="news-grid" aria-live="polite"><div class="news-loading"><span class="eyebrow">FROM THE IMPERIAL DISPATCH</span><p>Opening the latest news…</p></div></div></section>
|
||||
<aside class="community-stack"><section class="community frame"><div class="section-heading"><h2>Better together</h2></div><p class="panel-intro">The story continues beyond the game.</p><a class="community-link" href="https://www.dunerealms.com/discord.html"><img src="/assets/nav-discord-v2.webp" alt="" width="46" height="46"><span><strong>Join our Discord</strong><small>Meet players. Make plans.</small></span><span aria-hidden="true">→</span></a><a class="community-link" href="https://forums.dunerealms.com/"><img src="/assets/nav-boards-v2.webp" alt="" width="46" height="46"><span><strong>Around the forums</strong><small>Stories, ideas and conversation.</small></span><span aria-hidden="true">→</span></a></section><section class="next-steps frame"><div class="section-heading"><h2>New to the realm?</h2></div><a href="https://www.dunerealms.com/manual.html"><span class="step-number">01</span><span>Find your bearings<small>A short guide to your first steps.</small></span><span aria-hidden="true">→</span></a><a href="https://cp.dunerealms.com/?mode=register"><span class="step-number">02</span><span>Choose your House<small>Begin your own story.</small></span><span aria-hidden="true">→</span></a><button class="button outline" type="button" data-play>I'll see you ingame <span aria-hidden="true">→</span></button></section></aside>
|
||||
</div>
|
||||
<section class="worlds" id="worlds" aria-labelledby="worlds-title"><div class="section-heading"><div><span class="eyebrow">AN IMPERIUM TO DISCOVER</span><h2 id="worlds-title">Beyond the dunes.</h2></div><p>Every world has a different story. Where will yours begin?</p></div><div class="world-grid">
|
||||
<button class="world-card" type="button" data-world="arrakis"><img class="world-art" src="/assets/arrakis.webp" alt="Sandstone cities amid the Arrakduin dunes" loading="lazy"><span class="world-info"><span><strong>Arrakduin</strong><small>Desert · spice · survival</small></span><img src="/assets/faction-fremen.svg" alt="Fremen seal" width="38" height="38"></span></button>
|
||||
<button class="world-card" type="button" data-world="caladan"><img class="world-art" src="/assets/caladan.webp" alt="The green island cliffs of Kaladam" loading="lazy"><span class="world-info"><span><strong>Kaladam</strong><small>Oceans · jungles · discovery</small></span><img src="/assets/faction-atreides.svg" alt="Aerdrecht seal" width="38" height="38"></span></button>
|
||||
<button class="world-card" type="button" data-world="giedi"><img class="world-art" src="/assets/giedi.webp" alt="The dark industrial world of Giedermark" loading="lazy"><span class="world-info"><span><strong>Giedermark</strong><small>Industry · ambition · power</small></span><img src="/assets/faction-harkonnen.svg" alt="Harkveen seal" width="38" height="38"></span></button>
|
||||
<button class="world-card" type="button" data-world="kaitain"><img class="world-art" src="/assets/kaitain.webp" alt="The Imperial architecture of Kaiterhof" loading="lazy"><span class="world-info"><span><strong>Kaiterhof</strong><small>The court · politics · prestige</small></span><img src="/assets/faction-corrino.svg" alt="Korenholt seal" width="38" height="38"></span></button>
|
||||
<button class="world-card" type="button" data-world="sigma"><img class="world-art" src="/assets/sigma.webp" alt="The frozen mountains of Sigmadraken IV" loading="lazy"><span class="world-info"><span><strong>Sigmadraken IV</strong><small>Ice · frontiers · resilience</small></span><img src="/assets/faction-ordos.svg" alt="Oordwijk seal" width="38" height="38"></span></button>
|
||||
</div></section>
|
||||
<section class="farewell"><img src="/assets/imperial-seal-128.png" alt="Imperial seal" width="56" height="56"><div><span class="eyebrow">YOUR PLACE IN THE STORY IS WAITING</span><h2>The caravan endures.</h2></div><button class="button gold" type="button" data-play>Join the realm <span aria-hidden="true">→</span></button></section>
|
||||
</main>
|
||||
<footer class="footer"><div class="wrap footer-main"><a class="footer-wordmark" href="https://www.dunerealms.com/">DuneRealms <span>THE CARAVAN ENDURES</span></a><nav aria-label="Footer"><a href="https://wiki.dunerealms.com/">Wiki & guide</a><a href="https://support.dunerealms.com/">Support</a><a href="https://www.dunerealms.com/git/unimatrix/MC">DuneGit</a><a href="https://www.dunerealms.com/disclaimer.html">Disclaimer & contact</a></nav><span class="preview-label">Portal design preview</span></div><div class="wrap footer-bottom"><p>Independent fan project. Not affiliated with the Dune rights holders, Mojang or Microsoft. Artwork illustrates the setting.</p><a href="https://www.dunerealms.com/">Return to the current website <span aria-hidden="true">↗</span></a></div></footer>
|
||||
<dialog id="play-dialog" aria-labelledby="play-title"><button class="dialog-close" type="button" data-close aria-label="Close connection guide">×</button><span class="eyebrow">THE GATES ARE OPEN</span><h2 id="play-title">Welcome to the realm.</h2><p>You bring the story. We'll bring the worlds.</p><div class="edition-tabs" role="tablist" aria-label="Minecraft edition"><button type="button" role="tab" aria-selected="true" aria-controls="java-guide" id="java-tab">Java Edition</button><button type="button" role="tab" aria-selected="false" aria-controls="bedrock-guide" id="bedrock-tab" tabindex="-1">Bedrock Edition</button></div><div id="java-guide" role="tabpanel" aria-labelledby="java-tab"><ol><li>Open Minecraft, then choose <strong>Multiplayer</strong>.</li><li>Choose <strong>Add Server</strong> and enter the address below.</li><li>Save, join, and begin your journey.</li></ol><button class="dialog-address" type="button" data-copy="play.dunerealms.com"><span><small>SERVER ADDRESS</small><strong>play.dunerealms.com</strong></span><span>Copy ▣</span></button></div><div id="bedrock-guide" role="tabpanel" aria-labelledby="bedrock-tab" hidden><ol><li>Open Minecraft and go to <strong>Play → Servers</strong>.</li><li>Choose <strong>Add Server</strong>. Use the address below.</li><li>Set the port to <strong>19132</strong> and join.</li></ol><button class="dialog-address" type="button" data-copy="play.dunerealms.com"><span><small>SERVER ADDRESS · PORT 19132</small><strong>play.dunerealms.com</strong></span><span>Copy ▣</span></button></div><p class="dialog-foot">Need a hand? <a href="https://www.dunerealms.com/manual.html">Read the player guide →</a></p></dialog>
|
||||
<dialog id="world-dialog" aria-labelledby="world-title"><button class="dialog-close" type="button" data-close aria-label="Close world details">×</button><img id="world-dialog-art" class="world-dialog-art" alt=""><div class="world-dialog-copy"><span class="eyebrow">EXPLORE THE IMPERIUM</span><h2 id="world-title"></h2><p id="world-description"></p><a class="button gold" href="https://www.dunerealms.com/manual.html#planet-atlas">Explore the world guide <span aria-hidden="true">→</span></a></div></dialog>
|
||||
<div class="toast" role="status" aria-live="polite" hidden></div>
|
||||
</body></html>
|
||||
35
website/web/preview/portal.js
Normal file
35
website/web/preview/portal.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
(()=>{
|
||||
'use strict';
|
||||
const $=s=>document.querySelector(s),all=s=>[...document.querySelectorAll(s)];
|
||||
const nav=$('#portal-navigation'),toggle=$('.menu-toggle'),menus=all('#portal-navigation details');
|
||||
function closeMenus(){for(const menu of menus)menu.open=false;nav.classList.remove('open');toggle.setAttribute('aria-expanded','false');}
|
||||
toggle.addEventListener('click',()=>{const open=toggle.getAttribute('aria-expanded')!=='true';nav.classList.toggle('open',open);toggle.setAttribute('aria-expanded',String(open));});
|
||||
for(const menu of menus)menu.addEventListener('toggle',()=>{if(menu.open)for(const other of menus)if(other!==menu)other.open=false;});
|
||||
document.addEventListener('click',e=>{if(!e.target.closest('.nav-inner'))closeMenus();});
|
||||
document.addEventListener('keydown',e=>{if(e.key==='Escape'){const active=menus.find(m=>m.open);closeMenus();active?.querySelector('summary').focus();}});
|
||||
for(const link of all('#portal-navigation a'))link.addEventListener('click',closeMenus);
|
||||
const play=$('#play-dialog'),world=$('#world-dialog');let toastTimer;
|
||||
function notify(message){const toast=$('.toast');clearTimeout(toastTimer);toast.textContent=message;toast.hidden=false;toastTimer=setTimeout(()=>toast.hidden=true,3500);}
|
||||
for(const button of all('[data-copy]'))button.addEventListener('click',async()=>{try{await navigator.clipboard.writeText(button.dataset.copy);notify('Server address copied. See you in the realm.');}catch{notify('Server address: '+button.dataset.copy);}});
|
||||
for(const button of all('[data-play]'))button.addEventListener('click',()=>{closeMenus();play.showModal();});
|
||||
for(const dialog of [play,world]){dialog.querySelector('[data-close]').addEventListener('click',()=>dialog.close());dialog.addEventListener('click',e=>{if(e.target!==dialog)return;const r=dialog.getBoundingClientRect();if(e.clientX<r.left||e.clientX>r.right||e.clientY<r.top||e.clientY>r.bottom)dialog.close();});}
|
||||
const tabs=all('[role=tab]');function edition(tab){for(const button of tabs){const active=button===tab;button.setAttribute('aria-selected',String(active));button.tabIndex=active?0:-1;$('#'+button.getAttribute('aria-controls')).hidden=!active;}}
|
||||
for(const tab of tabs){tab.addEventListener('click',()=>edition(tab));tab.addEventListener('keydown',e=>{if(!['ArrowLeft','ArrowRight','Home','End'].includes(e.key))return;e.preventDefault();const next=e.key==='Home'?tabs[0]:e.key==='End'?tabs.at(-1):tabs[(tabs.indexOf(tab)+(e.key==='ArrowRight'?1:-1)+tabs.length)%tabs.length];edition(next);next.focus();});}
|
||||
const worlds={arrakis:['Arrakduin','A desert that asks everything of you. Walk the dunes, seek the spice and find your place among the Fremen. Survival, opportunity and danger share the same sands.'],caladan:['Kaladam','Green cliffs rise from warm oceans. Travel between jungle islands, discover hidden shores and build a home where the sea meets the sky.'],giedi:['Giedermark','A world of dark stone, industry and ambition. Carve your future from its harsh landscape and discover what lies beyond the surface.'],kaitain:['Kaiterhof','The heart of Imperial life. Fields, forests and the affairs of great Houses meet here, where influence can matter as much as a blade.'],sigma:['Sigmadraken IV','An icy frontier of snowfields, frozen lakes and mountain forests. Prepare for the cold and write your story at the edge of the Imperium.']};
|
||||
for(const button of all('[data-world]'))button.addEventListener('click',()=>{const [name,copy]=worlds[button.dataset.world];$('#world-title').textContent=name;$('#world-description').textContent=copy;const image=$('#world-dialog-art');image.src='/assets/'+button.dataset.world+'.webp';image.alt=button.querySelector('.world-art').alt;world.showModal();});
|
||||
function node(tag,text,className){const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(className)n.className=className;return n;}
|
||||
const date=n=>new Intl.DateTimeFormat('en-GB',{day:'numeric',month:'short',year:'numeric'}).format(new Date(Number(n)));
|
||||
function excerpt(text){return String(text||'').replace(/!\[[^\]]*\]\([^)]*\)/g,'').replace(/\[([^\]]+)\]\([^)]*\)/g,'$1').replace(/[#*_`>]/g,'').replace(/\s+/g,' ').trim().slice(0,135);}
|
||||
async function news(){const host=$('#news-grid');try{
|
||||
const response=await fetch('/api/news?page=1&surface=home',{cache:'no-store',signal:AbortSignal.timeout(8000)});if(!response.ok)throw Error();const data=await response.json();if(!Array.isArray(data.posts))throw Error();host.replaceChildren();
|
||||
for(const [i,post]of data.posts.slice(0,3).entries()){
|
||||
const card=node('article',undefined,'news-card'+(!i?' featured':'')),href='https://www.dunerealms.com/news-archive.html?post='+encodeURIComponent(post.id),art=node('a',undefined,'news-art'),image=node('img');
|
||||
// Reuse the editorial artwork register; never load arbitrary author URLs.
|
||||
const approved=['world','news','maintenance','changelogs','events','community'];image.src='/assets/news-'+(approved.includes(post.category)?post.category:'news')+'.webp';image.alt='';image.loading='lazy';art.href=href;art.setAttribute('aria-label',post.title);art.append(image);
|
||||
const copy=node('div',undefined,'news-copy'),meta=node('div',undefined,'news-meta');meta.append(node('span',post.label||'News'));if(Number.isFinite(Number(post.published_at)))meta.append(node('time',date(post.published_at)));const heading=node('h3'),title=node('a',post.title);title.href=href;heading.append(title);const read=node('a','Read dispatch →','text-link');read.href=href;copy.append(meta,heading,node('p',excerpt(post.body)+'…'),read);card.append(art,copy);host.append(card);
|
||||
}
|
||||
if(!host.children.length)host.append(node('p','The next chapter is on its way. Published news will appear here.','news-loading'));
|
||||
}catch{host.replaceChildren(node('div',undefined,'news-loading'));host.firstChild.append(node('span','THE IMPERIAL DISPATCH','eyebrow'),node('p','News is temporarily unavailable.'),Object.assign(node('a','Open the news archive →','text-link'),{href:'https://www.dunerealms.com/news-archive.html'}));}}
|
||||
async function network(){try{const response=await fetch('https://cp.dunerealms.com/api/worlds',{credentials:'omit',cache:'no-store',signal:AbortSignal.timeout(7000)});if(!response.ok)throw Error();const data=await response.json(),proxy=data.servers?.find(s=>s.id==='velocity'),state=$('#network-state');state.classList.toggle('online',proxy?.state==='online');state.replaceChildren(node('i'),document.createTextNode(proxy?.state==='online'?'Network available':proxy?.state==='offline'?'Network offline':'Status unavailable'));}catch{const state=$('#network-state');state.replaceChildren(node('i'),document.createTextNode('Status unavailable'));}}
|
||||
news();network();setInterval(()=>{if(!document.hidden)network();},30000);
|
||||
})();
|
||||
Loading…
Reference in a new issue

Staff