Realms
Four Great Houses · House Leaders
Vrijduin · Naib
Clans belong to their homeworld’s Realm.
diff --git a/website/node/public-government.mjs b/website/node/public-government.mjs index c897c53e..cb6e22d2 100644 --- a/website/node/public-government.mjs +++ b/website/node/public-government.mjs @@ -1,11 +1,13 @@ import {electionDates,electionWindow} from '../control-panel/public/election-rules.mjs'; export const PUBLIC_OFFICES=Object.freeze([ {key:'emperor',kind:'imperial',faction:'imperium',office:'emperor',name:'Office of the Emperor',scope:'The Imperium',art:'emperor-v1.png',description:'The elected imperial office, representing the realms across the Imperium.'}, - ...[['atreides','House Aerdrecht','house-aerdrecht-v1.png'],['harkonnen','House Harkveen','house-harkveen-v1.png'],['corrino','House Korenholt','house-korenholt-v1.png'],['ordos','House Oordwijk','house-oordwijk-v1.png'],['fremen','Vrijduin','house-vrijduin-v1.png'],['veiled_concord','The Veiled Concord','veiled-concord-v1.png']].map(([faction,scope,art])=>({key:faction,kind:'house',faction,office:faction==='veiled_concord'?'reverent_mother':'house_leader',name:faction==='veiled_concord'?'Office of the Reverent Mother':scope+' Leadership',scope,art,description:faction==='veiled_concord'?'The elected leadership of the Veiled Concord.':'The elected leadership and public representation of '+scope+'.'})) + ...[['atreides','House Aerdrecht','house-aerdrecht-v1.png'],['harkonnen','House Harkveen','house-harkveen-v1.png'],['corrino','House Korenholt','house-korenholt-v1.png'],['ordos','House Oordwijk','house-oordwijk-v1.png'],['fremen','Vrijduin','house-vrijduin-v1.png'],['veiled_concord','The Veiled Concord','veiled-concord-v1.png']].map(([faction,scope,art])=>({key:faction,kind:faction==='veiled_concord'?'court':'house',faction,office:faction==='veiled_concord'?'reverent_mother':'house_leader',name:faction==='veiled_concord'?'Office of the Reverent Mother':faction==='fremen'?'Office of the Naib':scope+' Leadership',scope,art,description:faction==='veiled_concord'?'The elected leadership of the Veiled Concord.':'The elected leadership and public representation of '+scope+'.'})), + {key:'spacing_guild',kind:'court',faction:'spacing_guild',office:'guild_leader',name:'Vaerkring Leadership',scope:'Vaerkring · Spacing Guild',art:'office-landsraad.png',description:'The economic branch of the Imperial Court, connecting companies and their trade interests.'} ]); export function projectGovernment(terms,now=Date.now()){ return PUBLIC_OFFICES.map(office=>{ - const active=terms.filter(t=>t.kind===office.kind&&t.faction===office.faction&&t.office===office.office&&t.outcome==='winner'&&Number(t.starts_at)<=now&&Number(t.expires_at)>now); + const ledgerKind=office.faction==='veiled_concord'?'house':office.kind; + const active=terms.filter(t=>t.kind===ledgerKind&&t.faction===office.faction&&t.office===office.office&&t.outcome==='winner'&&Number(t.starts_at)<=now&&Number(t.expires_at)>now); const term=active.length===1?active[0]:null; const holder=term&&/^[a-z0-9_]{3,32}$/i.test(term.username||'')?{username:term.username,name:term.display_name||term.username,profile:'/people/'+encodeURIComponent(term.username),avatar:'https://cp.dunerealms.com/api/avatars/face/roster/'+encodeURIComponent(term.username)}:null; return {...office,state:holder?'occupied':active.length?'verification_pending':'vacant',holder,term:holder?{startsAt:Number(term.starts_at),expiresAt:Number(term.expires_at)}:null}; @@ -22,6 +24,6 @@ export function createPublicGovernment(db,{clock=Date.now}={}){return async requ if(new URL(request.url).search)return Response.json({message:'No identity overrides are accepted.'},{status:400}); try{ const now=clock(),rows=await db.prepare("SELECT t.kind,t.faction,t.office,t.starts_at,t.expires_at,t.outcome,a.username,a.display_name FROM political_office_terms t LEFT JOIN site_accounts a ON a.id=t.user_id AND a.password_hash NOT LIKE '!%' WHERE t.outcome='winner' AND t.starts_at<=? AND t.expires_at>? ORDER BY t.starts_at DESC LIMIT 100").bind(now,now).all(); - return Response.json({offices:projectGovernment(rows.results||[],now),elections:publicElectionCalendar(now),observedAt:now},{headers:{'Cache-Control':'public,max-age=30'}}); + return Response.json({structure:{landsraad:['emperor','atreides','harkonnen','corrino','ordos'],realms:['atreides','harkonnen','corrino','ordos','fremen'],court:['veiled_concord','spacing_guild'],clanAffiliation:'home_world',companiesBranch:'spacing_guild'},offices:projectGovernment(rows.results||[],now),elections:publicElectionCalendar(now),observedAt:now},{headers:{'Cache-Control':'public,max-age=30'}}); }catch{return Response.json({message:'The public office register is temporarily unavailable.'},{status:503,headers:{'Cache-Control':'no-store'}});} };} diff --git a/website/tests/public-government.test.mjs b/website/tests/public-government.test.mjs index a7c4db02..8c0889a9 100644 --- a/website/tests/public-government.test.mjs +++ b/website/tests/public-government.test.mjs @@ -1,7 +1,7 @@ import test from 'node:test';import assert from 'node:assert/strict'; import {projectGovernment,createPublicGovernment,publicElectionCalendar} from '../node/public-government.mjs'; const now=Date.parse('2026-11-15T10:00:00Z'); -test('every office remains present before the first election',()=>{const offices=projectGovernment([],now);assert.equal(offices.length,7);assert.ok(offices.every(o=>o.state==='vacant'&&o.holder===null));assert.equal(offices.filter(o=>o.kind==='imperial').length,1);}); +test('every office remains present before the first election',()=>{const offices=projectGovernment([],now);assert.equal(offices.length,8);assert.ok(offices.every(o=>o.state==='vacant'&&o.holder===null));assert.equal(offices.filter(o=>o.kind==='imperial').length,1);}); test('only a single active elected term can supply an officeholder',()=>{const term={kind:'imperial',faction:'imperium',office:'emperor',outcome:'winner',starts_at:now-1,expires_at:now+1,username:'citizen_one',display_name:'Citizen One',player_uuid:'private'};const office=projectGovernment([term],now)[0];assert.equal(office.state,'occupied');assert.equal(office.holder.profile,'/people/citizen_one');assert.ok(!JSON.stringify(office).includes('private'));for(const row of [{...term,expires_at:now},{...term,starts_at:now+1},{...term,outcome:'no_votes'}])assert.equal(projectGovernment([row],now)[0].state,'vacant');assert.equal(projectGovernment([term,term],now)[0].state,'verification_pending');}); test('public calendar includes the currently open voting window',()=>{const calendar=publicElectionCalendar(now);assert.equal(calendar[0].phase,'voting');assert.equal(calendar[0].termWeeks,2);assert.equal(calendar[1].phase,'applications');}); test('public office read rejects overrides and never invents vacancies on a database outage',async()=>{const api=createPublicGovernment({prepare(){throw Error('DB unavailable');}},{clock:()=>now});assert.equal((await api(new Request('https://www.dunerealms.com/api/public/government?user=other'))).status,400);assert.equal((await api(new Request('https://www.dunerealms.com/api/public/government',{method:'POST'}))).status,405);const response=await api(new Request('https://www.dunerealms.com/api/public/government'));assert.equal(response.status,503);assert.equal((await response.json()).offices,undefined);}); diff --git a/website/web/directory-panels.css b/website/web/directory-panels.css index 1b716dd6..6b84a87a 100644 --- a/website/web/directory-panels.css +++ b/website/web/directory-panels.css @@ -2,3 +2,5 @@ main.staff-directory{max-width:1340px;margin:36px auto 60px;padding:0 28px}.staff-directory [hidden]{display:none!important}.staff-section,.staff-intro{border:1px solid #7f8c61;border-radius:16px;padding:30px;margin:0 0 24px;background:linear-gradient(135deg,#1d4031,#102c23);box-shadow:0 8px 25px #0002;min-width:0}.staff-directory h1,.staff-directory h2,.staff-directory h3,.staff-directory h4{line-height:1.25;overflow-wrap:anywhere}.staff-directory h1{font-size:38px}.staff-directory h2{font-size:29px;margin:0 0 16px}.staff-directory h3{margin:0}.staff-eyebrow{font-weight:700;letter-spacing:.16em;margin:0 0 12px}.staff-intro{display:flex;align-items:center;justify-content:space-between;gap:26px;border-top:3px solid #d2b76b;background:linear-gradient(105deg,#173e2bf2,#102e28e8),url('/assets/sietch.webp') center/cover}.staff-intro>img{width:105px;height:105px;object-fit:contain;filter:drop-shadow(0 5px 10px #0006)}.staff-section-nav{display:flex;flex-wrap:wrap;gap:10px;margin:0 0 26px}.staff-section-nav a,.staff-profile-link{display:inline-block;border:1px solid #a89058;border-radius:7px;padding:8px 16px;background:#0b281d;text-decoration:none;font-size:12px}.staff-section-nav a:hover,.staff-profile-link:hover{background:#294936}.staff-executives{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin:30px 0;padding-bottom:30px;border-bottom:1px solid #a8905855}.staff-executives article{display:flex;align-items:center;gap:18px;background:linear-gradient(135deg,#38513b,#112e24);min-width:0}.staff-executives article:first-child{grid-column:1/-1;width:calc((100% - 40px)/3);min-width:300px;justify-self:center;border-top:3px solid #d2b76b}.staff-executives img{width:76px;height:76px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 3px 5px #0005)}.staff-executives a{overflow-wrap:anywhere}.staff-departments{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}.staff-department{border-top:3px solid #bca064;background:linear-gradient(145deg,#1a3d2fe8,#0c281ff5),url('/assets/sietch.webp') center/cover;min-width:0}.staff-department>header{margin-bottom:22px}.staff-department>header img{width:86px;height:86px;filter:drop-shadow(0 4px 7px #0005)}.staff-branches{grid-template-columns:1fr;gap:12px;border-top:1px solid #a8905844;padding-top:20px}.staff-branches article{border-left:3px solid #9caa80;background:#0b281dcc}.staff-branch-title{display:flex;align-items:center;gap:14px;margin-bottom:12px}.staff-branch-title h4{margin:0}.staff-branch-title img{width:48px;height:48px;object-fit:contain}.staff-holders a{overflow-wrap:anywhere}.staff-cards{grid-template-columns:repeat(3,minmax(0,1fr))}.staff-person{min-width:0;display:flex;flex-direction:column;border-color:#7f8b6466;background:linear-gradient(145deg,#274936,#102d24);box-shadow:0 5px 18px #0002}.staff-person header{min-width:0}.staff-person header a{overflow-wrap:anywhere}.staff-person header img{border:1px solid #9caa80;image-rendering:pixelated;flex-shrink:0}.staff-bio{overflow-wrap:anywhere;color:#d4dfce}.staff-personal-mark{align-self:center;width:120px;height:120px;object-fit:contain;margin:12px 0;filter:drop-shadow(0 4px 7px #0005)}.staff-person details{margin-bottom:18px}.staff-marks img{width:76px;height:76px;filter:drop-shadow(0 3px 5px #0005)}.staff-profile-link{margin-top:auto;align-self:flex-start}.staff-official{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,1fr);gap:32px;align-items:center;border-color:#b79c58;background:linear-gradient(110deg,#3a4c30,#12362a)}.staff-official .staff-cards{display:block;max-width:none}.staff-official .staff-person{display:grid;grid-template-columns:auto 1fr;gap:0 24px;padding:26px;background:#0c281e;border-color:#a8905888}.staff-official .staff-person>img{width:100px;height:100px;grid-row:1/5;object-fit:contain;align-self:center}.staff-official .staff-person h3{font-size:28px;margin:0 0 8px}.staff-official .staff-person p{font-size:13px;color:#b9ccbd}.staff-verified{border:0;padding:0;border-radius:0;font-weight:700;letter-spacing:.12em;margin-bottom:10px}.staff-order{padding:0;overflow:hidden;background:linear-gradient(135deg,#233c2c,#102b23)}.staff-order-heading{display:flex;gap:28px;align-items:center;padding:40px;border-bottom:1px solid #ab925466;background:linear-gradient(90deg,#102c23f5,#122e24c9 55%,#0b221b44),url('/assets/staff/order-hall-v1.webp') center/cover;min-height:310px}.staff-order-heading>img{width:135px;height:135px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 5px 12px #0008)}.staff-order-heading>div{max-width:620px}.staff-order-heading h2{font-size:34px}.staff-order-heading p:last-child{margin:0;color:#d2dcc9}.staff-order-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:20px;padding:30px}.staff-order-member{display:flex;flex-direction:column;align-items:center;text-align:center;padding:28px;background:linear-gradient(145deg,#3d4a2f,#102d24);min-width:0}.staff-order-member>img{float:none;margin:0 0 20px;width:125px;height:125px;filter:drop-shadow(0 4px 9px #0006)}.staff-order-member a{font-size:24px;text-decoration:none}.staff-contact a{background:#0c281e}.government-office-art{width:100px;height:100px;object-fit:contain;align-self:center;margin:12px 0 22px;filter:drop-shadow(0 4px 8px #0006)}.government-state{font-size:11px;color:#e2c880;border:1px solid #a8905866;border-radius:20px;padding:4px 11px;align-self:flex-start}.government-term{font-size:12px;color:#b9ccbd}.government-holder{display:flex;align-items:center;gap:14px;margin:18px 0}.government-holder img{width:56px;height:56px;border:1px solid #a89058;border-radius:8px;image-rendering:pixelated}.government-holder a{font:21px Georgia,serif;text-decoration:none}.government-vacant{border:1px dashed #a8905888;border-radius:9px;padding:18px;color:#c1cdb9;margin:18px 0}.government-vacant strong{display:block;color:#e4ca83;font-size:16px;letter-spacing:.12em}.government-grid{margin-top:25px}.government-notice{padding:16px;border-left:3px solid #d2b76b;background:#0b281d;color:#bacabd;font-size:13px} @media(max-width:1100px){.staff-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.staff-departments{grid-template-columns:1fr}.staff-executives article{padding:18px;gap:12px}.staff-executives img{width:60px;height:60px}} @media(max-width:760px){main.staff-directory{padding:0 16px;margin-top:24px}.staff-section,.staff-intro{padding:22px}.staff-directory h1{font-size:30px}.staff-directory h2{font-size:26px}.staff-intro>img{width:75px;height:75px}.staff-executives,.staff-cards,.staff-official{grid-template-columns:1fr}.staff-executives article:first-child{width:100%;min-width:0}.staff-executives article{padding:20px}.staff-executives img{width:76px;height:76px}.staff-department{padding:18px}.staff-official{gap:16px}.staff-official .staff-person{grid-template-columns:1fr}.staff-official .staff-person>img{grid-row:auto;width:86px;height:86px;margin-bottom:16px}.staff-order{padding:0}.staff-order-heading{padding:26px;gap:18px;align-items:flex-start;flex-direction:column;min-height:350px;background-position:65% center}.staff-order-heading>img{width:95px;height:95px}.staff-order-heading h2{font-size:28px}.staff-order-grid{padding:20px}.staff-contact{align-items:flex-start;flex-direction:column}.staff-section-nav{gap:8px}.staff-section-nav a{padding:7px 12px}} + +.government-root{text-align:center;max-width:360px;margin:25px auto;padding:20px;border:1px solid #bd9d58;border-radius:10px;background:#314b34;color:#efdcab;font:25px Georgia,serif}.government-lines{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;border-top:1px solid #a8905888;padding-top:25px}.government-lines article{padding:22px;border:1px solid #71856677;border-top:3px solid #bd9d58;border-radius:10px;background:#0b281d}.government-lines p{font-size:13px;color:#b9ccbd}@media(max-width:760px){.government-lines{grid-template-columns:1fr}} diff --git a/website/web/government.html b/website/web/government.html index 3d9e5da7..96efc280 100644 --- a/website/web/government.html +++ b/website/web/government.html @@ -1 +1 @@ -

DUNEREALMS · REALM & POLITICS
The offices of the realms, their responsibilities and the people elected to serve.

Checking the public office register…
THE IMPERIUM
The elected imperial office. Political office is separate from network staff authority.
THE HOUSES & THE VEIL
Every office keeps its place in this register, including when awaiting an election.
YOUR REALM · YOUR VOICE
House leadership follows a two-week cycle; the imperial office follows a four-week cycle. Voting takes place in Realm & Politics.
Candidatures and ballots require a linked account and the applicable election eligibility. A profile, honour or staff appointment does not itself grant a political office.
Open Realm & Politics →
DUNEREALMS · REALM & POLITICS
The offices of the realms, their responsibilities and the people elected to serve.

Checking the public office register…
THE IMPERIAL STRUCTURE
Four Great Houses · House Leaders
Vrijduin · Naib
Clans belong to their homeworld’s Realm.
Veiled Concord · Reverent Mother
Vaerkring · Guild leadership
Companies belong to Vaerkring.
Emperor + four House Leaders
Vrijduin and the Court branches have no Landsraad seat.
THE IMPERIUM
The elected imperial office. Political office is separate from network staff authority.
THE REALMS
Every office keeps its place in this register, including when awaiting an election.
THE IMPERIAL COURT
Veiled Concord and Vaerkring sit beneath the Imperial Court. Companies form Vaerkring’s economic network.
YOUR REALM · YOUR VOICE
House leadership follows a two-week cycle; the imperial office follows a four-week cycle. Voting takes place in Realm & Politics.
Candidatures and ballots require a linked account and the applicable election eligibility. A profile, honour or staff appointment does not itself grant a political office.
Open Realm & Politics →