Link the verified official owner alt and publish the official identity showcase

This commit is contained in:
unimatrixgit 2026-11-15 03:44:02 +01:00
commit a8956bc88e
19 changed files with 181 additions and 19 deletions

View file

@ -0,0 +1,71 @@
<?php
// UTF-8 code-point limits match the human-facing character contract; reject malformed bytes.
function dune_dev_text_valid($value,$min,$max){return is_string($value)&&mb_check_encoding($value,'UTF-8')&&mb_strlen(trim($value),'UTF-8')>=$min&&mb_strlen(trim($value),'UTF-8')<=$max;}
function dune_dev_id($value){return is_string($value)&&preg_match('/^[1-9][0-9]*$/D',$value)&&filter_var($value,FILTER_VALIDATE_INT)!==false?(int)$value:false;}
function dune_dev_origin_valid($origin){return $origin===null||$origin==='https://support.dunerealms.com';}
// Central SSO identity only. Never accept ranks or actor IDs from submitted fields.
function dune_dev_team($identity) {
if (!is_array($identity)) return false;
if (($identity['nativePermissionManagement']??null)===false) return in_array('web.tickets.dev',$identity['permissions']??[],true);
return (bool)array_intersect($identity['ranks']??[], ['owners','official_account','corestaff','network_admin','web_net_admin','web_dev']);
}
function dune_dev_submitter($identity) {
if (!is_array($identity)) return false;
$staffRanks=['owners','official_account','corestaff','staff','network_admin','network_admin','web_net_admin','web_dev','web_streamer','web_news','web_forum','web_support','web_sales','web_legal','web_appeal','game_mod','game_admin','game_support','game_appeal','game_quests','game_restoration'];
return (bool)array_intersect($identity['ranks']??[],array_merge($staffRanks,['vip','council_member'])) || (bool)array_intersect($identity['permissions']??[], ['web.menu.staffmanual','web.tickets.staff','web.forum.moderate','web.posts.edit']);
}
function dune_dev_owner($identity) {
if(!is_array($identity))return false;
$ranks=$identity['ranks']??[];$nodes=$identity['permissions']??[];
if (($identity['nativePermissionManagement']??null)===false) return (bool)array_intersect($ranks,['org_owner_ceo','org_executive']) && in_array('web.tickets.dev',$nodes,true) && in_array('web.ranks.manage',$nodes,true);
$name=strtolower($identity['username']??'');
return ($name==='unimatrix999'&&in_array('owners',$ranks,true))||($name==='grmacken'&&in_array('web_net_admin',$ranks,true));
}
function dune_dev_transition($identity,$action,$state,$note) {
if(!dune_dev_team($identity)||($action!=='complete'&&!dune_dev_owner($identity)))throw new RuntimeException('Only unimatrix999 or grmacken can approve or deny tasks.');
if(!dune_dev_text_valid($note,10,10000))throw new RuntimeException('Provide a decision reason or completion report of 10–10,000 characters.');
if($action==='complete'&&$state==='approved')return 'completed';
if($action==='approve'&&$state==='pending')return 'approved';
if($action==='deny'&&$state==='pending')return 'denied';
throw new RuntimeException('This action is not available for the current task state.');
}
function dune_dev_priority_editor($identity) {return dune_dev_owner($identity)||(strtolower($identity['username']??'')==='dev'&&in_array('web_dev',$identity['ranks']??[],true));}
function dune_dev_fields() {
return [
'title'=>['Task title',true,160,'input','A short, specific outcome'],
'type'=>['Request type',true,40,'select',['Feature','Bug','Design / artwork','Operations','Documentation','Release / verification']],
'system'=>['System / component',true,120,'input','Website, Support, Shop, game plugin, world or server'],
'objective'=>['Objective / full task prompt',true,12000,'textarea','What should be built or changed, and why?'],
'current'=>['Current behaviour / context',true,6000,'textarea','What happens now? Add the relevant page, command or version.'],
'expected'=>['Expected result',true,6000,'textarea','Describe the finished result from the user’s point of view.'],
'acceptance'=>['Acceptance criteria',true,6000,'textarea','List the observable checks that must pass before this ticket can close.'],
'scope'=>['Scope and exclusions',false,4000,'textarea','What is included? What must remain unchanged?'],
'reproduction'=>['Reproduction steps / error messages',false,6000,'textarea','For bugs: steps, exact error, Java/Bedrock, client and server version.'],
'testplan'=>['Suggested tests',false,4000,'textarea','Desktop/mobile, Java/Bedrock, permissions, failed and repeated requests.'],
'references'=>['Links / design references',false,4000,'textarea','Relevant HTTPS pages, source paths or related ticket numbers. No credentials.'],
'dependencies'=>['Dependencies / related tasks',false,3000,'textarea','What must be ready first? Who can clarify the request?'],
'risk'=>['Data, rollout and rollback considerations',false,4000,'textarea','Mention sensitive data, paid receipts, migrations, backups or service interruptions.'],
'priority'=>['Requested priority',true,40,'select',['Medium','Low','High']],
'timing'=>['Desired timing / reason',false,500,'input','A request, not a guaranteed deadline'],
];
}
function dune_dev_validate($input) {
$values=[];$errors=[];
foreach(dune_dev_fields() as$key=>[$label,$required,$max,$type,$hint]) {
$value=is_string($input[$key]??null)?trim($input[$key]):'';
if(($required&&$value==='')||!dune_dev_text_valid($value,0,$max)|| (isset($input[$key])&&!is_string($input[$key]))||($type==='select'&&!in_array($value,$hint,true)))$errors[]=$label.': enter a valid value (maximum '.$max.' characters).';
$values[$key]=$value;
}
if(($input['privacy']??'')!=='1')$errors[]='Confirm that the request contains no passwords, tokens or unnecessary personal data.';
return [$values,$errors];
}
function dune_dev_prompt($values) {
$parts=['DuneRealms development task — submitted through the private Dev form.'];
foreach(dune_dev_fields() as$key=>[$label])if(($values[$key]??'')!=='')$parts[]=$label."\n".$values[$key];
$parts[]='Workflow: Owner approval required before execution except explicit Owner submissions and the imported owner-approved backlog. Complete only with actual changes, checks, evidence and deployment/merge status. Scheduled morning/evening slots remain in effect.';
return implode("\n\n",$parts);
}
function dune_dev_execution_brief($values) {
return "## Approved objective\n".($values['objective']??'')."\n\n## Scope and exclusions\n".($values['scope']??'Keep the approved request scope.')."\n\n## Implementation plan\n1. Inspect the current implementation and linked original request.\n2. Make the smallest complete change within approved scope.\n3. Run focused positive, failure and permission checks.\n4. Review and merge through the Dev fork; back up and verify any authorised rollout.\n\n## Acceptance criteria\n".($values['acceptance']??'')."\n\n## Test plan\n".($values['testplan']??'')."\n\n## Dependencies\n".($values['dependencies']??'')."\n\n## Completion report required\nChanges, actual checks/results, evidence, fork/merge link, deployed versus staged, rollback and remaining limits. Do not silently enlarge the approved scope.";
}

View file

@ -6,7 +6,7 @@ const categories=new Set(['world','news','maintenance','changelogs','events','co
export function newsWebhookPayload(post,{test=false}={}){
const category=categories.has(post.category)?post.category:'news';
const summary=String(post.body||'').replace(/<[^>]*>/g,'').replace(/\[([^\]]+)\]\(https?:[^)]+\)/g,'$1').replace(/[#*_`]/g,'').replace(/\s+/g,' ').trim().slice(0,500);
return {username:'DuneRealms Dispatches',avatar_url:'https://cdn.discordapp.com/avatars/1567239700610285618/dc3ff7eb9f86481f52b4293affa3bbfd.png',allowed_mentions:{parse:[]},embeds:[{title:(test?'[TEST] ':'')+'['+({news:'NEWS',world:'World',maintenance:'Maintenance',changelogs:'Changelogs',events:'Events',community:'Community',unis_blog:'Uni’s Blog'}[post.category]||'NEWS')+'] '+String(post.title).slice(0,220),description:summary,url:ORIGIN+newsPath(post),color:0xc6a551,image:{url:ORIGIN+'/assets/news-'+(category==='unis_blog'?'news':category)+'.webp'},footer:{text:test?'Integration test — not a new published article':'Written by '+(post.author_name||'DuneRealms')+' • DuneRealms'},timestamp:new Date(Number(post.published_at)).toISOString()}]};
return {username:'DuneRealms',avatar_url:'https://cdn.discordapp.com/avatars/1567239700610285618/dc3ff7eb9f86481f52b4293affa3bbfd.png',allowed_mentions:{parse:[]},embeds:[{title:(test?'[TEST] ':'')+'['+({news:'NEWS',world:'World',maintenance:'Maintenance',changelogs:'Changelogs',events:'Events',community:'Community',unis_blog:'Uni’s Blog'}[post.category]||'NEWS')+'] '+String(post.title).slice(0,220),description:summary,url:ORIGIN+newsPath(post),color:0xc6a551,image:{url:ORIGIN+'/assets/news-'+(category==='unis_blog'?'news':category)+'.webp'},footer:{text:test?'Integration test — not a new published article':'Written by '+(post.author_name||'DuneRealms')+' • DuneRealms'},timestamp:new Date(Number(post.published_at)).toISOString()}]};
}
export function validateNewsWebhook(config){
const url=new URL(config.url);if(url.protocol!=='https:'||url.hostname!=='discord.com'||!/^\/api(?:\/v10)?\/webhooks\/\d+\/[A-Za-z0-9_.-]+$/.test(url.pathname)||url.search||url.hash||url.username||url.password||config.channelId!=='1567237542040834250'||config.guildId!=='1567229433033531462')throw Error('Invalid news webhook configuration');

View file

@ -10,6 +10,7 @@ import{badgesFor,BADGES,communityBadgeVisible}from'./community-badges.mjs';
import {activeSealEntitlements} from './seal-entitlement-store.mjs';
import {isShowcaseSeal} from './seal-entitlements.mjs';
import {EXECUTIVE_TITLES} from './organisation-appointments.mjs';
import {OFFICIAL_ACCOUNT} from './official-account.mjs';
import{staffSealFor,departmentsFor}from'./native-seals.mjs';
import{staffClosureStats,statsForAccount,departmentAwardEarned}from'./staff-closure-stats.mjs';
const origin='https://www.dunerealms.com',base=origin+'/assets/seals/';
@ -34,12 +35,12 @@ export async function publicForumFor(db,id){
export async function memberProfileData(db,target,settings={}){
const access=await accessFor(db,target),publicProfile=await publicProfileFor(db,target.id),statsMap=await(settings.statsReader||staffClosureStats)(db),staff=access.nodes.includes('web.tickets.staff'),stats=staff?statsForAccount(statsMap,target.id):null;
let manifest=settings.sealManifest||{};if(!settings.sealManifest){const file=settings.SEAL_MANIFEST_PATH||'/home/dunerealms/apps/integrations/seal-manifest.json';if(existsSync(file))manifest=JSON.parse(readFileSync(file,'utf8'));}
const showcase=target.username.toLowerCase()==='dunerealms';
const showcase=target.id===OFFICIAL_ACCOUNT.id&&target.username===OFFICIAL_ACCOUNT.username;
// Showcase never impersonates other people's personalized seals or the Crysknife Order.
const showcaseSealAllowed=(key,asset)=>!(/^(owner-|personal-staff-|network-staff-mr_|main-network-admin-|corestaff-)/i.test(key)||/crysknife/i.test(key+' '+(asset?.label||'')+' '+(asset?.footer150||'')));
const showcaseSealAllowed=(key,asset)=>isShowcaseSeal(key,{personal:asset?.category==='Personal'||asset?.personal===true})&&!/crysknife|crissknife/i.test((asset?.label||'')+' '+(asset?.footer150||''));
const ranks=[];for(const key of access.ranks){const functionRole=key.startsWith('org_')?access.organisation?.assignments.find(a=>'org_'+a.role===key):null;const r=functionRole?{key,label:functionRole.scopeType==='organisation'?(EXECUTIVE_TITLES[target.username]||functionRole.roleLabel):functionRole.roleLabel}:await rankFor(db,key);if(!ranks.some(x=>x.label===r.label))ranks.push({key:r.key,label:r.label});}
const medals=[];const add=(key,label,url,group)=>{if(!medals.some(m=>m.key===key)&&typeof url==='string'&&/^https:\/\/(www|support|forums)\.dunerealms\.com\/assets\/seals\/[a-zA-Z0-9_./-]+\.png$/.test(url))medals.push({key,label,url:url.replace(/^https:\/\/(support|forums)\.dunerealms\.com\//,'https://www.dunerealms.com/'),group});};
const personal=showcase?Object.values(manifest).find(a=>a.label?.toLowerCase()===target.username.toLowerCase()&&a.role==='OWNER')?.footer150||null:staffSealFor({...target,ranks:access.ranks},manifest);const namedPersonal=personal&&!personal.includes('/rank-network-staff-');if(personal)add('personal-role',namedPersonal?target.username+' · Personal seal':access.label,personal.startsWith('/')?(personal.includes('main-network')?'https://support.dunerealms.com':'https://www.dunerealms.com')+personal:personal,'Staff');
const personal=showcase?null:staffSealFor({...target,ranks:access.ranks},manifest);const namedPersonal=personal&&!personal.includes('/rank-network-staff-');if(personal)add('personal-role',namedPersonal?target.username+' · Personal seal':access.label,personal.startsWith('/')?(personal.includes('main-network')?'https://support.dunerealms.com':'https://www.dunerealms.com')+personal:personal,'Staff');
for(const key of departmentsFor(access.nodes,access.ranks,target.username)){
const name=departments[key];if(!name)continue;let url=base+'department-'+key+(key==='legal'?'-v2':'')+'-150.png';
let label=name+' · Department';if(departmentAwardEarned(stats,key)){const file='personal-department-'+key+'-'+createHash('sha256').update(target.id+'|'+key+'|'+target.username).digest('hex').slice(0,20)+'.png';if(existsSync('/home/dunerealms/apps/integrations/osticket/assets/seals/earned/'+file)){url='https://support.dunerealms.com/assets/seals/earned/'+file;label=name+' · Personal department seal';}}
@ -56,6 +57,7 @@ export async function memberProfileData(db,target,settings={}){
const url=asset?.footer150?origin+asset.footer150:(BADGES.includes(key)?base+(AWARD_FILES[key]||key+'-150.png'):null);
if(url)add(key,asset?.label||AWARD_LABELS[key]||badgeLabels[key]||key.replaceAll('-',' '),url,'Awards');
}
if(showcase)for(const [key,asset]of Object.entries(manifest))if(showcaseSealAllowed(key,asset)&&typeof asset.footer150==='string')add(key,asset.label||key,origin+asset.footer150,asset.category||'Seal catalogue');
for(const [key,asset]of Object.entries(manifest))if(asset.category==='Community'&&showcaseSealAllowed(key,asset)&&(showcase||asset.rank&&access.ranks.includes(asset.rank)))add(key,asset.label,origin+asset.footer150,'Community');
if(!showcase&&access.ranks.includes('crysknife'))add('rank-crysknife','Holy Order of The Crysknife',base+'order-crysknife-v1.png','Official');
if(access.ranks.includes('web_dev')||protectedStaffRanks(access.ranks))add('rank-dev','Development',base+'rank-dev-150.png','Official');

View file

@ -6,8 +6,11 @@ import {syncNativeAgents} from './native-agents.mjs';
import {NATIVE_SYNC_SCHEMA} from './native-sync-schema.mjs';
export {NATIVE_SYNC_SCHEMA} from './native-sync-schema.mjs';
export async function initializeNativeSyncOutbox(db){await db.prepare(NATIVE_SYNC_SCHEMA).run();}
export function nativeSyncMutation(now=Date.now()){
return {sql:"INSERT INTO native_sync_outbox(job_key,revision,attempts,next_attempt_at,lease_token,lease_until,created_at,last_error) VALUES('memberships',?,0,0,'',0,?,'') ON CONFLICT(job_key) DO UPDATE SET revision=excluded.revision,attempts=0,next_attempt_at=0,created_at=excluded.created_at,last_error='' ",values:[randomUUID(),now]};
}
export function nativeSyncChange(db,now=Date.now()){
return db.prepare("INSERT INTO native_sync_outbox(job_key,revision,attempts,next_attempt_at,lease_token,lease_until,created_at,last_error) VALUES('memberships',?,0,0,'',0,?,'') ON CONFLICT(job_key) DO UPDATE SET revision=excluded.revision,attempts=0,next_attempt_at=0,created_at=excluded.created_at,last_error='' ").bind(randomUUID(),now);
const change=nativeSyncMutation(now);return db.prepare(change.sql).bind(...change.values);
}
async function synchronize(db){
if(!['/home/dunerealms/apps/integrations/osticket/sync-agents.php','/home/dunerealms/apps/integrations/sync-staff-seals.php','/home/dunerealms/apps/integrations/seal-manifest.json'].every(existsSync))throw Error('Native adapters unavailable');

View file

@ -2,6 +2,7 @@ import {nativeForumFeed} from './native-forum-feed.mjs';
import {randomUUID} from 'node:crypto';
import {readFile} from 'node:fs/promises';
import {json} from './game-link.mjs';
import {OFFICIAL_ACCOUNT} from './official-account.mjs';
export const NEWS_CATEGORIES={world:'World',news:'NEWS',maintenance:'Maintenance',changelogs:'Changelogs',events:'Events',community:'Community',unis_blog:"Uni’s Blog"};
export function publicNewsExcerpt(body){return String(body||'').replace(/!\[[^\]]*\]\([^)]*\)/g,'').replace(/\[([^\]]+)\]\([^)]*\)/g,'$1').replace(/^\s*#{1,6}\s+/gm,'').replace(/[*_`]/g,'').replace(/\s+/g,' ').trim().slice(0,220);}
export async function initializeNews(db){
@ -12,7 +13,7 @@ export async function initializeNews(db){
const key='release:'+String(release.version).slice(0,100),existing=await db.prepare('SELECT id FROM website_posts WHERE source_key=?').bind(key).first();if(existing)continue;
const date=Date.parse(release.date);if(!Number.isFinite(date)||date>Date.now())continue;
const body=[release.synopsis,...(release.tasks||[]).flatMap(t=>[t.title,...(t.changes||[]).map(x=>'• '+x)])].filter(Boolean).join('\n\n').slice(0,12000);
await db.prepare('INSERT INTO website_posts(id,source_key,category,title,body,status,author_id,created_at,updated_at,published_at,version) VALUES(?,?,?,?,?,?,?,?,?,?,1) ON CONFLICT(source_key) DO UPDATE SET source_key=excluded.source_key').bind(randomUUID(),key,'changelogs',String(release.title||release.version).slice(0,120),body,'published','release-register',date,date,date).run();
await db.prepare('INSERT INTO website_posts(id,source_key,category,title,body,status,author_id,created_at,updated_at,published_at,version) VALUES(?,?,?,?,?,?,?,?,?,?,1) ON CONFLICT(source_key) DO UPDATE SET source_key=excluded.source_key').bind(randomUUID(),key,'changelogs',String(release.title||release.version).slice(0,120),body,'published',OFFICIAL_ACCOUNT.id,date,date,date).run();
}
}
export async function forumLinks(db,posts){try{if(!posts.length)return posts;const{results}=await db.prepare('SELECT post_id,thread_id FROM forum_news_delivery WHERE post_id IN ('+posts.map(()=>'?').join(',')+") AND thread_id>0 AND state='sent'").bind(...posts.map(p=>p.id)).all();const links=new Map(results.filter(r=>Number.isSafeInteger(Number(r.thread_id))&&Number(r.thread_id)>0).map(r=>[r.post_id,'https://forums.dunerealms.com/showthread.php?tid='+Number(r.thread_id)]));return posts.map(p=>({...p,forum_url:links.get(p.id)||null}));}catch{return posts.map(p=>({...p,forum_url:null}));}}

View file

@ -0,0 +1,11 @@
// Existing verified identities. Display names and client input never establish this link.
export const OFFICIAL_ACCOUNT=Object.freeze({
id:'2c281bc7-c352-4d9a-b94c-fa13eee1157d',username:'dunerealms',
ownerId:'f3ffda37-01e4-41ea-b89d-fbeda82e453e',
minecraftUuid:'00000000-0000-0000-0009-01f09764757f'
});
export async function organisationSubject(reader,userId,{lock=false}={}){
if(userId!==OFFICIAL_ACCOUNT.id)return {userId,alias:false};
const rows=await reader.query("SELECT x.user_id FROM org_control_principals x JOIN site_accounts a ON a.id=x.user_id JOIN site_game_links l ON l.user_id=a.id JOIN org_control_principals p ON p.user_id=? JOIN site_accounts owner ON owner.id=p.user_id WHERE x.user_id=? AND x.principal_kind='owner_alias' AND x.created_by=? AND a.username='dunerealms' AND a.role='official_account' AND a.password_hash NOT LIKE '!%' AND l.minecraft_uuid=? AND p.principal_kind='owner' AND owner.username='unimatrix999' AND owner.password_hash NOT LIKE '!%'"+(lock?' FOR SHARE':''),[OFFICIAL_ACCOUNT.ownerId,userId,OFFICIAL_ACCOUNT.ownerId,OFFICIAL_ACCOUNT.minecraftUuid]);
return rows.length?{userId:OFFICIAL_ACCOUNT.ownerId,alias:true}:{userId,alias:false};
}

View file

@ -3,6 +3,7 @@ import {randomUUID} from 'node:crypto';
import {identity} from './auth.mjs';
import {can,NODES} from './permissions.mjs';
import {staffScopes,validStaffRole,assignmentLabel} from './organisation-model.mjs';
import {organisationSubject} from './official-account.mjs';
const reply=(data,status=200)=>Response.json(data,{status,headers:{'Cache-Control':'no-store'}});
const fault=(message,status=409)=>Object.assign(new Error(message),{status});
@ -35,6 +36,7 @@ export function createOrganisationManagement(db,{origin='https://cp.dunerealms.c
async function authority(tx,userId){
const actor=await tx.first("SELECT id FROM site_accounts WHERE id=? AND password_hash NOT LIKE '!%' FOR SHARE",[userId]);
if(!actor)throw fault('Account authority changed.',403);
userId=(await organisationSubject(tx,userId,{lock:true})).userId;
const principal=await tx.first('SELECT principal_kind FROM org_control_principals WHERE user_id=? FOR SHARE',[userId]);
const assignments=await tx.query("SELECT scope_type,scope_key,role_key,status FROM org_assignments WHERE user_id=? AND status='active' AND starts_at<=? AND (ends_at IS NULL OR ends_at>?) FOR SHARE",[userId,clock(),clock()]);
return {principal:principal?.principal_kind||null,assignments};
@ -68,9 +70,10 @@ export function createOrganisationManagement(db,{origin='https://cp.dunerealms.c
if(url.pathname.endsWith('/effective')){
const now=clock();
const result=await db.transaction(async tx=>{
const assignments=await tx.query('SELECT id,scope_type,scope_key,role_key,status,starts_at,ends_at FROM org_assignments WHERE user_id=?',[userId]);
const subject=await organisationSubject(tx,userId);
const assignments=await tx.query('SELECT id,scope_type,scope_key,role_key,status,starts_at,ends_at FROM org_assignments WHERE user_id=?',[subject.userId]);
const policies=await tx.query('SELECT scope_type,scope_key,role_key,permissions_json,version FROM org_role_policies',[]);
const principal=await tx.first('SELECT principal_kind FROM org_control_principals WHERE user_id=?',[userId]);
const principal=await tx.first('SELECT principal_kind FROM org_control_principals WHERE user_id=?',[subject.userId]);
return effectiveOrganisationAccess({assignments,policies,registry:NODES,principalKind:principal?.principal_kind,now});
});return reply({...result,enforcement:db.organisationAccessEnabled?'active':'preparing'});
}

View file

@ -1,7 +1,8 @@
import {ORGANISATION,assignmentLabel,validStaffRole} from './organisation-model.mjs';
import {EXECUTIVE_TITLES} from './organisation-appointments.mjs';
import {OFFICIAL_ACCOUNT} from './official-account.mjs';
const weights={owner_ceo:100,executive:90,department_head:80,branch_lead:70,officer:50};
export function projectPublicOrganisation(rows,orderRows=[]){
export function projectPublicOrganisation(rows,orderRows=[],officialRows=[]){
const people=new Map();
for(const row of rows){
if(!validStaffRole(row.scope_type,row.scope_key,row.role_key)||row.game_link_exempt)continue;
@ -21,12 +22,14 @@ export function projectPublicOrganisation(rows,orderRows=[]){
const holders=(type,key,role)=>staff.filter(p=>p.functions.some(f=>f.scopeType===type&&f.scopeKey===key&&f.role===role)).map(p=>({username:p.username,displayName:p.displayName,title:p.title}));
const organisation=ORGANISATION.map(d=>({key:d.key,label:d.label,heads:holders('department',d.key,'department_head'),branches:d.branches.map(b=>({...b,leads:holders('branch',b.key,'branch_lead'),members:holders('branch',b.key,'officer')}))}));
const order=[...new Map(orderRows.map(r=>[r.username,{username:r.username,displayName:r.display_name||r.username,citation:r.citation||'',profile:r.slug?'/memorial/'+encodeURIComponent(r.slug):'/people/'+encodeURIComponent(r.username)}])).values()];
return {model:'organisation-v2',publishedOnly:true,executives:staff.filter(p=>p.functions.some(f=>f.scopeType==='organisation')).map(p=>({username:p.username,displayName:p.displayName,title:p.title})),organisation,staff,order};
const officialAccounts=officialRows.filter(r=>r.id===OFFICIAL_ACCOUNT.id&&r.username===OFFICIAL_ACCOUNT.username&&r.role==='official_account').map(r=>({username:r.username,displayName:'DuneRealms',title:'Official DuneRealms Account',bio:r.bio||'Official account operated by the DuneRealms owner. Verify this profile through the staff directory.',profile:'/people/'+r.username,avatar:'https://cp.dunerealms.com/api/avatars/face/roster/'+r.username,official:true,functions:[],seals:[]}));
return {model:'organisation-v2',publishedOnly:true,executives:staff.filter(p=>p.functions.some(f=>f.scopeType==='organisation')).map(p=>({username:p.username,displayName:p.displayName,title:p.title})),organisation,staff,order,officialAccounts};
}
export async function readPublicOrganisation(db){
return db.readSnapshot(async reader=>{
const rows=await reader.query("SELECT a.username,a.display_name,f.scope_type,f.scope_key,f.role_key,p.bio,g.minecraft_uuid,s.source_uuid,s.source_name,pol.game_link_exempt FROM staff_roster_publications r JOIN site_accounts a ON a.id=r.account_id JOIN org_assignments f ON f.user_id=a.id LEFT JOIN site_profiles p ON p.user_id=a.id LEFT JOIN site_game_links g ON g.user_id=a.id LEFT JOIN staff_source_members s ON s.user_id=a.id LEFT JOIN site_account_policies pol ON pol.user_id=a.id WHERE r.visible=1 AND a.password_hash NOT LIKE '!%' AND f.status='active' AND f.starts_at<=? AND (f.ends_at IS NULL OR f.ends_at>?) ORDER BY a.username,f.scope_type,f.scope_key LIMIT 2000",[Date.now(),Date.now()]);
const order=await reader.query("SELECT a.username,a.display_name,h.citation,m.slug FROM site_accounts a LEFT JOIN site_honours h ON h.user_id=a.id AND h.rank_key='crysknife' LEFT JOIN site_memorials m ON m.user_id=a.id WHERE (a.password_hash NOT LIKE '!%' OR a.password_hash='!memorial') AND a.role<>'official_account' AND (a.role='crysknife' OR EXISTS (SELECT 1 FROM cp_account_ranks r WHERE r.user_id=a.id AND r.rank_key='crysknife')) ORDER BY a.username LIMIT 250");
return projectPublicOrganisation(rows,order);
const official=await reader.query("SELECT a.id,a.username,a.role,p.bio FROM site_accounts a JOIN site_game_links l ON l.user_id=a.id LEFT JOIN site_profiles p ON p.user_id=a.id WHERE a.id=? AND a.username=? AND a.role='official_account' AND a.password_hash NOT LIKE '!%' AND l.minecraft_uuid=?",[OFFICIAL_ACCOUNT.id,OFFICIAL_ACCOUNT.username,OFFICIAL_ACCOUNT.minecraftUuid]);
return projectPublicOrganisation(rows,order,official);
});
}

View file

@ -1,5 +1,6 @@
import {effectiveOrganisationAccess} from './organisation-effective.mjs';
import {assignmentLabel,validStaffRole} from './organisation-model.mjs';
import {organisationSubject} from './official-account.mjs';
const SERVICE_ID='f7b88778-f0bc-41cc-9227-d8ef2f52264d';
const legacyStaff=new Set(['owners','owner','corestaff','staff','network_admin','web_net_admin','web_net_owner','web_network','official_account','admin','administrator','moderator','guardian','streamer','twitch','yt']);
const privileged=node=>/^web\.(accounts\.|ranks\.|servers\.|luckperms\.|tickets\.(staff|admin|appeals)|bank\.staff\.|payroll\.|posts\.(edit|publish)|items\.manage|bans\.|forum\.moderate|git\.admin)/.test(node)||/^cp\.(accounts\.|ranks\.|servers\.|luckperms\.|bank\.staff\.|items\.manage)/.test(node)||/^dune\.(admin|staff\.|moderation\.|ban\.|unban\.)/.test(node)||node.startsWith('duneprotect.')||/^(?:web|cp)\.menu\.(?:administration|staffmanual|permissions|servers|luckperms|bans|forum|items|posts)$/.test(node)||/^web\.(?:shop\.support|bank\.projects\.approve|mail\.staff\.)/.test(node);
@ -7,15 +8,16 @@ const nativeEditor=node=>['web.luckperms.edit','cp.luckperms.edit','luckperms.ed
export async function organisationRuntimeAccess(db,user,{registry,basicRank,legacyRanks,clock=Date.now}={}){
const now=clock();
const snapshot=await db.readSnapshot(async reader=>{
const principal=(await reader.query('SELECT principal_kind FROM org_control_principals WHERE user_id=?',[user.id]))[0];
const subject=await organisationSubject(reader,user.id);
const principal=(await reader.query('SELECT principal_kind FROM org_control_principals WHERE user_id=?',[subject.userId]))[0];
if(principal?.principal_kind==='service'){
const service=(await reader.query('SELECT service_uuid,game_link_exempt FROM site_account_policies WHERE user_id=?',[user.id]))[0];
if(user.id!==SERVICE_ID||!service?.game_link_exempt||service.service_uuid!=='00000000-0000-4000-8000-00000000de01')throw Error('Invalid service control identity.');
return {service:true};
}
const assignments=await reader.query("SELECT id,scope_type,scope_key,role_key,status,starts_at,ends_at FROM org_assignments WHERE user_id=? AND scope_type IN ('organisation','department','branch') AND status='active' AND starts_at<=? AND (ends_at IS NULL OR ends_at>?)",[user.id,now,now]);
const assignments=await reader.query("SELECT id,scope_type,scope_key,role_key,status,starts_at,ends_at FROM org_assignments WHERE user_id=? AND scope_type IN ('organisation','department','branch') AND status='active' AND starts_at<=? AND (ends_at IS NULL OR ends_at>?)",[subject.userId,now,now]);
const policies=await reader.query('SELECT scope_type,scope_key,role_key,permissions_json,version FROM org_role_policies',[]);
return {assignments,access:effectiveOrganisationAccess({assignments,policies,registry,principalKind:principal?.principal_kind,now})};
return {subject,assignments,access:effectiveOrganisationAccess({assignments,policies,registry,principalKind:principal?.principal_kind,now})};
});
if(snapshot.service)return null; // Preserve the existing verified Dev service access, including native tools.
const citizenRanks=legacyRanks.filter(r=>!legacyStaff.has(r.key)&&!r.key.startsWith('web_')&&!r.key.startsWith('game_'));
@ -27,5 +29,5 @@ export async function organisationRuntimeAccess(db,user,{registry,basicRank,lega
const precedence={owner_ceo:100,executive:90,department_head:80,branch_lead:70,officer:50};
active.sort((a,b)=>(precedence[b.role_key]||0)-(precedence[a.role_key]||0)||a.scope_key.localeCompare(b.scope_key));
const primary=active[0],citizen=ranks.reduce((a,b)=>a.level>=b.level?a:b,basicRank);
return {rank:primary?'org_'+primary.role_key:citizen.key,ranks:[...new Set([...ranks.map(r=>r.key),...active.map(a=>'org_'+a.role_key)])],label:primary?assignmentLabel(primary).roleLabel:citizen.label,level:primary?precedence[primary.role_key]||0:citizen.level,nodes:[...nodes].sort(),organisation:{mode:'active',assignments:active.map(assignmentLabel),missingPolicies:snapshot.access.missingPolicies,blocked:snapshot.access.blocked.length}};
return {rank:primary?'org_'+primary.role_key:citizen.key,ranks:[...new Set([...ranks.map(r=>r.key),...active.map(a=>'org_'+a.role_key)])],label:primary?assignmentLabel(primary).roleLabel:citizen.label,level:primary?precedence[primary.role_key]||0:citizen.level,nodes:[...nodes].sort(),organisation:{mode:'active',permissionPrincipalId:snapshot.subject.userId,officialOwnerAlias:snapshot.subject.alias,assignments:active.map(assignmentLabel),missingPolicies:snapshot.access.missingPolicies,blocked:snapshot.access.blocked.length}};
}

View file

@ -13,7 +13,7 @@ function render(p){
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{}}
const medals=(p.medals||[]).filter(m=>typeof m.url==='string'&&/^https:\/\/(www|support|forums)\.dunerealms\.com\/assets\/seals\/[a-zA-Z0-9_./-]+\.png$/.test(m.url));
const personal=medals.find(m=>m.key==='personal-role');if(personal){$('personal-seal-panel').hidden=false;$('personal-seal').append(sealCard(personal));}
if((p.ranks||[]).some(r=>r.key==='crysknife'))$('order-panel').hidden=false;
if(!p.showcase&&(p.ranks||[]).some(r=>r.key==='crysknife'))$('order-panel').hidden=false;
const groups=new Map();for(const m of medals){if(['personal-role','rank-crysknife'].includes(m.key))continue;const group=m.group||'Recognition';if(!groups.has(group))groups.set(group,[]);groups.get(group).push(m);}
for(const [name,items]of groups){const section=el('section'),cards=el('div',null,'profile-awards');section.append(el('h3',name));for(const m of items)cards.append(sealCard(m));section.append(cards);$('seals').append(section);}
if(!groups.size)$('seals').append(el('p','No additional seals or awards recorded.','muted'));

View file

@ -21,7 +21,7 @@ export function manualSealDecision({seal,actorAuthorized,targetId,actorId,action
return Object.freeze({seal,targetId,actorId,action,source:'staff'});
}
export function isShowcaseSeal(key,{personal=false}={}){
return typeof key==='string'&&!personal&&!NEVER_SHOWCASE.has(key)&&!/^(owner-|personal-staff-|network-staff-mr_|main-network-admin-|corestaff-)/i.test(key)&&!/crysknife/i.test(key);
return typeof key==='string'&&!personal&&!NEVER_SHOWCASE.has(key)&&!/^(owner-|personal-|network-staff-mr_|main-network-admin-|corestaff-)/i.test(key)&&!/crysknife|crissknife/i.test(key);
}
// Account identities must come from authenticated CP sessions and database rank lookups.

View file

@ -0,0 +1,14 @@
import {randomUUID} from 'node:crypto';import {fileURLToPath} from 'node:url';import {resolve} from 'node:path';
import {openDatabase} from '../node/mysql.mjs';import {OFFICIAL_ACCOUNT} from '../node/official-account.mjs';
export async function adoptAutomatedNewsAuthor(db,{actorId,apply=false}={}){
if(![OFFICIAL_ACCOUNT.ownerId,'f7b88778-f0bc-41cc-9227-d8ef2f52264d'].includes(actorId))throw Error('Pinned Owner or Dev actor required.');
return db.transaction(async tx=>{
const account=await tx.first("SELECT id FROM site_accounts WHERE id=? AND username=? AND role='official_account' AND password_hash NOT LIKE '!%' FOR SHARE",[OFFICIAL_ACCOUNT.id,OFFICIAL_ACCOUNT.username]);if(!account)throw Error('Official publishing identity unavailable.');
const actor=await tx.first("SELECT p.principal_kind FROM org_control_principals p JOIN site_accounts a ON a.id=p.user_id WHERE p.user_id=? AND a.password_hash NOT LIKE '!%' FOR SHARE",[actorId]);if(!['owner','service'].includes(actor?.principal_kind))throw Error('Current control actor required.');
const rows=await tx.query("SELECT id,source_key FROM website_posts WHERE author_id='release-register' AND LEFT(source_key,8)='release:' FOR UPDATE");
if(!apply)return {applied:false,automatedPosts:rows.length};
for(const p of rows){await tx.query("UPDATE website_posts SET author_id=?,version=version+1 WHERE id=? AND author_id='release-register'",[OFFICIAL_ACCOUNT.id,p.id]);await tx.query('INSERT INTO account_audit(id,actor_id,action,details,created_at) VALUES(?,?,?,?,?)',[randomUUID(),actorId,'automated-news-author',JSON.stringify({postId:p.id,source:p.source_key,previousAuthor:'release-register',authorId:OFFICIAL_ACCOUNT.id}),Date.now()]);}
return {applied:true,updated:rows.length,manualPostsChanged:false,newArticlesCreated:false};
});
}
if(process.argv[1]&&fileURLToPath(import.meta.url)===resolve(process.argv[1])){const db=await openDatabase(process.env);try{console.log(JSON.stringify(await adoptAutomatedNewsAuthor(db,{actorId:process.argv.find(a=>a.startsWith('--actor='))?.slice(8),apply:process.argv.includes('--apply')})));}finally{await db.close();}}

View file

@ -0,0 +1,23 @@
import {randomUUID} from 'node:crypto';import {fileURLToPath} from 'node:url';import {resolve} from 'node:path';
import {openDatabase} from '../node/mysql.mjs';import {initializeOrganisation} from '../node/organisation-model.mjs';import {OFFICIAL_ACCOUNT,organisationSubject} from '../node/official-account.mjs';
import {nativeSyncMutation} from '../node/native-sync-outbox.mjs';
const SERVICE_ID='f7b88778-f0bc-41cc-9227-d8ef2f52264d';
export async function bootstrapOfficialAlias(db,{actorId,apply=false}={}){
if(![OFFICIAL_ACCOUNT.ownerId,SERVICE_ID].includes(actorId))throw Error('Owner or pinned Dev actor required.');
return db.transaction(async tx=>{
const actor=await tx.first("SELECT p.principal_kind FROM org_control_principals p JOIN site_accounts a ON a.id=p.user_id WHERE p.user_id=? AND a.password_hash NOT LIKE '!%' FOR SHARE",[actorId]);
if(actor?.principal_kind!==(actorId===SERVICE_ID?'service':'owner'))throw Error('Current control actor required.');
const account=await tx.first("SELECT a.id FROM site_accounts a JOIN site_game_links l ON l.user_id=a.id WHERE a.id=? AND a.username=? AND a.role='official_account' AND a.password_hash NOT LIKE '!%' AND l.minecraft_uuid=? FOR SHARE",[OFFICIAL_ACCOUNT.id,OFFICIAL_ACCOUNT.username,OFFICIAL_ACCOUNT.minecraftUuid]);
const owner=await tx.first("SELECT p.user_id FROM org_control_principals p JOIN site_accounts a ON a.id=p.user_id WHERE p.user_id=? AND p.principal_kind='owner' AND a.username='unimatrix999' AND a.password_hash NOT LIKE '!%' FOR SHARE",[OFFICIAL_ACCOUNT.ownerId]);
if(!account||!owner)throw Error('Pinned official and owner identities must match.');
const existing=await tx.first('SELECT principal_kind,created_by FROM org_control_principals WHERE user_id=? FOR UPDATE',[OFFICIAL_ACCOUNT.id]);
if(existing&&(existing.principal_kind!=='owner_alias'||existing.created_by!==OFFICIAL_ACCOUNT.ownerId))throw Error('Existing control identity differs; refusing overwrite.');
if(!apply)return {applied:false,aliasUserId:OFFICIAL_ACCOUNT.id,permissionPrincipalId:OFFICIAL_ACCOUNT.ownerId,alreadyLinked:!!existing};
if(!existing){const now=Date.now();await tx.query('INSERT INTO org_control_principals(user_id,principal_kind,created_by,created_at) VALUES(?,?,?,?)',[OFFICIAL_ACCOUNT.id,'owner_alias',OFFICIAL_ACCOUNT.ownerId,now]);
await tx.query('INSERT INTO org_assignment_events(id,user_id,actor_id,action,scope_type,scope_key,reason,after_json,created_at) VALUES(?,?,?,?,?,?,?,?,?)',[randomUUID(),OFFICIAL_ACCOUNT.id,actorId,'owner-alias-baseline','organisation','dunerealms','Owner explicitly authorised dunerealms Bedrock alternate account to follow the same function rights',JSON.stringify({permissionPrincipalId:OFFICIAL_ACCOUNT.ownerId,extraStaffAppointment:false}),now]);
const sync=nativeSyncMutation(now);await tx.query(sync.sql,sync.values);}
const subject=await organisationSubject(tx,OFFICIAL_ACCOUNT.id,{lock:true});if(!subject.alias)throw Error('Official identity verification failed.');
return {applied:true,created:!existing,aliasUserId:OFFICIAL_ACCOUNT.id,permissionPrincipalId:subject.userId};
});
}
if(process.argv[1]&&fileURLToPath(import.meta.url)===resolve(process.argv[1])){const db=await openDatabase(process.env);try{await initializeOrganisation(db);console.log(JSON.stringify(await bootstrapOfficialAlias(db,{actorId:process.argv.find(a=>a.startsWith('--actor='))?.slice(8),apply:process.argv.includes('--apply')})));}finally{await db.close();}}

View file

@ -0,0 +1,21 @@
import test from 'node:test';import assert from 'node:assert/strict';
import {OFFICIAL_ACCOUNT,organisationSubject} from '../node/official-account.mjs';
import {organisationRuntimeAccess} from '../node/organisation-runtime.mjs';import {DEFAULT_RANKS,NODES} from '../node/permissions.mjs';
test('Owner alias is pinned, requires current verified database link, and falls back after revocation',async()=>{
const queries=[];let enabled=true;const reader={query:async(sql,args)=>{queries.push({sql,args});return enabled?[{user_id:OFFICIAL_ACCOUNT.id}]:[];}};
assert.deepEqual(await organisationSubject(reader,'other-account'),{userId:'other-account',alias:false});assert.equal(queries.length,0);
assert.deepEqual(await organisationSubject(reader,OFFICIAL_ACCOUNT.id,{lock:true}),{userId:OFFICIAL_ACCOUNT.ownerId,alias:true});assert.match(queries[0].sql,/FOR SHARE$/);assert(queries[0].args.includes(OFFICIAL_ACCOUNT.minecraftUuid));assert.match(queries[0].sql,/owner\.password_hash NOT LIKE/);
enabled=false;assert.deepEqual(await organisationSubject(reader,OFFICIAL_ACCOUNT.id),{userId:OFFICIAL_ACCOUNT.id,alias:false});
});
test('Verified alt inherits current Owner function rights and payroll control without copying appointments or honours',async()=>{
const assignment={id:'owner-position',scope_type:'organisation',scope_key:'dunerealms',role_key:'owner_ceo',status:'active',starts_at:1,ends_at:null};let enabled=true;
const db={readSnapshot:async fn=>fn({query:async(sql,args)=>{
if(sql.startsWith('SELECT x.user_id'))return enabled?[{user_id:OFFICIAL_ACCOUNT.id}]:[];
if(sql.includes('org_control_principals'))return args[0]===OFFICIAL_ACCOUNT.ownerId?[{principal_kind:'owner'}]:[{principal_kind:'owner_alias'}];
if(sql.includes('org_assignments'))return args[0]===OFFICIAL_ACCOUNT.ownerId?[assignment]:[];
return [{scope_type:'organisation',scope_key:'dunerealms',role_key:'owner_ceo',permissions_json:JSON.stringify(['web.bank.staff.manage','web.payroll.manage','web.ranks.manage']),version:1}];
}})};
const rights=id=>organisationRuntimeAccess(db,{id},{registry:NODES,basicRank:DEFAULT_RANKS[0],legacyRanks:[],clock:()=>10});
const owner=await rights(OFFICIAL_ACCOUNT.ownerId),alt=await rights(OFFICIAL_ACCOUNT.id);assert.deepEqual(alt.nodes,owner.nodes);assert.equal(alt.organisation.permissionPrincipalId,OFFICIAL_ACCOUNT.ownerId);assert.equal(alt.organisation.officialOwnerAlias,true);assert(!alt.ranks.includes('crysknife'));
enabled=false;const revoked=await rights(OFFICIAL_ACCOUNT.id);assert(!revoked.nodes.includes('web.bank.staff.manage'));assert(!revoked.nodes.includes('web.payroll.manage'));
});

View file

@ -1,6 +1,12 @@
import test from 'node:test';import assert from 'node:assert/strict';
import {projectPublicOrganisation} from '../node/organisation-public-roster.mjs';
import {OFFICIAL_ACCOUNT} from '../node/official-account.mjs';
const row=(username,scope_type,scope_key,role_key,extra={})=>({username,display_name:username,bio:'A public biography',scope_type,scope_key,role_key,...extra});
test('Official identity has a separate verification card and never adds a fifth executive',()=>{
const official={id:OFFICIAL_ACCOUNT.id,username:'dunerealms',role:'official_account'};
const data=projectPublicOrganisation([],[],[official,{...official,id:'impostor'}]);assert.equal(data.officialAccounts.length,1);assert.equal(data.officialAccounts[0].profile,'/people/dunerealms');assert.equal(data.staff.length,0);assert.equal(data.executives.length,0);
});
test('One public biography card per person retains multiple functions and executive ordering',()=>{
const data=projectPublicOrganisation([row('mr_blueray','branch','customer_support','branch_lead'),row('mr_blueray','organisation','dunerealms','executive'),row('unimatrix999','organisation','dunerealms','owner_ceo'),row('mr_blueray','branch','customer_support','branch_lead')]);
assert.equal(data.staff.length,2);assert.equal(data.staff[0].username,'unimatrix999');assert.equal(data.staff[1].functions.length,2);assert.equal(data.staff[1].title,'Chief Community Officer');assert.equal(data.organisation[0].branches[0].leads[0].username,'mr_blueray');assert.deepEqual(data.organisation[1].heads,[]);

View file

@ -5,7 +5,7 @@ test('all canonical donor tiers map to distinct existing artwork',()=>{assert.eq
test('unverified and incomplete payments never award seals',()=>{for(const status of ['pending','failed','refunded','chargeback'])assert.equal(purchaseSealDecision({tier:'vip',paymentStatus:status,verified:true,accountId:'a',orderId:'o'}),null);assert.equal(purchaseSealDecision({tier:'vip',paymentStatus:'completed',verified:false,accountId:'a',orderId:'o'}),null);});
test('verified purchases have stable idempotency keys',()=>{const args={tier:'patron_grand',paymentStatus:'completed',verified:true,accountId:'a',orderId:'o'};assert.deepEqual(purchaseSealDecision(args),purchaseSealDecision(args));assert.equal(purchaseSealDecision(args).idempotencyKey,'purchase:o:supporter-patron-grand-v1');});
test('staff decisions require authorization and reject self-awards',()=>{assert.equal(manualSealDecision({seal:'alpha-tester',actorAuthorized:false,targetId:'a',actorId:'b',action:'grant'}),null);assert.equal(manualSealDecision({seal:'alpha-tester',actorAuthorized:true,targetId:'a',actorId:'a',action:'grant'}),null);assert.equal(manualSealDecision({seal:'crysknife',actorAuthorized:true,targetId:'a',actorId:'b',action:'grant'}),null);assert.equal(manualSealDecision({seal:'beta-tester',actorAuthorized:true,targetId:'a',actorId:'b',action:'grant'}).action,'grant');});
test('showcase excludes personal seals and Crysknife',()=>{assert.equal(isShowcaseSeal('owner-unimatrix999'),false);assert.equal(isShowcaseSeal('order-crysknife-v1'),false);assert.equal(isShowcaseSeal('alpha-tester'),true);assert.equal(isShowcaseSeal('supporter-vip-v1'),true);});
test('showcase excludes personal seals and Crysknife',()=>{assert.equal(isShowcaseSeal('owner-unimatrix999'),false);assert.equal(isShowcaseSeal('order-crysknife-v1'),false);assert.equal(isShowcaseSeal('personal-department-support-somebody'),false);assert.equal(isShowcaseSeal('custom-recognition',{personal:true}),false);assert.equal(isShowcaseSeal('alpha-tester'),true);assert.equal(isShowcaseSeal('supporter-vip-v1'),true);});
import {crysknifeGrantDecision,CRYSKNIFE_FOUNDERS} from '../node/seal-entitlements.mjs';
test('founders can grant without possessing Crysknife',()=>{

View file

@ -1 +1,2 @@
*{box-sizing:border-box}body{margin:0;background:#0a2119;color:#e7eadc;font:15px/1.6 Arial,sans-serif}a{color:#ecd597}main.staff-directory{max-width:1420px;margin:44px auto;padding:0 30px}.staff-hero{display:flex;align-items:center;gap:32px;padding:40px;border:1px solid #b59c59;border-radius:20px;background:linear-gradient(115deg,#244736,#102b22)}.staff-hero>img{width:125px;height:125px;object-fit:contain}.staff-eyebrow,.staff-directory small{font-size:10px;letter-spacing:.14em;color:#beaa73}.staff-directory h1{font:48px/1.15 Georgia,serif;color:#efdaa1;margin:8px 0}.staff-directory h2{font:30px Georgia,serif;color:#efdaa1}.staff-directory h3{font:23px Georgia,serif;color:#efdaa1}.staff-directory h4{font-size:15px;color:#efdaa1;margin:0 0 15px}.staff-section{margin:40px 0}.staff-section>p{color:#bacabd;max-width:760px}.staff-executives{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin:25px 0}.staff-executives article{padding:25px;border:1px solid #aa925a;border-radius:12px;background:linear-gradient(145deg,#3b4431,#142c23)}.staff-executives small,.staff-executives a{display:block}.staff-executives a{font-size:21px;font-weight:700;text-decoration:none;margin-top:10px}.staff-departments{display:grid;grid-template-columns:1fr 1fr;gap:25px}.staff-department{border:1px solid #687c57;border-radius:16px;padding:25px;background:#143226}.staff-department>header{display:flex;gap:16px;align-items:center}.staff-department>header img{width:65px;height:65px;object-fit:contain}.staff-holders{display:flex;gap:8px;flex-wrap:wrap;margin:6px 0 15px}.staff-holders a{padding:3px 9px;border:1px solid #5b7153;border-radius:6px;text-decoration:none;font-size:13px;background:#1d3e2e}.staff-vacant{font-size:11px;color:#a8b6a4}.staff-branches{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:20px}.staff-branches article{border:1px solid #405d46;border-radius:10px;padding:16px;background:#0f291f}.staff-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.staff-person{border:1px solid #607c59;border-radius:14px;padding:24px;background:linear-gradient(145deg,#1b392b,#112b21)}.staff-person header{display:flex;gap:16px;align-items:center}.staff-person header img{border-radius:12px;background:#0a2119;object-fit:cover}.staff-person header a{font:700 22px Georgia,serif;text-decoration:none}.staff-title{color:#d4bd7c;font-size:13px}.staff-bio{color:#c2cfc0;white-space:pre-wrap;font-size:14px}.staff-person ul{list-style:none;margin:20px 0;padding:0}.staff-person li{padding:9px 0;border-top:1px solid #3c5842}.staff-person li strong,.staff-person li span{display:block;font-size:12px}.staff-person li span{color:#a8bcab}.staff-marks{display:flex;gap:12px;flex-wrap:wrap;margin-top:15px}.staff-marks img{height:70px;width:70px;object-fit:contain}.staff-person summary{cursor:pointer;color:#d9c386;font-size:12px}.staff-order{padding:30px;border:1px solid #ae934d;border-radius:18px;background:radial-gradient(at top right,#4a4429,#183127 70%)}.staff-order-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.staff-order-member{padding:22px;border:1px solid #796e46;border-radius:12px}.staff-order-member>img{width:72px;height:72px;object-fit:contain;float:left;margin-right:16px}.staff-order-member a{font:21px Georgia,serif}.staff-order-member p{white-space:pre-wrap;font-size:13px}.staff-contact{display:flex;align-items:center;justify-content:space-between;gap:25px;padding:25px;border:1px solid #607c59;border-radius:14px}.staff-contact a{padding:12px 20px;border:1px solid #ad9554;border-radius:8px;text-decoration:none;white-space:nowrap}.staff-empty{color:#becbbb;padding:18px;border:1px dashed #6b7953;border-radius:10px}#staff-status{font-size:13px;color:#c7d2bf}#organisation-chart{overflow-x:auto}.staff-directory :focus-visible{outline:2px solid #f1d182;outline-offset:4px}
.staff-intro{padding:8px 0 26px;border-bottom:1px solid #79926555;margin-bottom:28px}.staff-intro h1{font:36px Georgia,serif;color:#ecd69d;margin:0 0 8px}.staff-intro p{margin:0;color:#bed0bd}.staff-official{border-color:#c7ac65;background:linear-gradient(120deg,#51472b44,#12352a)}.staff-official .staff-cards{max-width:580px}.staff-verified{display:inline-block;padding:4px 10px;border:1px solid #cfb46d;border-radius:20px;color:#efd993;font-size:11px;margin-bottom:14px}

View file

@ -12,6 +12,7 @@ function render(data){const chart=document.querySelector('#organisation-chart'),
const exec=el('div',undefined,'staff-executives');for(const p of data.executives){const c=el('article');c.append(el('small',p.title),profile(p));exec.append(c);}chart.append(exec);
const deps=el('div',undefined,'staff-departments');for(const d of data.organisation){const section=el('section',undefined,'staff-department'),head=el('header');head.append(seal(files[d.key],d.label),el('h3',d.label));section.append(head,el('small','DEPARTMENT HEAD'),holders(d.heads));const branches=el('div',undefined,'staff-branches');for(const b of d.branches){const c=el('article');c.append(el('h4',b.label),el('small','BRANCH LEAD'),holders(b.leads),el('small','OFFICERS'),holders(b.members,'No published officers'));branches.append(c);}section.append(branches);deps.append(section);}chart.append(deps);
for(const p of data.staff)cards.append(card(p));if(!data.staff.length)cards.append(el('p','No staff profiles are published yet.','staff-empty'));
for(const p of data.officialAccounts||[]){const c=card(p);c.prepend(el('span','Verified official account','staff-verified'));document.querySelector('#official-accounts').append(c);document.querySelector('#official-account-section').hidden=false;}
for(const p of data.order){const c=el('article',undefined,'staff-order-member');c.append(seal('order-crysknife-v1.png','Holy Order of the Crysknife'),profile(p));if(p.citation)c.append(el('p',p.citation));order.append(c);}if(!data.order.length)order.append(el('p','No public Order memberships are listed.','staff-empty'));
document.querySelector('#staff-status').textContent=data.staff.length+' published staff profiles · Functions from the central organisation register.';
}

File diff suppressed because one or more lines are too long