diff --git a/website/docs/political-cp.md b/website/docs/political-cp.md index 61dff73e..5eef9a5a 100644 --- a/website/docs/political-cp.md +++ b/website/docs/political-cp.md @@ -18,3 +18,10 @@ the same read-only public government projection as the public directory. Outer/inner route and height messages verify both frame source and exact origin. Routes are restricted to the fixed political page catalogue; heights are bounded. The responsive sidebar and nested service frames resize into the outer page. + +Person profiles show current political offices, scope, term dates and the +matching existing seal. Both the dedicated profile section and recognition +gallery use the same current-term projection as Government. Expired, future, +conflicting and disabled-identity terms cannot produce a current office. A +register outage is reported as unavailable. Recognition ranks and forum caches +do not establish the current public mandate; profile access rules are unchanged. diff --git a/website/node/member-political-offices.mjs b/website/node/member-political-offices.mjs new file mode 100644 index 00000000..a1a59ef2 --- /dev/null +++ b/website/node/member-political-offices.mjs @@ -0,0 +1,11 @@ +import {readGovernmentOffices} from './public-government.mjs'; +// Display only the same unambiguous, active elected terms as Government. +// Recognition ranks and expiring forum caches cannot establish current office. +export async function memberPoliticalOffices(db,target,{clock=Date.now}={}){ + const observedAt=clock(); + try{ + const offices=await readGovernmentOffices(db,observedAt),username=target.username.toLowerCase(); + const records=offices.filter(office=>office.holder?.username.toLowerCase()===username).map(office=>({key:office.key,label:office.name,scope:office.scope,office:office.office,faction:office.faction,seal:'https://www.dunerealms.com/assets/seals/'+office.art,startsAt:office.term.startsAt,expiresAt:office.term.expiresAt})); + return {status:'available',records,observedAt}; + }catch{return {status:'unavailable',records:[],observedAt};} +} diff --git a/website/node/member-profiles.mjs b/website/node/member-profiles.mjs index 4c85e4ff..4d2777e8 100644 --- a/website/node/member-profiles.mjs +++ b/website/node/member-profiles.mjs @@ -1,6 +1,7 @@ import {gameStaffSeals,protectedStaffRanks} from './game-staff-seals.mjs'; import {AWARD_LABELS,AWARD_FILES} from './recognition.mjs'; import {politicalSeals} from './political-heraldry.mjs'; +import {memberPoliticalOffices} from './member-political-offices.mjs'; import{readFileSync,existsSync}from'node:fs'; import{createHash}from'node:crypto'; import{identity}from'./auth.mjs'; @@ -67,11 +68,13 @@ export async function memberProfileData(db,target,settings={}){ for(const key of (showcase?Object.keys(departments):departmentsFor(access.nodes,access.ranks,target.username).filter(key=>departmentAwardEarned(stats,key))))add('team-'+key,departments[key]+' Award',base+'award-'+key+'-150.png','Awards'); for(const seal of gameStaffSeals(access.ranks))add(seal.key,seal.label,base+seal.file,'Official'); for(const seal of politicalSeals(access.ranks))add(seal.key,seal.label,base+seal.file,seal.group); + const politicalOffices=await memberPoliticalOffices(db,target,{clock:settings.clock||Date.now}); + for(const office of politicalOffices.records)add('current-office-'+office.key,office.label,office.seal,'Current political offices'); const office=await optional(()=>db.prepare('SELECT roles_json,expires_at FROM drforum_dune_political_roles WHERE website_id=?').bind(target.id).first(),null); if(office&&Number(office.expires_at)>Date.now()/1000){const known={emperor:'Emperor',house_leader:'Faction leader',specerhuis:'Specerhuis',welvaart:'House of Water',guild_staff:'Vaerkring',landsraad:'Landsraad'};for(const key of JSON.parse(office.roles_json||'[]'))if(known[key])add('office-'+key,known[key],'https://forums.dunerealms.com/assets/seals/office-'+key+'.png','Political offices');} const memorial=await optional(()=>db.prepare("SELECT m.slug FROM site_memorials m LEFT JOIN site_life_status l ON l.user_id=m.user_id WHERE m.user_id=? AND (l.status IS NULL OR l.status='deceased')").bind(target.id).first(),null); const clan=await optional(()=>db.prepare('SELECT c.id,c.name,c.tag,c.description,m.clan_role,m.joined_at,(SELECT COUNT(*) FROM site_clan_members n WHERE n.clan_id=c.id) AS member_count FROM site_clan_members m JOIN site_clans c ON c.id=m.clan_id WHERE m.user_id=? AND c.active=1').bind(target.id).first(),undefined); - return{personnelNumber:await personnelNumberFor(db,target.id),showcase,memorial:memorial?'/memorial/'+memorial.slug:null,personalSeal:namedPersonal?medals.find(m=>m.key==='personal-role'):null,username:target.username,displayName:target.display_name,joinedAt:Number(target.created_at),functions:access.organisation?.assignments||[],avatar:'https://cp.dunerealms.com/api/avatars/face/member/'+encodeURIComponent(target.username),avatarMode:'image',bio:publicProfile.bio,publicInfo:publicProfile.publicInfo,socials:publicProfile.socials,ranks,medals,forum:await publicForumFor(db,target.id),support:{status:staff?(stats?'available':'unavailable'):'not-staff',closed:stats?.totalClosed??null,departments:stats?.departments||{}},quests:{status:'placeholder',completed:null,active:null},clan:clan===undefined?{status:'unavailable'}:clan?{status:'member',emblem:'https://cp.dunerealms.com/api/clan-emblems/'+clan.id,name:clan.name,tag:clan.tag,description:clan.description,role:clan.clan_role,joinedAt:Number(clan.joined_at),members:Math.max(0,Number(clan.member_count))}:{status:'none'}}; + return{politicalOffices,personnelNumber:await personnelNumberFor(db,target.id),showcase,memorial:memorial?'/memorial/'+memorial.slug:null,personalSeal:namedPersonal?medals.find(m=>m.key==='personal-role'):null,username:target.username,displayName:target.display_name,joinedAt:Number(target.created_at),functions:access.organisation?.assignments||[],avatar:'https://cp.dunerealms.com/api/avatars/face/member/'+encodeURIComponent(target.username),avatarMode:'image',bio:publicProfile.bio,publicInfo:publicProfile.publicInfo,socials:publicProfile.socials,ranks,medals,forum:await publicForumFor(db,target.id),support:{status:staff?(stats?'available':'unavailable'):'not-staff',closed:stats?.totalClosed??null,departments:stats?.departments||{}},quests:{status:'placeholder',completed:null,active:null},clan:clan===undefined?{status:'unavailable'}:clan?{status:'member',emblem:'https://cp.dunerealms.com/api/clan-emblems/'+clan.id,name:clan.name,tag:clan.tag,description:clan.description,role:clan.clan_role,joinedAt:Number(clan.joined_at),members:Math.max(0,Number(clan.member_count))}:{status:'none'}}; } export function createMemberProfiles(db,settings={}){return async request=>{ const from=request.headers.get('origin');if(from&&from!==origin)return json({message:'Origin rejected.'},403); diff --git a/website/node/public-government.mjs b/website/node/public-government.mjs index cb6e22d2..e093e8f2 100644 --- a/website/node/public-government.mjs +++ b/website/node/public-government.mjs @@ -19,11 +19,15 @@ export function publicElectionCalendar(now=Date.now()){ return {kind,...window,termWeeks:kind==='house'?2:4}; }); } +export async function readGovernmentOffices(db,now=Date.now()){ + const 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 projectGovernment(rows.results||[],now); +} export function createPublicGovernment(db,{clock=Date.now}={}){return async request=>{ if(request.method!=='GET')return Response.json({message:'Read-only public office register.'},{status:405}); 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({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'}}); + const now=clock(),offices=await readGovernmentOffices(db,now); + 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,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/node/public/passport.css b/website/node/public/passport.css index e2ab8dc1..1efcb279 100644 --- a/website/node/public/passport.css +++ b/website/node/public/passport.css @@ -1,3 +1,4 @@ *{box-sizing:border-box}body{margin:0;background:#0b221b;color:#eee6ce;font:15px/1.7 system-ui,sans-serif}a{color:#e4ca83}.citizen-profile{max-width:1240px;margin:36px auto 60px;padding:0 28px}.citizen-profile [hidden]{display:none!important}.profile-breadcrumb{margin-bottom:22px;font-size:13px;color:#b8c5b7}.profile-breadcrumb a{text-decoration:none}.profile-hero,.profile-panel{border:1px solid #7f8c61;border-radius:16px;padding:30px;margin-bottom:24px;background:linear-gradient(135deg,#1d4031,#102c23);box-shadow:0 8px 25px #0002}.profile-hero{border-top:3px solid #d2b76b;background:linear-gradient(105deg,#173e2bf2,#102e28e8),url('/assets/sietch.webp') center/cover}.citizen-profile .eyebrow{font-size:10px;font-weight:700;letter-spacing:.16em;color:#c4ad6d;margin:0 0 12px}.identity{display:flex;align-items:center;gap:26px;margin:22px 0}.identity>div{min-width:0}#avatar{width:112px;height:112px;flex-shrink:0;border-radius:13px;border:2px solid #c6ab64;object-fit:cover;image-rendering:pixelated;background:#0a241b}.citizen-profile h1,.citizen-profile h2,.citizen-profile h3{font-family:Georgia,serif;color:#efdcab;line-height:1.25;overflow-wrap:anywhere}.citizen-profile h1{font-size:38px;margin:0 0 6px}.citizen-profile h2{font-size:25px;margin:0 0 18px}.citizen-profile h3{font-size:18px}.citizen-profile p{margin-top:0}.muted,#handle,#status{color:#b9ccbd}#handle{margin-bottom:6px}.metadata{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;margin-top:26px}.metadata>div{border-top:1px solid #8d9a6b55;padding-top:16px}.metadata small{display:block;color:#b5c6b5;font-size:12px;margin-bottom:5px}.metadata strong{overflow-wrap:anywhere}.chips{display:flex;gap:10px;flex-wrap:wrap}.chip{display:inline-block;border:1px solid #a89058;border-radius:20px;padding:5px 13px;background:#9b87481c;font-size:12px;text-decoration:none}.chip[data-staff=true]{border-color:#90b2bb;color:#b8d8e3;background:#456d7b30}.profile-columns{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:24px}.profile-prose{white-space:pre-line;overflow-wrap:anywhere;color:#d4dfce}.profile-functions{display:grid;gap:12px;margin-bottom:20px}.profile-function{padding:13px 16px;border:1px solid #71856677;border-left:3px solid #d1b66c;border-radius:8px;background:#0b281d}.profile-function strong{display:block;color:#e4cb8e}.profile-function span,.profile-function small{display:block;color:#b8cdbb;font-size:12px}.profile-award-groups{display:grid;gap:28px;margin-top:26px}.profile-awards{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:18px}.profile-seal{margin:0!important;min-width:0;padding:22px 16px;border:1px solid #7f8b645c;border-radius:12px;background:linear-gradient(145deg,#274936,#102d24);text-align:center;display:flex;flex-direction:column;align-items:center;gap:14px}.profile-seal img{width:128px;height:128px;max-width:100%;object-fit:contain;filter:drop-shadow(0 4px 7px #0005)}.profile-seal figcaption{font-size:13px;color:#e8d6a5;overflow-wrap:anywhere;line-height:1.5;width:100%}.profile-seal small{font-size:11px;color:#b4bd9f}.personal-seal-panel,.profile-order{display:flex;align-items:center;justify-content:space-between;gap:30px}.personal-seal-panel .profile-seal{min-width:210px}.profile-order{justify-content:flex-start;border-color:#c7a955;background:linear-gradient(115deg,#5d502936,#173b2c)}.profile-order>img{object-fit:contain;flex-shrink:0}.profile-community{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:18px}.profile-community>article{padding:20px;border:1px solid #6e886777;border-radius:10px;background:#0c281e}.profile-community strong{display:block;color:#e8d6a5;font-size:21px}.profile-community small{color:#b7cbb8}.profile-community a{font-size:12px}.citizen-profile a:focus-visible{outline:2px solid #e8cb7c;outline-offset:4px} .profile-clan-emblem{display:block;width:110px;height:110px;object-fit:contain;margin:0 auto 18px;filter:drop-shadow(0 4px 8px #0005)} +.profile-political-offices{border:3px double #c7a05a;background:linear-gradient(120deg,#4b252c,#261e22);box-shadow:inset 0 0 0 3px #d5ad6114}.profile-political-office-list{display:grid;gap:16px}.profile-political-office{display:flex;align-items:center;gap:24px;padding:20px;border:1px solid #b8975688;border-radius:10px;background:#f6eddd0a;min-width:0}.profile-political-office>img{width:96px;height:96px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 4px 8px #0005)}.profile-political-office small{color:#d4ba82;letter-spacing:.08em;text-transform:uppercase}.profile-political-office h3{margin:7px 0 10px}.profile-political-office strong{color:#edd7a0;font-size:13px}.profile-political-office p{margin:8px 0 0;font-size:12px}@media(max-width:520px){.profile-political-office{align-items:flex-start;flex-direction:column;gap:14px;padding:16px}.profile-political-office>img{width:80px;height:80px}} diff --git a/website/node/public/passport.html b/website/node/public/passport.html index 9e8f8a81..ed5edeb9 100644 --- a/website/node/public/passport.html +++ b/website/node/public/passport.html @@ -3,6 +3,7 @@

DUNEREALMS · CITIZEN REGISTER

Citizen profile

Loading the member record…

Member since—
Clan—
Community forum—

THE PERSON BEHIND THE NAME

About

No public biography added yet.

CURRENT RESPONSIBILITIES

Functions & service

+

SERVICE & RECOGNITION

Seals & earned awards

Current function seals and recorded community achievements.

diff --git a/website/node/public/passport.js b/website/node/public/passport.js index b25c8674..5bfa43c0 100644 --- a/website/node/public/passport.js +++ b/website/node/public/passport.js @@ -1,6 +1,16 @@ const $=id=>document.getElementById(id),el=(tag,value,cls)=>{const n=document.createElement(tag);if(value!=null)n.textContent=value;if(cls)n.className=cls;return n;}; const text=(id,value)=>{$(id).textContent=value??'—';},username=decodeURIComponent(location.pathname.split('/').filter(Boolean)[1]||''); function sealCard(m){const card=el('figure',null,'profile-seal'),image=el('img');image.src=m.url;image.alt=m.label;image.loading='lazy';image.width=image.height=128;card.append(image,el('figcaption',m.label),el('small',m.group||'Recognition'));return card;} +function renderPoliticalOffices(host,data){ + host.replaceChildren();if(!data||data.status!=='unavailable'&&!data.records?.length)return false; + if(data.status==='unavailable'){host.append(el('p','The current political office register is temporarily unavailable.','muted'));return true;} + const date=value=>new Date(value).toLocaleDateString('en-GB',{timeZone:'Europe/Brussels',day:'numeric',month:'short',year:'numeric'}); + for(const office of data.records){const card=el('article',null,'profile-political-office'); + if(/^https:\/\/www\.dunerealms\.com\/assets\/seals\/[a-z0-9_-]+\.png$/.test(office.seal||'')){const image=el('img');image.src=office.seal;image.alt=office.label+' seal';image.width=image.height=96;image.loading='lazy';card.append(image);} + const description=el('div');description.append(el('small',office.scope),el('h3',office.label),el('strong','Currently in office'),el('p','Term: '+date(office.startsAt)+' — '+date(office.expiresAt)+' · Brussels','muted'));card.append(description);host.append(card); + } + return true; +} function render(p){ document.title=(p.displayName||p.username)+' | DuneRealms';text('passport-title',p.displayName||p.username);text('handle','@'+p.username+(p.personnelNumber?' · '+p.personnelNumber:''));text('status',p.showcase?'Verified official DuneRealms account':'DuneRealms community member');if(p.showcase){text('recognition-title','Seal & award showcase');text('recognition-description','The general DuneRealms catalogue. Personal seals and the Holy Order of the Crysknife are excluded.');}text('joined',p.joinedAt?new Date(p.joinedAt).toLocaleDateString('en-GB'):null);text('clan',p.clan?.status==='member'?p.clan.name:'No clan listed');text('forum',p.forum?.status==='linked'?p.forum.username:'Not linked'); if(typeof p.avatar==='string'&&/^https:\/\/cp\.dunerealms\.com\/api\/avatars\//.test(p.avatar)){$('avatar').src=p.avatar;$('avatar').hidden=false;} @@ -8,6 +18,7 @@ function render(p){ const functions=p.functions||[]; for(const f of functions){const card=el('article',null,'profile-function');card.append(el('strong',f.roleLabel),el('span',f.scopeLabel));$('department').append(card);} if(!functions.length)$('department').append(el('p','No staff functions listed.','muted')); + $('political-offices-panel').hidden=!renderPoliticalOffices($('political-offices'),p.politicalOffices); if(p.support?.status==='available')text('tickets',(p.support.closed??0)+' verified support tickets closed'); if(p.bio)text('bio',p.bio);if(p.publicInfo){text('public-info',p.publicInfo);$('public-info').hidden=false;} for(const [label,value]of Object.entries(p.socials||{})){try{const u=new URL(value);if(u.protocol!=='https:'||u.username||u.password)continue;const a=el('a',label,'chip');a.href=u.href;a.rel='noopener noreferrer';a.target='_blank';$('socials').append(a);}catch{}} diff --git a/website/tests/member-political-offices.test.mjs b/website/tests/member-political-offices.test.mjs new file mode 100644 index 00000000..a740aed8 --- /dev/null +++ b/website/tests/member-political-offices.test.mjs @@ -0,0 +1,47 @@ +import test from 'node:test';import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs';import {runInNewContext} from 'node:vm'; +import {LocalD1} from './d1-adapter.mjs'; +import {memberPoliticalOffices} from '../node/member-political-offices.mjs'; +import {readGovernmentOffices} from '../node/public-government.mjs'; +const now=Date.parse('2026-11-15T18:00:00Z'),clock=()=>now; +function fixture(){const db=new LocalD1("CREATE TABLE site_accounts(id TEXT,username TEXT,display_name TEXT,password_hash TEXT);CREATE TABLE political_office_terms(kind TEXT,faction TEXT,office TEXT,starts_at INTEGER,expires_at INTEGER,outcome TEXT,user_id TEXT);");db.sqlite.exec("INSERT INTO site_accounts VALUES('member','CitizenQA','Citizen QA','hash'),('other','OtherQA','Other QA','hash')");const term=async({kind='house',faction='atreides',office='house_leader',starts=now-1000,expires=now+86400000,outcome='winner',user='member'}={})=>db.prepare('INSERT INTO political_office_terms VALUES(?,?,?,?,?,?,?)').bind(kind,faction,office,starts,expires,outcome,user).run();return {db,term};} + +test('current political offices and seals match the public Government register',async()=>{ + const {db,term}=fixture();try{ + await term();await term({kind:'imperial',faction:'imperium',office:'emperor'}); + const data=await memberPoliticalOffices(db,{username:'citizenqa'},{clock}),publicOffices=await readGovernmentOffices(db,now); + assert.equal(data.status,'available');assert.equal(data.records.length,2);assert.equal(data.observedAt,now); + for(const record of data.records){const office=publicOffices.find(o=>o.key===record.key);assert.equal(record.label,office.name);assert.equal(record.seal,'https://www.dunerealms.com/assets/seals/'+office.art);assert.equal(record.startsAt,office.term.startsAt);assert.equal(record.expiresAt,office.term.expiresAt);assert.equal('userId' in record,false);assert.equal('playerUuid' in record,false);} + assert.equal(data.records.find(r=>r.key==='emperor').seal,'https://www.dunerealms.com/assets/seals/emperor-v1.png'); + }finally{db.close();} +}); + +test('expired, future, no-vote and other-member terms cannot create a current office',async()=>{ + const {db,term}=fixture();try{ + await term({expires:now});await term({faction:'harkonnen',starts:now+1});await term({faction:'corrino',outcome:'no_votes'});await term({faction:'ordos',user:'other'}); + const data=await memberPoliticalOffices(db,{username:'CitizenQA',role:'seal_emperor'},{clock});assert.equal(data.status,'available');assert.deepEqual(data.records,[]); + }finally{db.close();} +}); + +test('conflicting active officeholders are withheld rather than attributed to either profile',async()=>{ + const {db,term}=fixture();try{await term();await term({user:'other'});for(const username of ['CitizenQA','OtherQA'])assert.deepEqual((await memberPoliticalOffices(db,{username},{clock})).records,[]);}finally{db.close();} +}); + +test('disabled identities and missing office data never invent an office',async()=>{ + const {db,term}=fixture();try{await term();await db.prepare("UPDATE site_accounts SET password_hash='!disabled' WHERE id='member'").run();assert.deepEqual((await memberPoliticalOffices(db,{username:'CitizenQA'},{clock})).records,[]);}finally{db.close();} + const missing=new LocalD1();try{const data=await memberPoliticalOffices(missing,{username:'CitizenQA'},{clock});assert.equal(data.status,'unavailable');assert.deepEqual(data.records,[]);}finally{missing.close();} +}); + +test('court offices use their own existing seals and labels',async()=>{ + const {db,term}=fixture();try{await term({faction:'veiled_concord',office:'reverent_mother'});await term({kind:'court',faction:'spacing_guild',office:'guild_leader'});const data=await memberPoliticalOffices(db,{username:'CitizenQA'},{clock});assert.equal(data.records.length,2);assert(data.records.some(r=>r.seal.endsWith('/veiled-concord-v1.png')));assert(data.records.some(r=>r.label==='Vaerkring Leadership'));}finally{db.close();} +}); + +class Node{constructor(tag){this.tagName=tag.toUpperCase();this.children=[];this._text='';}set textContent(value){this._text=String(value);this.children=[];}get textContent(){return this._text+this.children.map(n=>n.textContent).join('');}append(...nodes){this.children.push(...nodes);}replaceChildren(...nodes){this.children=[];this._text='';this.append(...nodes);}} +function renderer(){const source=readFileSync(new URL('../node/public/passport.js',import.meta.url),'utf8');return runInNewContext(source.slice(0,source.indexOf('function render(p)'))+';renderPoliticalOffices',{document:{createElement:tag=>new Node(tag),getElementById:()=>null},location:{pathname:'/people/CitizenQA'}});} +test('public profile displays current office, matching seal and term dates',()=>{ + const host=new Node('div'),render=renderer();assert.equal(render(host,{status:'available',records:[{label:'Office of the Emperor',scope:'The Imperium',seal:'https://www.dunerealms.com/assets/seals/emperor-v1.png',startsAt:now,expiresAt:now+86400000}]}),true);assert(host.textContent.includes('Office of the Emperor'));assert(host.textContent.includes('Currently in office'));assert(host.textContent.includes('Brussels'));assert.equal(host.children[0].children[0].src,'https://www.dunerealms.com/assets/seals/emperor-v1.png');assert.equal(host.children[0].children[0].alt,'Office of the Emperor seal'); +}); +test('profiles hide absent office sections, report outages, and reject external seal URLs',()=>{ + const host=new Node('div'),render=renderer();assert.equal(render(host,{status:'available',records:[]}),false);assert.equal(host.children.length,0);assert.equal(render(host,{status:'unavailable',records:[]}),true);assert(host.textContent.includes('temporarily unavailable')); + render(host,{status:'available',records:[{label:'',scope:'The Imperium',seal:'https://evil.invalid/seal.png',startsAt:now,expiresAt:now+1000}]});assert.equal(host.children[0].children.length,1);assert(host.textContent.includes('')); +});