diff --git a/website/artwork/seals/great-migration/catalogue.json b/website/artwork/seals/great-migration/catalogue.json new file mode 100644 index 00000000..bc298017 --- /dev/null +++ b/website/artwork/seals/great-migration/catalogue.json @@ -0,0 +1,123 @@ +{ + "scope-community_operations-v1": { + "label": "Community Operations", + "category": "Function", + "scopeKey": "community_operations" + }, + "scope-dunerealms_operations-v1": { + "label": "DuneRealms Operations", + "category": "Function", + "scopeKey": "dunerealms_operations" + }, + "scope-customer_support-v1": { + "label": "Customer Support", + "category": "Function", + "scopeKey": "customer_support" + }, + "scope-sales_accounts-v1": { + "label": "Sales & Account Services", + "category": "Function", + "scopeKey": "sales_accounts" + }, + "scope-content_creative-v1": { + "label": "Content & Creative", + "category": "Function", + "scopeKey": "content_creative" + }, + "scope-news_media-v1": { + "label": "News & Media", + "category": "Function", + "scopeKey": "news_media" + }, + "scope-trust_safety-v1": { + "label": "Trust & Safety", + "category": "Function", + "scopeKey": "trust_safety" + }, + "scope-it_operations-v1": { + "label": "IT Operations", + "category": "Function", + "scopeKey": "it_operations" + }, + "scope-engineering-v1": { + "label": "Engineering", + "category": "Function", + "scopeKey": "engineering" + }, + "scope-people_operations-v1": { + "label": "People Operations", + "category": "Function", + "scopeKey": "people_operations" + }, + "scope-legal_compliance-v1": { + "label": "Legal & Compliance", + "category": "Function", + "scopeKey": "legal_compliance" + }, + "personal-unimatrix999-ceo-v1": { + "label": "unimatrix999", + "category": "Personal", + "role": "CEO", + "personal": true + }, + "personal-grmacken-cto-v1": { + "label": "grmacken", + "category": "Personal", + "role": "CTO", + "personal": true + }, + "personal-richwjr-coo-v1": { + "label": "richwjr", + "category": "Personal", + "role": "COO", + "personal": true + }, + "personal-mr_blueray-cco-v1": { + "label": "mr_blueray", + "category": "Personal", + "role": "CCO", + "personal": true + }, + "personal-staff-am_mk-v1": { + "label": "am_mk", + "category": "Personal", + "role": "STAFF", + "personal": true + }, + "personal-staff-larry7517-v1": { + "label": "larry7517", + "category": "Personal", + "role": "STAFF", + "personal": true + }, + "personal-staff-mustafaje-v1": { + "label": "mustafaje", + "category": "Personal", + "role": "STAFF", + "personal": true + }, + "personal-staff-s_oio_s-v1": { + "label": "s_oio_s", + "category": "Personal", + "role": "STAFF", + "personal": true + }, + "personal-staff-s73ffupk7hx-v1": { + "label": "bedrock_s73ffupk7hx", + "category": "Personal", + "role": "STAFF", + "personal": true + }, + "personal-staff-the_game_lordyt-v1": { + "label": "the_game_lordyt", + "category": "Personal", + "role": "STAFF", + "personal": true + }, + "personal-staff-tyrario1703-v1": { + "label": "tyrario1703", + "category": "Personal", + "role": "STAFF", + "personal": true + } +} diff --git a/website/artwork/seals/great-migration/personal-grmacken-cto-v1.png b/website/artwork/seals/great-migration/personal-grmacken-cto-v1.png new file mode 100644 index 00000000..5c1b6f80 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-grmacken-cto-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-mr_blueray-cco-v1.png b/website/artwork/seals/great-migration/personal-mr_blueray-cco-v1.png new file mode 100644 index 00000000..d3d84186 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-mr_blueray-cco-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-richwjr-coo-v1.png b/website/artwork/seals/great-migration/personal-richwjr-coo-v1.png new file mode 100644 index 00000000..28b09bf5 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-richwjr-coo-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-am_mk-v1.png b/website/artwork/seals/great-migration/personal-staff-am_mk-v1.png new file mode 100644 index 00000000..3b547991 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-am_mk-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-larry7517-v1.png b/website/artwork/seals/great-migration/personal-staff-larry7517-v1.png new file mode 100644 index 00000000..b409231a Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-larry7517-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-mustafaje-v1.png b/website/artwork/seals/great-migration/personal-staff-mustafaje-v1.png new file mode 100644 index 00000000..b8e38466 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-mustafaje-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-s73ffupk7hx-v1.png b/website/artwork/seals/great-migration/personal-staff-s73ffupk7hx-v1.png new file mode 100644 index 00000000..17771b5f Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-s73ffupk7hx-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-s_oio_s-v1.png b/website/artwork/seals/great-migration/personal-staff-s_oio_s-v1.png new file mode 100644 index 00000000..3ac4c461 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-s_oio_s-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-the_game_lordyt-v1.png b/website/artwork/seals/great-migration/personal-staff-the_game_lordyt-v1.png new file mode 100644 index 00000000..675ef29a Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-the_game_lordyt-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-staff-tyrario1703-v1.png b/website/artwork/seals/great-migration/personal-staff-tyrario1703-v1.png new file mode 100644 index 00000000..0a9e9561 Binary files /dev/null and b/website/artwork/seals/great-migration/personal-staff-tyrario1703-v1.png differ diff --git a/website/artwork/seals/great-migration/personal-unimatrix999-ceo-v1.png b/website/artwork/seals/great-migration/personal-unimatrix999-ceo-v1.png new file mode 100644 index 00000000..4d9985ba Binary files /dev/null and b/website/artwork/seals/great-migration/personal-unimatrix999-ceo-v1.png differ diff --git a/website/artwork/seals/great-migration/prompts.json b/website/artwork/seals/great-migration/prompts.json new file mode 100644 index 00000000..bb1941a0 --- /dev/null +++ b/website/artwork/seals/great-migration/prompts.json @@ -0,0 +1,100 @@ +{ + "tool": "built-in image_gen", + "reference": "gm-personal-staff-reference.png (existing yooshi staff seal)", + "prompts": [ + { + "path": "website/artwork/seals/great-migration/scope-community_operations-v1.png", + "prompt": "Create an organisational seal by editing the supplied DuneRealms seal. Preserve the exact ornate circular metallic gold and emerald-green house style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace the personal name yooshi on the large ribbon with exactly: Community Operations. Fit the full department name clearly on the ribbon, using two balanced lines if needed. Replace the small STAFF plaque with exactly: DEPARTMENT. This is an institutional department seal: no person's name anywhere. Sharp correctly spelled dark lettering, faithful style, no new scene or mockup. Keep the entire circular silhouette inside the canvas with a little genuinely transparent breathing room. Real transparent alpha background." + }, + { + "path": "website/artwork/seals/great-migration/scope-dunerealms_operations-v1.png", + "prompt": "Create an organisational seal by editing the supplied DuneRealms seal. Preserve the exact ornate circular metallic gold and emerald-green house style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace the personal name yooshi on the large ribbon with exactly: DuneRealms Operations. Fit the full department name clearly on the ribbon, using two balanced lines if needed. Replace the small STAFF plaque with exactly: DEPARTMENT. This is an institutional department seal: no person's name anywhere. Sharp correctly spelled dark lettering, faithful style, no new scene or mockup. Keep the entire circular silhouette inside the canvas with a little genuinely transparent breathing room. Real transparent alpha background." + }, + { + "path": "website/artwork/seals/great-migration/scope-customer_support-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve the exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace the personal name yooshi on the large ribbon with exactly: Customer Support. Fit the complete name legibly, two balanced lines if necessary; retain the literal ampersand when present. Replace the small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene or mockup. Entire circular seal within the canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "website/artwork/seals/great-migration/scope-sales_accounts-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve the exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace the personal name yooshi on the large ribbon with exactly: Sales & Account Services. Fit the complete name legibly, two balanced lines if necessary; retain the literal ampersand when present. Replace the small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene or mockup. Entire circular seal within the canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "website/artwork/seals/great-migration/scope-content_creative-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve the exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace the personal name yooshi on the large ribbon with exactly: Content & Creative. Fit the complete name legibly, two balanced lines if necessary; retain the literal ampersand when present. Replace the small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene or mockup. Entire circular seal within the canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "C:/Users/thoma/Documents/Codex/2026-11-13/imperial-postbank/website/artwork/seals/great-migration/scope-news_media-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace personal name yooshi on large ribbon with exactly: News & Media. Fit complete name legibly, two balanced lines if necessary; retain literal ampersand. Replace small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene/mockup. Entire circular seal within canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "C:/Users/thoma/Documents/Codex/2026-11-13/imperial-postbank/website/artwork/seals/great-migration/scope-trust_safety-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace personal name yooshi on large ribbon with exactly: Trust & Safety. Fit complete name legibly, two balanced lines if necessary; retain literal ampersand. Replace small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene/mockup. Entire circular seal within canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "C:/Users/thoma/Documents/Codex/2026-11-13/imperial-postbank/website/artwork/seals/great-migration/scope-it_operations-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace personal name yooshi on large ribbon with exactly: IT Operations. Fit complete name legibly, two balanced lines if necessary; retain literal ampersand. Replace small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene/mockup. Entire circular seal within canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "C:/Users/thoma/Documents/Codex/2026-11-13/imperial-postbank/website/artwork/seals/great-migration/scope-engineering-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace personal name yooshi on large ribbon with exactly: Engineering. Fit complete name legibly, two balanced lines if necessary; retain literal ampersand. Replace small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene/mockup. Entire circular seal within canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "C:/Users/thoma/Documents/Codex/2026-11-13/imperial-postbank/website/artwork/seals/great-migration/scope-people_operations-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace personal name yooshi on large ribbon with exactly: People Operations. Fit complete name legibly, two balanced lines if necessary; retain literal ampersand. Replace small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene/mockup. Entire circular seal within canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "C:/Users/thoma/Documents/Codex/2026-11-13/imperial-postbank/website/artwork/seals/great-migration/scope-legal_compliance-v1.png", + "prompt": "Edit the supplied DuneRealms seal into an institutional branch seal. Preserve exact ornate circular metallic gold and emerald-green style, crown, lantern shield, laurels, scrollwork and top ring text DUNEREALMS.COM. Replace personal name yooshi on large ribbon with exactly: Legal & Compliance. Fit complete name legibly, two balanced lines if necessary; retain literal ampersand. Replace small STAFF plaque with exactly: BRANCH. No person's name anywhere. Sharp correctly spelled dark lettering, faithful existing style, no scene/mockup. Entire circular seal within canvas with a little genuinely transparent breathing room; preserve real alpha transparency." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-am_mk-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: am_mk. Exact spelling including underscores; sharp dark legible lettering. Faithful production variant, no redesign or new decoration. Entire seal centered with a little transparent breathing room around it, genuinely transparent alpha background, no added scene, no mockup." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-larry7517-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: larry7517. Exact spelling including underscores; sharp dark legible lettering. Faithful production variant, no redesign or new decoration. Entire seal centered with a little transparent breathing room around it, genuinely transparent alpha background, no added scene, no mockup." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-mustafaje-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: mustafaje. Exact spelling including underscores and numbers, sharp dark legible lettering. Faithful production variant, no redesign, no new decoration. Entire seal centered with a little transparent breathing room, genuinely transparent alpha background, no scene, no mockup." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-s_oio_s-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: s_oio_s. Exact spelling including underscores and numbers, sharp dark legible lettering. Faithful production variant, no redesign, no new decoration. Entire seal centered with a little transparent breathing room, genuinely transparent alpha background, no scene, no mockup." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-s73ffupk7hx-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: s73ffupk7hx. Exact spelling including underscores and numbers, sharp dark legible lettering. Faithful production variant, no redesign, no new decoration. Entire seal centered with a little transparent breathing room, genuinely transparent alpha background, no scene, no mockup." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-the_game_lordyt-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: the_game_lordyt. Exact spelling including all underscores and numbers. Fit the complete name legibly on one line within the same ribbon, reducing lettering size if necessary. Faithful production variant, no redesign. Entire seal centered with transparent breathing room, genuinely transparent alpha background, no scene or mockup." + }, + { + "path": "website/artwork/seals/great-migration/personal-staff-tyrario1703-v1.png", + "prompt": "Edit the supplied existing DuneRealms personal staff seal. Preserve the exact ornate circular metallic gold and emerald-green design, crown, lantern shield, laurels, scrollwork, top text DUNEREALMS.COM and bottom plaque STAFF. Change ONLY the large name ribbon text yooshi to exactly: tyrario1703. Exact spelling including all underscores and numbers. Fit the complete name legibly on one line within the same ribbon, reducing lettering size if necessary. Faithful production variant, no redesign. Entire seal centered with transparent breathing room, genuinely transparent alpha background, no scene or mockup." + } + ], + "executives": [ + { + "name": "unimatrix999", + "title": "CEO", + "prompt": "Edit the supplied personal staff seal. Preserve its exact gold and emerald style, crown, lantern shield, laurels, DUNEREALMS.COM ring. Replace yooshi with exactly unimatrix999 and STAFF with exactly CEO. Preserve real alpha transparency; whole seal inside canvas." + }, + { + "name": "grmacken", + "title": "CTO", + "prompt": "Edit the supplied personal staff seal. Preserve its exact gold and emerald style, crown, lantern shield, laurels, DUNEREALMS.COM ring. Replace yooshi with exactly grmacken and STAFF with exactly CTO. Preserve real alpha transparency; whole seal inside canvas." + }, + { + "name": "richwjr", + "title": "COO", + "prompt": "Edit the supplied personal staff seal. Preserve its exact gold and emerald style, crown, lantern shield, laurels, DUNEREALMS.COM ring. Replace yooshi with exactly richwjr and STAFF with exactly COO. Preserve real alpha transparency; whole seal inside canvas." + }, + { + "name": "Mr_BlueRay", + "title": "CCO", + "prompt": "Edit the supplied personal staff seal. Preserve its exact gold and emerald style, crown, lantern shield, laurels, DUNEREALMS.COM ring. Replace yooshi with exactly Mr_BlueRay and STAFF with exactly CCO. Preserve real alpha transparency; whole seal inside canvas." + } + ] +} diff --git a/website/artwork/seals/great-migration/scope-community_operations-v1.png b/website/artwork/seals/great-migration/scope-community_operations-v1.png new file mode 100644 index 00000000..2867206a Binary files /dev/null and b/website/artwork/seals/great-migration/scope-community_operations-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-content_creative-v1.png b/website/artwork/seals/great-migration/scope-content_creative-v1.png new file mode 100644 index 00000000..a79233a7 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-content_creative-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-customer_support-v1.png b/website/artwork/seals/great-migration/scope-customer_support-v1.png new file mode 100644 index 00000000..e2a377dc Binary files /dev/null and b/website/artwork/seals/great-migration/scope-customer_support-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-dunerealms_operations-v1.png b/website/artwork/seals/great-migration/scope-dunerealms_operations-v1.png new file mode 100644 index 00000000..ce8cf8f8 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-dunerealms_operations-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-engineering-v1.png b/website/artwork/seals/great-migration/scope-engineering-v1.png new file mode 100644 index 00000000..8cc9d254 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-engineering-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-it_operations-v1.png b/website/artwork/seals/great-migration/scope-it_operations-v1.png new file mode 100644 index 00000000..fe61db16 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-it_operations-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-legal_compliance-v1.png b/website/artwork/seals/great-migration/scope-legal_compliance-v1.png new file mode 100644 index 00000000..1135dfd0 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-legal_compliance-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-news_media-v1.png b/website/artwork/seals/great-migration/scope-news_media-v1.png new file mode 100644 index 00000000..a1382637 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-news_media-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-people_operations-v1.png b/website/artwork/seals/great-migration/scope-people_operations-v1.png new file mode 100644 index 00000000..fc60c125 Binary files /dev/null and b/website/artwork/seals/great-migration/scope-people_operations-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-sales_accounts-v1.png b/website/artwork/seals/great-migration/scope-sales_accounts-v1.png new file mode 100644 index 00000000..a562207d Binary files /dev/null and b/website/artwork/seals/great-migration/scope-sales_accounts-v1.png differ diff --git a/website/artwork/seals/great-migration/scope-trust_safety-v1.png b/website/artwork/seals/great-migration/scope-trust_safety-v1.png new file mode 100644 index 00000000..f2e3005f Binary files /dev/null and b/website/artwork/seals/great-migration/scope-trust_safety-v1.png differ diff --git a/website/docs/great-migration.md b/website/docs/great-migration.md index 26575298..db2e4de5 100644 --- a/website/docs/great-migration.md +++ b/website/docs/great-migration.md @@ -55,6 +55,23 @@ derived rights/seals must follow their lifecycle. Earned honours remain intact. Do not change the public version banner or publish release news before .7 is done. +## Personal and function seal batch + +The current organisation catalogue supplies eleven department/branch seals and +eleven new personal seals, alongside three existing Staff personal seals. Big +Four artwork carries the fixed CEO/CTO/COO/CCO title; other personal seals say +Staff. The official account has no personal seal. The public organigram, staff +cards, profiles and managed native signatures follow current appointments; +earned service awards retain their existing eligibility and artwork. + +Raster originals, prompts and catalogue live in artwork/seals/great-migration. +package-migration-seals.py creates alpha-preserving 150/300px delivery images. +install-migration-seals.py plans by default; --apply installs custom adapters, +merges the historical manifest and copies native delivery images. It does not +alter native application core files. Run native seal/profile reconciliation +after deployment. The native avatar allowlist now accepts the central face +endpoint while retaining its fixed origin and UUID-only path restriction. + ## Batch 2: audited assignment editor and policy preparation Staff assignments can be recorded and revoked within the manager's scope. One diff --git a/website/integrations/managed-signatures.php b/website/integrations/managed-signatures.php new file mode 100644 index 00000000..850a74f1 --- /dev/null +++ b/website/integrations/managed-signatures.php @@ -0,0 +1,88 @@ +PDO::ERRMODE_EXCEPTION]);}return$p; +} +function dune_signature_account($id){ + if(!preg_match('/^[a-f0-9-]{36}$/i',$id))return null; + try{$q=dune_signature_db()->prepare('SELECT * FROM dune_signature_accounts WHERE website_id=?');$q->execute([$id]);return$q->fetch(PDO::FETCH_ASSOC)?:null;}catch(Throwable$e){return null;} +} +function dune_signature_preferences($id){ + $default=['closing'=>'With regards,','banner_url'=>''];try{$q=dune_signature_db()->prepare('SELECT closing,banner_url FROM dune_signature_preferences WHERE website_id=?');$q->execute([$id]);return$q->fetch(PDO::FETCH_ASSOC)?:$default;}catch(Throwable$e){return$default;} +} +function dune_signature_group($badges,$label,$fluid=false,$scale=1){ + if(!$badges)return ''; $cells='';$dimension=$fluid?'calc(var(--dune-seal-size,48px) * '.$scale.')':(48*$scale).'px'; + foreach($badges as[$url,$caption]){$caption=htmlspecialchars($caption,ENT_QUOTES);$cells.=''.$caption.'';} + return '
'.htmlspecialchars($label,ENT_QUOTES).'
'.$cells.'
'; +} +function dune_signature_staff_badges($account,$verifiedStats=null){ + $functions=json_decode(file_get_contents(__DIR__.'/organisation-seals.json'),true,512,JSON_THROW_ON_ERROR); + $personal=[];$teams=[];$names=['support'=>'Support','ban-appeals'=>'Ban appeals','forum-support'=>'Forum support','legal'=>'Legal','sales'=>'Sales','network-staff'=>'Network staff','dev'=>'Development']; + if(!empty($account['personal_path'])&&preg_match('~^/assets/seals/(?:(owner|corestaff|main-network-admin|network-staff|personal-staff|personal)-[a-z0-9_-]+|rank-network-staff)-150\.png$~',$account['personal_path'],$m)){$kind=!empty($m[1])?$m[1]:'rank';$host=in_array($kind,['main-network-admin','rank'],true)?'https://support.dunerealms.com':'https://www.dunerealms.com';$personal[]=[$host.$account['personal_path'],['personal'=>'Personal staff seal','personal-staff'=>'Staff','owner'=>'Owner','corestaff'=>'Corestaff','main-network-admin'=>'Main network administrator','rank'=>'Network Staff','network-staff'=>'Network Staff'][$kind]];} + $stats=func_num_args()>1?$verifiedStats:dune_staff_closures_for($account['website_id']); + foreach(array_unique(json_decode($account['departments_json']??'[]',true)?:[])as$key){ + if(isset($functions[$key])){$teams[]=['https://www.dunerealms.com/assets/seals/scope-'.$key.'-v1-150.png',$functions[$key]];continue;} + if(!isset($names[$key]))continue; + if($key==='network-staff'&&!is_file(__DIR__.'/osticket/assets/seals/department-network-staff-150.png'))continue; + $version=$key==='legal'&&is_file(__DIR__.'/osticket/assets/seals/department-legal-v2-150.png')?'-v2':''; + $host=($version||$key==='network-staff')?'https://support.dunerealms.com':'https://www.dunerealms.com'; + $relative='/assets/seals/department-'.$key.$version.'-150.png';$url=$host.$relative;$caption=$names[$key].' · Department'; + if(dune_department_personal_earned($stats,$key)){ + $earned=dune_personal_department_asset($account,$key,dune_department_art_source($relative)); + if($earned){$url=$earned;$caption=$names[$key].' · '.$account['username'].' · Personal department seal (25+ resolved)';} + } + $teams[]=[$url,$caption]; + } + // A department is represented once. Do not repeat a second generic team medal. + return[$personal,$teams]; +} +function dune_signature_extra_roles($id){ + try{$q=dune_signature_db()->prepare('SELECT seal_key FROM dune_signature_role_seals WHERE website_id=?');$q->execute([$id]);$badges=[];$known=['rank-game-mod'=>['rank-game-mod-150.png','Ingame Moderator'],'rank-game-admin'=>['rank-game-admin-150.png','Ingame Administrator'],'rank-dev'=>['rank-dev-150.png','Development'],'rank-streamer'=>['rank-streamer-150.png','Streamer · News Team'],'rank-crysknife'=>['order-crysknife-v1.png','Holy Order of The Crysknife']];foreach(dune_recognition_catalog()['roles']as$a)$known[$a['key']]=[$a['file'],$a['label']];foreach($q->fetchAll(PDO::FETCH_COLUMN)as$key)if(isset($known[$key])&&is_file(__DIR__.'/osticket/assets/seals/'.$known[$key][0]))$badges[]=['https://support.dunerealms.com/assets/seals/'.$known[$key][0],$known[$key][1]];return $badges;}catch(Throwable$e){return [];} +} + +function dune_signature_offices($id){ + try{$q=dune_signature_db()->prepare('SELECT roles_json,expires_at FROM drforum_dune_political_roles WHERE website_id=?');$q->execute([$id]);$row=$q->fetch(PDO::FETCH_ASSOC);if(!$row||(int)$row['expires_at']<=time())return[];$labels=['emperor'=>'Emperor','house_leader'=>'Faction leader','specerhuis'=>'Specerhuis','welvaart'=>'House of Water','guild_staff'=>'Vaerkring','landsraad'=>'Landsraad'];$out=[];foreach(json_decode($row['roles_json'],true)?:[]as$key)if(isset($labels[$key]))$out[]=['https://forums.dunerealms.com/assets/seals/office-'.$key.'.png',$labels[$key]];return$out;}catch(Throwable$e){return[];} +} +function dune_render_managed_signature($id,$context='forum'){ + $a=dune_signature_account($id);if(!$a)return '';$p=dune_signature_preferences($id);[$personal,$teams]=dune_signature_staff_badges($a);$roles=dune_signature_extra_roles($id);$recognition=[];$offices=$context==='forum'?dune_signature_offices($id):[]; + if(str_contains($a['personal_path']??'','/rank-')){$roles=array_merge($personal,$roles);$personal=[];} + $labels=array_merge(['alpha-tester'=>'Alpha Tester','beta-tester'=>'Beta Tester','launch-contributor'=>'Launch Contributor','dedicated-tester'=>'Dedicated Tester','season-tavren-ii'=>'Season · Tavren II Aedrecht','dunegit-owner'=>'DuneGit Repository Owner'],dune_recognition_labels()); + foreach(dune_signature_recognition_keys($id)as$key)if(is_file(__DIR__.'/osticket/assets/seals/'.$key.'.png'))$recognition[]=['https://support.dunerealms.com/assets/seals/'.$key.'.png',$labels[$key]]; + $count=max(1,count($personal)+count($teams)+count($roles)+count($recognition)+count($offices));$fluid=$context!=='email';$layout=$fluid?'display:block;width:100%;container-type:inline-size;--dune-seal-size:clamp(48px,calc((100cqw - 120px) / '.$count.'),96px);':'display:inline-block;'; + $html='
'.nl2br(htmlspecialchars($p['closing'],ENT_QUOTES)).'
'.htmlspecialchars($a['username'],ENT_QUOTES).'
'; + $staff=dune_signature_is_staff($id);$scale=$staff?0.9:1; + $groups=dune_signature_group($personal,'Personal',$fluid,$staff?1.1:1).dune_signature_group($roles,'Roles',$fluid,$scale).dune_signature_group($teams,'Functions & service',$fluid,$scale).dune_signature_group($offices,'Elected offices',$fluid,$scale).dune_signature_group($recognition,'Recognition',$fluid,$scale); + if($groups)$html.=''.$groups.'
'; + if($context==='forum'&&$p['banner_url']!=='')$html.='
Personal banner
Personal forum signature banner
'; + return $html.'
'; +} +function dune_signature_bbcode($id){ + $a=dune_signature_account($id);if(!$a)return'';$p=dune_signature_preferences($id);[$personal,$teams]=dune_signature_staff_badges($a); + $bb=str_replace(['[',']'],['[',']'],$p['closing'])."\n\n[b]".str_replace(['[',']'],['[',']'],$a['username'])."[/b]\n\n"; + foreach([['Personal seals',$personal],['Functions & service',$teams]]as[$label,$badges])if($badges){$bb.='[b]'.$label."[/b]\n";foreach($badges as[$url,$caption])$bb.='[img=48x48]'.$url.'[/img] ';$bb.="\n\n";} + foreach(dune_signature_recognition_keys($id)as$key)if(is_file(__DIR__.'/osticket/assets/seals/'.$key.'.png'))$bb.='[img=48x48]https://support.dunerealms.com/assets/seals/'.$key.'.png[/img] '; + if($p['banner_url']!=='')$bb.="\n\n[img]".$p['banner_url'].'[/img]';return trim($bb); +} +function dune_refresh_signature_records($id){ + $a=dune_signature_account($id);if(!$a)return;$p=dune_signature_db(); + $q=$p->prepare('UPDATE drforum_users u JOIN drforum_dune_accounts a ON a.uid=u.uid SET u.signature=? WHERE a.website_id=?');$q->execute([dune_signature_bbcode($id),$id]); + $q=$p->prepare("UPDATE drsupport_staff SET signature=?,default_signature_type='mine' WHERE username=? AND backend='dunerealms-staff'");$q->execute([dune_render_managed_signature($id,'email'),str_replace('-','',$id)]); +} +function dune_save_signature_preferences($id,$closing,$banner=null){ + if(!dune_signature_account($id))throw new Exception('Signature identity unavailable.'); + if(!is_string($closing)||(function_exists('mb_strlen')?mb_strlen($closing):strlen($closing))>160||preg_match('/[\x00-\x08\x0B\x0C\x0E-\x1F]/',$closing))throw new Exception('Use at most 160 characters for your closing.'); + $old=dune_signature_preferences($id);$banner=$banner===null?$old['banner_url']:trim($banner); + if(strlen($banner)>1024||($banner!==''&&(!filter_var($banner,FILTER_VALIDATE_URL)||strtolower(parse_url($banner,PHP_URL_SCHEME)??'')!=='https'||parse_url($banner,PHP_URL_USER)||parse_url($banner,PHP_URL_PASS))))throw new Exception('Use an HTTPS image URL for your banner.'); + $q=dune_signature_db()->prepare('INSERT INTO dune_signature_preferences(website_id,closing,banner_url) VALUES(?,?,?) ON DUPLICATE KEY UPDATE closing=VALUES(closing),banner_url=VALUES(banner_url)');$q->execute([$id,$closing,$banner]);dune_refresh_signature_records($id); +} +function dune_osticket_lock_signature_vars($staff,&$vars,&$errors,$save=false){ + $id=dune_native_central_id($staff,'dunerealms-staff');if(!$id)return; + if($save&&!$errors&&array_key_exists('dune_signature_closing',$vars))try{dune_save_signature_preferences($id,$vars['dune_signature_closing']);}catch(Throwable$e){$errors['signature']=$e->getMessage();} + $vars['signature']=dune_render_managed_signature($id,'email');$vars['default_signature_type']='mine'; +} +function dune_osticket_signature_preferences($staff){ + $id=dune_native_central_id($staff,'dunerealms-staff');if(!$id)return'';$p=dune_signature_preferences($id); + return '
Managed signature

Your identity and seals are managed automatically. You can change your closing line.

'.dune_render_managed_signature($id,'ticket'); +} diff --git a/website/integrations/organisation-seals.json b/website/integrations/organisation-seals.json new file mode 100644 index 00000000..b5332db5 --- /dev/null +++ b/website/integrations/organisation-seals.json @@ -0,0 +1,13 @@ +{ + "community_operations": "Community Operations", + "dunerealms_operations": "DuneRealms Operations", + "customer_support": "Customer Support", + "sales_accounts": "Sales & Account Services", + "content_creative": "Content & Creative", + "news_media": "News & Media", + "trust_safety": "Trust & Safety", + "it_operations": "IT Operations", + "engineering": "Engineering", + "people_operations": "People Operations", + "legal_compliance": "Legal & Compliance" +} diff --git a/website/integrations/sync-public-profile.php b/website/integrations/sync-public-profile.php new file mode 100644 index 00000000..1ebad383 --- /dev/null +++ b/website/integrations/sync-public-profile.php @@ -0,0 +1,23 @@ +65536)throw new Exception('Profile snapshot too large');$a=json_decode($raw,true); +if(!is_array($a)||!preg_match('/^[a-f0-9-]{36}$/i',$a['id']??'')||!is_string($a['username']??null)||strlen($a['username'])>64||!is_array($a['publicProfile']??null))throw new Exception('Verified public profile required'); +$profile=$a['publicProfile'];$bio=(string)($profile['bio']??'');$info=(string)($profile['publicInfo']??'');if(strlen($bio)>4000||strlen($info)>2000)throw new Exception('Public profile text too long'); +$domains=['website'=>[],'discord'=>['discord.com','discord.gg'],'youtube'=>['youtube.com','youtu.be'],'twitch'=>['twitch.tv'],'twitter'=>['twitter.com','x.com'],'facebook'=>['facebook.com','fb.com'],'github'=>['github.com'],'instagram'=>['instagram.com'],'tiktok'=>['tiktok.com']];$socials=[]; +foreach($domains as$key=>$hosts){$value=$profile['socials'][$key]??'';if($value==='')continue;if(!is_string($value)||strlen($value)>500||!filter_var($value,FILTER_VALIDATE_URL))throw new Exception('Invalid public social URL');$u=parse_url($value);$host=strtolower($u['host']??'');if(($u['scheme']??'')!=='https'||isset($u['user'])||isset($u['pass'])||(isset($u['port'])&&$u['port']!==443)||($hosts&&!array_filter($hosts,fn($d)=>$host===$d||str_ends_with($host,'.'.$d))))throw new Exception('Wrong social provider URL');$socials[$key]=$value;} +$avatar=['url'=>'https://cp.dunerealms.com/api/avatars/fallback','mode'=>'image'];$candidate=$profile['avatar']??[]; +if(is_array($candidate)&&is_string($candidate['url']??null)&&preg_match('~^https://cp\.dunerealms\.com/api/avatars/(?:fallback|(?:site|minecraft|face)/[a-f0-9-]{36})$~i',$candidate['url']))$avatar=['url'=>$candidate['url'],'mode'=>($candidate['mode']??'')==='skin'?'skin':'image']; +$git=null;$g=$profile['git']??null; +if(is_array($g)&&is_string($g['login']??null)&&preg_match('/^[A-Za-z0-9_.-]{1,100}$/',$g['login'])&&in_array($g['profileUrl']??'', ['https://www.dunerealms.com/git/'.rawurlencode($g['login']),'https://dunerealms.com/git/'.rawurlencode($g['login'])],true)){ + $count=max(0,(int)($g['ownedRepoCount']??0));$git=['login'=>$g['login'],'profileUrl'=>$g['profileUrl'],'ownedRepoCount'=>$count,'repositoryOwner'=>$count>0];$socials['dunehub']=$git['profileUrl']; +} +$c=json_decode(file_get_contents('/home/dunerealms/.config/integrations.json'),true);$p=new PDO('mysql:host='.$c['host'].';dbname='.$c['database'].';charset=utf8mb4',$c['username'],$c['password'],[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]); +$p->exec('CREATE TABLE IF NOT EXISTS dune_public_profiles(website_id VARCHAR(36) PRIMARY KEY,username VARCHAR(64) NOT NULL,display_name VARCHAR(80) NOT NULL,bio TEXT NOT NULL,public_info TEXT NOT NULL,socials_json TEXT NOT NULL,avatar_json TEXT NOT NULL,updated_at DATETIME NOT NULL) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_public_git(website_id VARCHAR(36) PRIMARY KEY,git_json TEXT NOT NULL) ENGINE=InnoDB'); +$p->beginTransaction();try{ + $q=$p->prepare('INSERT INTO dune_public_git(website_id,git_json) VALUES(?,?) ON DUPLICATE KEY UPDATE git_json=VALUES(git_json)');$q->execute([$a['id'],json_encode($git)]); + $q=$p->prepare('INSERT INTO dune_public_profiles(website_id,username,display_name,bio,public_info,socials_json,avatar_json,updated_at) VALUES(?,?,?,?,?,?,?,NOW()) ON DUPLICATE KEY UPDATE username=VALUES(username),display_name=VALUES(display_name),bio=VALUES(bio),public_info=VALUES(public_info),socials_json=VALUES(socials_json),avatar_json=VALUES(avatar_json),updated_at=NOW()');$q->execute([$a['id'],$a['username'],(function_exists('mb_substr')?mb_substr((string)($a['displayName']??$a['username']),0,80):substr((string)($a['displayName']??$a['username']),0,80)),$bio,$info,json_encode($socials),json_encode($avatar)]); + $q=$p->prepare('UPDATE drforum_users u JOIN drforum_dune_accounts a ON a.uid=u.uid SET u.website=? WHERE a.website_id=?');$q->execute([$socials['website']??'',$a['id']]); + if($avatar['mode']==='image'){$q=$p->prepare("UPDATE drforum_users u JOIN drforum_dune_accounts a ON a.uid=u.uid SET u.avatar=?,u.avatardimensions='64|64',u.avatartype='remote' WHERE a.website_id=?");$q->execute([$avatar['url'],$a['id']]);} + $p->commit();echo "Verified public profile mirrored.\n"; +}catch(Throwable$e){$p->rollBack();throw$e;} diff --git a/website/integrations/sync-staff-seals.php b/website/integrations/sync-staff-seals.php new file mode 100644 index 00000000..5fe61d39 --- /dev/null +++ b/website/integrations/sync-staff-seals.php @@ -0,0 +1,67 @@ +PDO::ERRMODE_EXCEPTION]); +$p->exec('CREATE TABLE IF NOT EXISTS drforum_dune_staff_seal_accounts(website_id VARCHAR(36) PRIMARY KEY,bbcode TEXT NOT NULL) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS drforum_dune_staff_seal_fragments(uid INT PRIMARY KEY,fragment TEXT NOT NULL) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_native_seal_fragments(target VARCHAR(24) NOT NULL,target_id INT NOT NULL,fragment TEXT NOT NULL,PRIMARY KEY(target,target_id)) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_community_badges(website_id VARCHAR(36) NOT NULL,badge_key VARCHAR(40) NOT NULL,username VARCHAR(64) NOT NULL,PRIMARY KEY(website_id,badge_key)) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_signature_accounts(website_id VARCHAR(36) PRIMARY KEY,username VARCHAR(64) NOT NULL,personal_path VARCHAR(180) NULL,departments_json TEXT NOT NULL,teams_json TEXT NOT NULL) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_signature_preferences(website_id VARCHAR(36) PRIMARY KEY,closing VARCHAR(640) NOT NULL,banner_url VARCHAR(1024) NOT NULL) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_signature_role_seals(website_id VARCHAR(36) NOT NULL,seal_key VARCHAR(40) NOT NULL,PRIMARY KEY(website_id,seal_key)) ENGINE=InnoDB'); +$p->exec('CREATE TABLE IF NOT EXISTS dune_signature_rank_labels(website_id VARCHAR(36) PRIMARY KEY,rank_label VARCHAR(500) NOT NULL) ENGINE=InnoDB'); +function dune_update_native_signature($p,$target,$id,$fragment){ + $tables=['agent'=>'drsupport_staff','department'=>'drsupport_department'];if(!isset($tables[$target]))throw new Exception('Invalid signature target'); + $table=$tables[$target];$key=$target==='agent'?'staff_id':'id'; + $q=$p->prepare("SELECT signature FROM $table WHERE $key=? FOR UPDATE");$q->execute([$id]);$user=$q->fetch(PDO::FETCH_ASSOC);if(!$user)return; + $q=$p->prepare('SELECT fragment FROM dune_native_seal_fragments WHERE target=? AND target_id=?');$q->execute([$target,$id]);$previous=$q->fetchColumn(); + $base=$previous?str_replace($previous,'',$user['signature']??''):($user['signature']??'');$signature=rtrim($base).$fragment; + if($signature!==$user['signature']){$q=$p->prepare("UPDATE $table SET signature=? WHERE $key=?");$q->execute([$signature,$id]);} + if($target==='agent'&&$fragment!==''){$q=$p->prepare("UPDATE drsupport_staff SET default_signature_type='mine' WHERE staff_id=? AND default_signature_type='none'");$q->execute([$id]);} + $q=$p->prepare('INSERT INTO dune_native_seal_fragments(target,target_id,fragment) VALUES(?,?,?) ON DUPLICATE KEY UPDATE fragment=VALUES(fragment)');$q->execute([$target,$id,$fragment]); +} +function dune_seal_table($badges){ + $cells='';$position=0;foreach($badges as[$path,$label]){$position++;$url=((str_starts_with($path,'/assets/seals/team-')||str_starts_with($path,'/assets/seals/department-legal-v2')||str_starts_with($path,'/assets/seals/department-network-staff'))?'https://support.dunerealms.com':'https://www.dunerealms.com').$path; + $cells.=''.htmlspecialchars($label,ENT_QUOTES).'
'.htmlspecialchars($label,ENT_QUOTES).'
'; + }return '
'.$cells.'
'; +} +function dune_department_seal_path($slug){global $functionSeals;if(isset($functionSeals[$slug]))return '/assets/seals/scope-'.$slug.'-v1-150.png';return '/assets/seals/department-'.$slug.($slug==='legal'&&is_file('/home/dunerealms/apps/integrations/osticket/assets/seals/department-legal-v2-150.png')?'-v2':'').'-150.png';} +function dune_seal_html($path,$label){return dune_seal_table([[$path,$label]]);} +$p->beginTransaction();try{ + foreach($accounts as$a){ + if(!preg_match('/^[a-f0-9-]{36}$/i',$a['id']??''))throw new Exception('Invalid central identity'); + if(isset($a['rankLabel'])){$q=$p->prepare('INSERT INTO dune_signature_rank_labels(website_id,rank_label) VALUES(?,?) ON DUPLICATE KEY UPDATE rank_label=VALUES(rank_label)');$q->execute([$a['id'],(function_exists('mb_substr')?mb_substr((string)$a['rankLabel'],0,500):substr((string)$a['rankLabel'],0,500))]);} + if(isset($a['roleSeals'])){if(!is_array($a['roleSeals'])||array_diff($a['roleSeals'],array_merge(['rank-streamer','rank-crysknife','rank-dev','rank-game-mod','rank-game-admin'],array_column(dune_recognition_catalog()['roles'],'key'))))throw new Exception('Invalid assigned role seal');$q=$p->prepare('DELETE FROM dune_signature_role_seals WHERE website_id=?');$q->execute([$a['id']]);$q=$p->prepare('INSERT INTO dune_signature_role_seals(website_id,seal_key) VALUES(?,?)');foreach(array_unique($a['roleSeals'])as$key)$q->execute([$a['id'],$key]);} + if(isset($a['forumGroup'])){if(!in_array($a['forumGroup'],[2,4,6],true))throw new Exception('Invalid native forum group');$q=$p->prepare('UPDATE drforum_users u JOIN drforum_dune_accounts a ON a.uid=u.uid SET u.usergroup=? WHERE a.website_id=?');$q->execute([$a['forumGroup'],$a['id']]);} + if(array_key_exists('communityBadges',$a)){ + if(!is_array($a['communityBadges'])||array_diff($a['communityBadges'],array_merge(['alpha-tester','beta-tester','launch-contributor','dedicated-tester','season-tavren-ii','dunegit-owner'],dune_recognition_keys())))throw new Exception('Invalid verified badge snapshot'); + $q=$p->prepare('DELETE FROM dune_community_badges WHERE website_id=?');$q->execute([$a['id']]); + $q=$p->prepare('INSERT INTO dune_community_badges(website_id,badge_key,username) VALUES(?,?,?)');foreach(array_unique($a['communityBadges'])as$key)$q->execute([$a['id'],$key,$a['username']??'']); + } + $personal=$a['personal']??null;if($personal&&!preg_match('~^/assets/seals/(?:(?:owner|corestaff|main-network-admin|network-staff|personal-staff|personal)-[a-z0-9_-]+|rank-network-staff)-150\.png$~',$personal))throw new Exception('Invalid personal seal'); + $departments=$a['departments']??array_filter([$a['department']??null]);if(!is_array($departments)||count($departments)>18)throw new Exception('Invalid departments'); + foreach($departments as$department)if(!in_array($department,array_merge(['support','ban-appeals','forum-support','legal','sales','network-staff','dev'],array_keys($functionSeals)),true))throw new Exception('Invalid department'); + $paths=array_filter(array_merge([$personal],array_map(fn($department)=>dune_department_seal_path($department),array_unique($departments)))); + $teams=$a['teams']??$departments;if(!is_array($teams)||count($teams)>7)throw new Exception('Invalid teams'); + foreach($teams as$team)if(!in_array($team,['support','ban-appeals','forum-support','legal','sales','network-staff','dev'],true))throw new Exception('Invalid team'); + $closureRows=$p->query(file_get_contents(__DIR__.'/staff-closure-counts.sql'))->fetchAll(PDO::FETCH_ASSOC);$earnedTeams=[];$departmentKeys=['Support'=>'support','Ban appeals'=>'ban-appeals','Forum support'=>'forum-support','Legal'=>'legal','Sales'=>'sales','Network staff'=>'network-staff','Dev team'=>'dev'];foreach($closureRows as$row)if($row['website_id']===$a['id']&&(int)$row['closed_count']>=25&&isset($departmentKeys[$row['department_name']]))$earnedTeams[]=$departmentKeys[$row['department_name']];$teams=array_values(array_intersect($teams,$earnedTeams)); + $teamPaths=[];foreach(array_unique($teams)as$team){$path='/assets/seals/team-'.$team.'.png';if(is_file('/home/dunerealms/apps/integrations/osticket'.$path))$teamPaths[]=$path;} + $username=(string)($a['username']??'DuneRealms staff'); + $q=$p->prepare('INSERT INTO dune_signature_accounts(website_id,username,personal_path,departments_json,teams_json) VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE username=VALUES(username),personal_path=VALUES(personal_path),departments_json=VALUES(departments_json),teams_json=VALUES(teams_json)');$q->execute([$a['id'],$username,$personal,json_encode(array_values($departments)),json_encode(array_values($teams))]); + $allPaths=array_merge($paths,$teamPaths); + $bb=$allPaths?'With regards,'."\n[b]".str_replace(['[',']'],['[',']'],$username).'[/b]' ."\n\n".implode(' ',array_map(fn($path)=>'[img=71x71]'.((str_starts_with($path,'/assets/seals/team-')||str_starts_with($path,'/assets/seals/department-legal-v2')||str_starts_with($path,'/assets/seals/department-network-staff'))?'https://support.dunerealms.com':'https://www.dunerealms.com').$path.'[/img]',$allPaths)):''; + $q=$p->prepare('INSERT INTO drforum_dune_staff_seal_accounts(website_id,bbcode) VALUES(?,?) ON DUPLICATE KEY UPDATE bbcode=VALUES(bbcode)');$q->execute([$a['id'],$bb]); + $q=$p->prepare('SELECT staff_id FROM drsupport_staff WHERE username=? AND backend=?');$q->execute([str_replace('-','',$a['id']),'dunerealms-staff']);$staffId=$q->fetchColumn(); + if($staffId){$badges=[];foreach($allPaths as$path){$file=basename($path,'.png');$label=str_starts_with($file,'owner-')?'Owner':(str_starts_with($file,'corestaff-')?'Corestaff':ucwords(str_replace('-',' ',preg_replace('/(?:-v2)?-150$/','',$file))));$badges[]=[$path,$label];} + $html=$badges?'

With regards,

'.htmlspecialchars($username,ENT_QUOTES).'

'.dune_seal_table($badges):'';dune_update_native_signature($p,'agent',(int)$staffId,$html?"\n".$html:'');} + } + foreach(['Support'=>'support','Ban appeals'=>'ban-appeals','Forum support'=>'forum-support','Legal'=>'legal','Sales'=>'sales','Network staff'=>'network-staff','Dev team'=>'dev']as$name=>$slug){$q=$p->prepare('SELECT id FROM drsupport_department WHERE name=?');$q->execute([$name]);if($id=$q->fetchColumn())dune_update_native_signature($p,'department',(int)$id,"\n".dune_seal_html(dune_department_seal_path($slug),$name));} + $p->commit(); +}catch(Throwable$e){$p->rollBack();throw$e;} +$_SERVER['SCRIPT_NAME']='/dune-sso.php';$_SERVER['REQUEST_METHOD']='GET';$_SERVER['REMOTE_ADDR']='127.0.0.1';$_SERVER['HTTP_HOST']='forums.dunerealms.com';define('IN_MYBB',1);chdir('/home/dunerealms/apps/integrations/mybb');require 'global.php';require_once './staff-seal-signatures.php'; +$rows=$db->simple_select('dune_accounts','website_id,uid');while($row=$db->fetch_array($rows))dune_apply_staff_seal((int)$row['uid'],$row['website_id']); +if(is_file('/home/dunerealms/apps/integrations/managed-signatures.php')){require_once '/home/dunerealms/apps/integrations/managed-signatures.php';foreach($accounts as$a)dune_refresh_signature_records($a['id']);} +echo "Staff and department seal signatures reconciled.\n"; diff --git a/website/node/member-profiles.mjs b/website/node/member-profiles.mjs index 36f8267f..988c770e 100644 --- a/website/node/member-profiles.mjs +++ b/website/node/member-profiles.mjs @@ -1,52 +1,54 @@ -import {gameStaffSeals,protectedStaffRanks} from './game-staff-seals.mjs'; -import {AWARD_LABELS,AWARD_FILES} from './recognition.mjs'; +import {gameStaffSeals,protectedStaffRanks} from './game-staff-seals.mjs'; +import {AWARD_LABELS,AWARD_FILES} from './recognition.mjs'; import {politicalSeals} from './political-heraldry.mjs'; -import{readFileSync,existsSync}from'node:fs'; -import{createHash}from'node:crypto'; -import{identity}from'./auth.mjs'; -import{accessFor,rankFor}from'./permissions.mjs'; -import{publicProfileFor}from'./profile.mjs'; +import{readFileSync,existsSync}from'node:fs'; +import{createHash}from'node:crypto'; +import{identity}from'./auth.mjs'; +import{accessFor,rankFor}from'./permissions.mjs'; +import{publicProfileFor}from'./profile.mjs'; 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/'; -const json=(data,status=200)=>Response.json(data,{status,headers:{'Cache-Control':'private, no-store','Vary':'Origin','Access-Control-Allow-Origin':origin,'Access-Control-Allow-Credentials':'true','Access-Control-Allow-Methods':'GET, OPTIONS','Access-Control-Allow-Headers':'Content-Type'}}); -const missing=e=>/no such table|doesn't exist|unknown column|no such column/i.test(e.message||''); -async function optional(fn,fallback){try{return await fn();}catch(e){if(missing(e))return fallback;throw e;}} -const departments={'support':'Support','ban-appeals':'Ban appeals','forum-support':'Forum support','legal':'Legal','sales':'Sales','network-staff':'Network staff','dev':'Development'}; -const badgeLabels={'alpha-tester':'Alpha Tester','beta-tester':'Beta Tester','launch-contributor':'Launch Contributor','dedicated-tester':'Dedicated Tester','season-tavren-ii':'The Quest for Tavren II Aedrecht','dunegit-owner':'DuneGit Repository Owner'}; -export function earnedMemberSeal(request){ - const path=new URL(request.url).pathname,match=path.match(/^\/assets\/seals\/earned\/(personal-department-(?:support|ban-appeals|forum-support|legal|sales|network-staff|dev)-[a-f0-9]{20}\.png)$/);if(!match)return null; - if(!['GET','HEAD'].includes(request.method))return new Response('Method rejected',{status:405}); - const file='/home/dunerealms/apps/integrations/osticket/assets/seals/earned/'+match[1];if(!existsSync(file))return new Response('Seal not found',{status:404}); - return new Response(request.method==='HEAD'?null:readFileSync(file),{headers:{'Content-Type':'image/png','Cache-Control':'public,max-age=3600','X-Content-Type-Options':'nosniff'}}); -} -const testerBadges=new Set(['alpha-tester','beta-tester','launch-contributor','dedicated-tester']); -export async function publicForumFor(db,id){ - const row=await optional(()=>db.prepare('SELECT u.uid,u.username,u.usertitle,u.postnum,u.threadnum,u.regdate,u.lastvisit,u.invisible,u.reputation,u.timeonline FROM drforum_dune_accounts a JOIN drforum_users u ON u.uid=a.uid WHERE a.website_id=?').bind(id).first(),undefined); - if(row===undefined)return{status:'unavailable'};if(!row)return{status:'not-linked'}; - const count=x=>Math.max(0,Math.floor(Number(x)||0)); - return{status:'linked',username:String(row.username),title:String(row.usertitle||''),posts:count(row.postnum),threads:count(row.threadnum),reputation:Math.trunc(Number(row.reputation)||0),joinedAt:count(row.regdate)*1000,lastVisit:row.invisible?null:count(row.lastvisit)*1000,timeOnlineSeconds:row.invisible?null:count(row.timeonline),url:'https://forums.dunerealms.com/member.php?action=profile&uid='+count(row.uid)}; -} -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.id===OFFICIAL_ACCOUNT.id&&target.username===OFFICIAL_ACCOUNT.username; +import {isShowcaseSeal} from './seal-entitlements.mjs'; +import {EXECUTIVE_TITLES} from './organisation-appointments.mjs'; +import {OFFICIAL_ACCOUNT} from './official-account.mjs'; +import {organisationFunctionSeals} from './organisation-seals.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/'; +const json=(data,status=200)=>Response.json(data,{status,headers:{'Cache-Control':'private, no-store','Vary':'Origin','Access-Control-Allow-Origin':origin,'Access-Control-Allow-Credentials':'true','Access-Control-Allow-Methods':'GET, OPTIONS','Access-Control-Allow-Headers':'Content-Type'}}); +const missing=e=>/no such table|doesn't exist|unknown column|no such column/i.test(e.message||''); +async function optional(fn,fallback){try{return await fn();}catch(e){if(missing(e))return fallback;throw e;}} +const departments={'support':'Support','ban-appeals':'Ban appeals','forum-support':'Forum support','legal':'Legal','sales':'Sales','network-staff':'Network staff','dev':'Development'}; +const badgeLabels={'alpha-tester':'Alpha Tester','beta-tester':'Beta Tester','launch-contributor':'Launch Contributor','dedicated-tester':'Dedicated Tester','season-tavren-ii':'The Quest for Tavren II Aedrecht','dunegit-owner':'DuneGit Repository Owner'}; +export function earnedMemberSeal(request){ + const path=new URL(request.url).pathname,match=path.match(/^\/assets\/seals\/earned\/(personal-department-(?:support|ban-appeals|forum-support|legal|sales|network-staff|dev)-[a-f0-9]{20}\.png)$/);if(!match)return null; + if(!['GET','HEAD'].includes(request.method))return new Response('Method rejected',{status:405}); + const file='/home/dunerealms/apps/integrations/osticket/assets/seals/earned/'+match[1];if(!existsSync(file))return new Response('Seal not found',{status:404}); + return new Response(request.method==='HEAD'?null:readFileSync(file),{headers:{'Content-Type':'image/png','Cache-Control':'public,max-age=3600','X-Content-Type-Options':'nosniff'}}); +} +const testerBadges=new Set(['alpha-tester','beta-tester','launch-contributor','dedicated-tester']); +export async function publicForumFor(db,id){ + const row=await optional(()=>db.prepare('SELECT u.uid,u.username,u.usertitle,u.postnum,u.threadnum,u.regdate,u.lastvisit,u.invisible,u.reputation,u.timeonline FROM drforum_dune_accounts a JOIN drforum_users u ON u.uid=a.uid WHERE a.website_id=?').bind(id).first(),undefined); + if(row===undefined)return{status:'unavailable'};if(!row)return{status:'not-linked'}; + const count=x=>Math.max(0,Math.floor(Number(x)||0)); + return{status:'linked',username:String(row.username),title:String(row.usertitle||''),posts:count(row.postnum),threads:count(row.threadnum),reputation:Math.trunc(Number(row.reputation)||0),joinedAt:count(row.regdate)*1000,lastVisit:row.invisible?null:count(row.lastvisit)*1000,timeOnlineSeconds:row.invisible?null:count(row.timeonline),url:'https://forums.dunerealms.com/member.php?action=profile&uid='+count(row.uid)}; +} +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.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)=>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?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';}} - add('department-'+key,label,url,'Departments'); - } - if(access.ranks.includes('web_streamer')||protectedStaffRanks(access.ranks))add('rank-streamer','Streamer · News Team',base+'rank-streamer-150.png','Roles'); + 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?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 seal of organisationFunctionSeals(access.organisation?.assignments))add(seal.key,seal.label,base+seal.file,'Current functions'); + 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';}} + if(!access.organisation||departmentAwardEarned(stats,key))add('department-'+key,label,url,access.organisation?'Earned service awards':'Departments'); + } + if(access.ranks.includes('web_streamer')||protectedStaffRanks(access.ranks))add('rank-streamer','Streamer · News Team',base+'rank-streamer-150.png','Roles'); for(const key of showcase?BADGES:await badgesFor(db,target.id))if(BADGES.includes(key))add(key,AWARD_LABELS[key]||badgeLabels[key],base+(AWARD_FILES[key]||key+'-150.png'),AWARD_LABELS[key]?'Awards':'Community'); // New entitlements supplement legacy awards; existing awards remain visible during migration. const earned=await optional(()=>activeSealEntitlements(db,target.id),[]); @@ -56,24 +58,24 @@ export async function memberProfileData(db,target,settings={}){ const asset=manifest[key]; 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'); - 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 [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'); + 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 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 clan=await optional(()=>db.prepare('SELECT 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{showcase,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',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); - if(request.method==='OPTIONS')return new Response(null,{status:204,headers:json({}).headers});if(request.method!=='GET')return json({message:'Read-only profile.'},405); - const actor=await identity(request,db);if(!actor)return json({message:'Sign in with your DuneRealms account to view this profile.'},401); - const match=new URL(request.url).pathname.match(/^\/api\/people\/([a-z0-9_]{3,32})$/);if(!match)return json({message:'Profile not found.'},404); - const target=await db.prepare("SELECT id,username,display_name,role,created_at FROM site_accounts WHERE username=? AND password_hash NOT LIKE '!%' AND role<>'memorial'").bind(match[1]).first();if(!target)return json({message:'Profile not found.'},404); - return json({profile:await memberProfileData(db,target,settings)}); -};} + 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 clan=await optional(()=>db.prepare('SELECT 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{showcase,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',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); + if(request.method==='OPTIONS')return new Response(null,{status:204,headers:json({}).headers});if(request.method!=='GET')return json({message:'Read-only profile.'},405); + const actor=await identity(request,db);if(!actor)return json({message:'Sign in with your DuneRealms account to view this profile.'},401); + const match=new URL(request.url).pathname.match(/^\/api\/people\/([a-z0-9_]{3,32})$/);if(!match)return json({message:'Profile not found.'},404); + const target=await db.prepare("SELECT id,username,display_name,role,created_at FROM site_accounts WHERE username=? AND password_hash NOT LIKE '!%' AND role<>'memorial'").bind(match[1]).first();if(!target)return json({message:'Profile not found.'},404); + return json({profile:await memberProfileData(db,target,settings)}); +};} diff --git a/website/node/native-seals.mjs b/website/node/native-seals.mjs index 96d4b9cc..78069e9b 100644 --- a/website/node/native-seals.mjs +++ b/website/node/native-seals.mjs @@ -1,35 +1,37 @@ import {protectedStaffRanks,managedRoleSeals,currentStaffRanks} from './game-staff-seals.mjs'; import {OFFICIAL_ACCOUNT} from './official-account.mjs'; +import {organisationPersonalSeal,organisationFunctionSeals} from './organisation-seals.mjs'; import{staffClosureStats,statsForAccount,departmentAwardEarned}from './staff-closure-stats.mjs'; -import{spawn}from 'node:child_process'; -import{existsSync,readFileSync}from 'node:fs'; -import{accessFor}from './permissions.mjs'; -import{badgesFor,BADGES,communityBadgeVisible}from './community-badges.mjs'; -export function visibleCommunityBadges(keys,ranks){return keys.filter(key=>BADGES.includes(key)&&ranks.length>0&&communityBadgeVisible(key,ranks));} -export function staffSealFor(account,manifest){ +import{spawn}from 'node:child_process'; +import{existsSync,readFileSync}from 'node:fs'; +import{accessFor}from './permissions.mjs'; +import{badgesFor,BADGES,communityBadgeVisible}from './community-badges.mjs'; +export function visibleCommunityBadges(keys,ranks){return keys.filter(key=>BADGES.includes(key)&&ranks.length>0&&communityBadgeVisible(key,ranks));} +export function staffSealFor(account,manifest){ if(account.id===OFFICIAL_ACCOUNT.id)return null; // Official showcase identity never uses a personal seal. - const ranks=Array.isArray(account.ranks)?account.ranks:[account.role]; + const ranks=Array.isArray(account.ranks)?account.ranks:[account.role]; + const current=organisationPersonalSeal(account.username,ranks);if(current)return current; const role=(ranks.includes('owners')||ranks.includes('org_owner_ceo'))?'OWNER':ranks.includes('web_net_admin')?'MAINNETWORKADMIN':ranks.includes('corestaff')?'CORESTAFF':(ranks.includes('network_admin')||ranks.includes('network_admin'))?'NETWORKSTAFF':''; const named=kind=>Object.values(manifest).find(asset=>asset.role===kind&&asset.label?.toLowerCase()===account.username.toLowerCase())?.footer150||null; if(role&&named(role))return named(role); if(protectedStaffRanks(ranks)&&named('OWNER'))return named('OWNER'); if(currentStaffRanks(ranks)&&named('STAFF'))return named('STAFF'); return role==='NETWORKSTAFF'?manifest['rank-network-staff']?.footer150||null:null; -} -export function departmentFor(nodes){ - if(!nodes.includes('web.tickets.staff'))return null; - return [['web.tickets.support','support'],['web.tickets.appeals','ban-appeals'],['web.forum.moderate','forum-support'],['web.tickets.legal','legal'],['web.tickets.sales','sales'],['web.tickets.network','network-staff'],['web.tickets.dev','dev']].find(([node])=>nodes.includes(node))?.[1]||null; -} -export function departmentsFor(nodes,ranks=[],username=''){ - if(ranks.includes('corestaff')&&!protectedStaffRanks(ranks))return[...new Set([departmentFor(nodes),nodes.includes('web.tickets.dev')?'dev':null].filter(Boolean))]; - if(!nodes.includes('web.tickets.staff'))return[]; - return [['web.tickets.support','support'],['web.tickets.appeals','ban-appeals'],['web.forum.moderate','forum-support'],['web.tickets.legal','legal'],['web.tickets.sales','sales'],['web.tickets.network','network-staff'],['web.tickets.dev','dev']].filter(([node])=>nodes.includes(node)).map(([,department])=>department); -} -export async function syncNativeSeals(db,{sealsOnly=false}={}){ - const script='/home/dunerealms/apps/integrations/sync-staff-seals.php',manifestFile='/home/dunerealms/apps/integrations/seal-manifest.json'; - if(!existsSync(script)||!existsSync(manifestFile))return; +} +export function departmentFor(nodes){ + if(!nodes.includes('web.tickets.staff'))return null; + return [['web.tickets.support','support'],['web.tickets.appeals','ban-appeals'],['web.forum.moderate','forum-support'],['web.tickets.legal','legal'],['web.tickets.sales','sales'],['web.tickets.network','network-staff'],['web.tickets.dev','dev']].find(([node])=>nodes.includes(node))?.[1]||null; +} +export function departmentsFor(nodes,ranks=[],username=''){ + if(ranks.includes('corestaff')&&!protectedStaffRanks(ranks))return[...new Set([departmentFor(nodes),nodes.includes('web.tickets.dev')?'dev':null].filter(Boolean))]; + if(!nodes.includes('web.tickets.staff'))return[]; + return [['web.tickets.support','support'],['web.tickets.appeals','ban-appeals'],['web.forum.moderate','forum-support'],['web.tickets.legal','legal'],['web.tickets.sales','sales'],['web.tickets.network','network-staff'],['web.tickets.dev','dev']].filter(([node])=>nodes.includes(node)).map(([,department])=>department); +} +export async function syncNativeSeals(db,{sealsOnly=false}={}){ + const script='/home/dunerealms/apps/integrations/sync-staff-seals.php',manifestFile='/home/dunerealms/apps/integrations/seal-manifest.json'; + if(!existsSync(script)||!existsSync(manifestFile))return; const closureStats=await staffClosureStats(db); - const manifest=JSON.parse(readFileSync(manifestFile,'utf8')),{results}=await db.prepare('SELECT id,username,role FROM site_accounts').all(),accounts=[]; - for(const user of results){const access=await accessFor(db,user),ranks=access.ranks||[user.role],departments=departmentsFor(access.nodes,ranks,user.username),communityBadges=visibleCommunityBadges(await badgesFor(db,user.id),ranks),forumGroup=access.nodes.includes('web.forum.admin')?4:access.nodes.includes('web.forum.moderate')?6:2,roleSeals=managedRoleSeals(ranks);accounts.push({id:user.id,username:user.username,rankLabel:access.label,personal:staffSealFor({...user,ranks},manifest),departments,teams:departments.filter(key=>departmentAwardEarned(statsForAccount(closureStats,user.id),key)),communityBadges,...(sealsOnly?{}:{forumGroup}),roleSeals});} - await new Promise((resolve,reject)=>{const p=spawn('/usr/bin/php',[script],{stdio:['pipe','ignore','ignore']});const timer=setTimeout(()=>{p.kill();reject(Error('Native seal synchronization timed out'));},20000);p.once('error',error=>{clearTimeout(timer);reject(error);});p.once('exit',code=>{clearTimeout(timer);code===0?resolve():reject(Error('Native seal synchronization failed'));});p.stdin.on('error',()=>{});p.stdin.end(JSON.stringify(accounts));}); -} + const manifest=JSON.parse(readFileSync(manifestFile,'utf8')),{results}=await db.prepare('SELECT id,username,role FROM site_accounts').all(),accounts=[]; + for(const user of results){const access=await accessFor(db,user),ranks=access.ranks||[user.role],departments=departmentsFor(access.nodes,ranks,user.username),communityBadges=visibleCommunityBadges(await badgesFor(db,user.id),ranks),forumGroup=access.nodes.includes('web.forum.admin')?4:access.nodes.includes('web.forum.moderate')?6:2,roleSeals=managedRoleSeals(ranks);accounts.push({id:user.id,username:user.username,rankLabel:access.label,personal:staffSealFor({...user,ranks},manifest),departments:access.organisation?[...organisationFunctionSeals(access.organisation.assignments).map(s=>s.key.slice(9)),...departments.filter(key=>departmentAwardEarned(statsForAccount(closureStats,user.id),key))]:departments,teams:departments.filter(key=>departmentAwardEarned(statsForAccount(closureStats,user.id),key)),communityBadges,...(sealsOnly?{}:{forumGroup}),roleSeals});} + await new Promise((resolve,reject)=>{const p=spawn('/usr/bin/php',[script],{stdio:['pipe','ignore','ignore']});const timer=setTimeout(()=>{p.kill();reject(Error('Native seal synchronization timed out'));},20000);p.once('error',error=>{clearTimeout(timer);reject(error);});p.once('exit',code=>{clearTimeout(timer);code===0?resolve():reject(Error('Native seal synchronization failed'));});p.stdin.on('error',()=>{});p.stdin.end(JSON.stringify(accounts));}); +} diff --git a/website/node/organisation-public-roster.mjs b/website/node/organisation-public-roster.mjs index 352dab3e..3e0233ad 100644 --- a/website/node/organisation-public-roster.mjs +++ b/website/node/organisation-public-roster.mjs @@ -1,6 +1,10 @@ import {ORGANISATION,assignmentLabel,validStaffRole} from './organisation-model.mjs'; import {EXECUTIVE_TITLES} from './organisation-appointments.mjs'; import {OFFICIAL_ACCOUNT} from './official-account.mjs'; +import {organisationPersonalSeal,organisationFunctionSeals} from './organisation-seals.mjs'; +import {badgesFor} from './community-badges.mjs'; +import {AWARD_LABELS,AWARD_FILES} from './recognition.mjs'; +import {staffClosureStats,statsForAccount,departmentAwardEarned} from './staff-closure-stats.mjs'; const weights={owner_ceo:100,executive:90,department_head:80,branch_lead:70,officer:50}; export function projectPublicOrganisation(rows,orderRows=[],officialRows=[]){ const people=new Map(); @@ -18,7 +22,7 @@ export function projectPublicOrganisation(rows,orderRows=[],officialRows=[]){ if(row.scope_type==='organisation')person.title=EXECUTIVE_TITLES[row.username]||f.roleLabel; } const staff=[...people.values()].sort((a,b)=>b.priority-a.priority||a.displayName.localeCompare(b.displayName)); - for(const p of staff){p.title||=p.functions.slice().sort((a,b)=>(weights[b.role]||0)-(weights[a.role]||0))[0].roleLabel;delete p.priority;} + for(const p of staff){p.title||=p.functions.slice().sort((a,b)=>(weights[b.role]||0)-(weights[a.role]||0))[0].roleLabel;const personal=organisationPersonalSeal(p.username,p.functions.map(f=>'org_'+f.role));p.personalSeal=personal?{file:personal.split('/').pop(),label:p.displayName+' · Personal seal'}:null;p.functionSeals=organisationFunctionSeals(p.functions);delete p.priority;} 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()]; @@ -30,6 +34,17 @@ export async function readPublicOrganisation(db){ 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"); 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); + const result=projectPublicOrganisation(rows,order,official); + // Public recognition is separate from appointments and never includes private audit data. + const stats=await staffClosureStats(db); + for(const person of result.staff){ + const account=await reader.query('SELECT id FROM site_accounts WHERE username=?',[person.username]); + if(!account[0])continue; + const id=account[0].id; + for(const key of await badgesFor(db,id)){const file=AWARD_FILES[key]||key+'-150.png';if(/^[a-z0-9_-]+\.png$/.test(file))person.seals.push({key,label:AWARD_LABELS[key]||key.replaceAll('-',' '),file});} + const closed=statsForAccount(stats,id); + for(const key of ['support','ban-appeals','forum-support','legal','sales','network-staff','dev'])if(departmentAwardEarned(closed,key))person.seals.push({key:'closure-'+key,label:key+' · Service award',file:'award-'+key+'-150.png'}); + } + return result; }); } diff --git a/website/node/organisation-seals.mjs b/website/node/organisation-seals.mjs new file mode 100644 index 00000000..a9736193 --- /dev/null +++ b/website/node/organisation-seals.mjs @@ -0,0 +1,22 @@ +import {ORGANISATION} from './organisation-model.mjs'; +// Presentation follows current appointments; seals never grant authority. +export const FUNCTION_SEALS=Object.freeze(Object.fromEntries(ORGANISATION.flatMap(d=>[d,...d.branches]).map(s=>[s.key,{key:'function-'+s.key,label:s.label,file:'scope-'+s.key+'-v1-150.png'}]))); +export const PERSONAL_SEALS=Object.freeze({ + unimatrix999:{role:'org_owner_ceo',file:'personal-unimatrix999-ceo-v1'}, + grmacken:{role:'org_executive',file:'personal-grmacken-cto-v1'}, + richwjr:{role:'org_executive',file:'personal-richwjr-coo-v1'}, + mr_blueray:{role:'org_executive',file:'personal-mr_blueray-cco-v1'}, + ...Object.fromEntries(['am_mk','larry7517','mustafaje','s_oio_s','the_game_lordyt','tyrario1703'].map(name=>[name,{file:'personal-staff-'+name+'-v1'}])), + bedrock_s73ffupk7hx:{file:'personal-staff-s73ffupk7hx-v1'} + ,...Object.fromEntries(['yooshi','racoonvibz','halobeau143'].map(name=>[name,{file:'personal-staff-'+name}])) +}); +export function organisationPersonalSeal(username,ranks=[]){ + const asset=PERSONAL_SEALS[String(username).toLowerCase()]; + if(!asset||!ranks.some(r=>/^org_(owner_ceo|executive|department_head|branch_lead|officer)$/.test(r)))return null; + // Executive titles are personal and only valid while holding that appointment. + if(asset.role&&!ranks.includes(asset.role))return null; + return '/assets/seals/'+asset.file+'-150.png'; +} +export function organisationFunctionSeals(assignments=[]){ + return [...new Set(assignments.filter(a=>['department','branch'].includes(a.scopeType??a.scope_type)).map(a=>a.scopeKey??a.scope_key))].flatMap(key=>FUNCTION_SEALS[key]?[FUNCTION_SEALS[key]]:[]); +} diff --git a/website/scripts/install-migration-seals.py b/website/scripts/install-migration-seals.py new file mode 100644 index 00000000..abfc9478 --- /dev/null +++ b/website/scripts/install-migration-seals.py @@ -0,0 +1,46 @@ +"""Install CI-approved custom integration adapters and merge the seal catalogue.""" +from pathlib import Path +import json +import os +import subprocess +import sys + +root = Path(__file__).resolve().parents[1] +target = Path('/home/dunerealms/apps/integrations') +names = ('sync-public-profile.php', 'sync-staff-seals.php', 'managed-signatures.php') +for name in names: + subprocess.run(['php', '-l', str(root / 'integrations' / name)], check=True) +catalogue = json.loads((root / 'artwork/seals/great-migration/catalogue.json').read_text()) +entries = {} +for key, metadata in catalogue.items(): + entries[key] = dict(metadata) + for size, field in ((150, 'footer150'), (300, 'standard300')): + name = f'{key}-{size}.png' + source = root / 'web/assets/seals' / name + if not source.is_file() or source.read_bytes()[:8] != b'\x89PNG\r\n\x1a\n': + raise ValueError(f'Missing PNG: {name}') + entries[key][field] = '/assets/seals/' + name +if '--apply' not in sys.argv: + print(f'Plan: {len(entries)} seals, three custom adapters; no changes applied') + sys.exit(0) +def atomic(path, content): + temporary = path.with_name(path.name + '.migration-new') + temporary.write_bytes(content) + temporary.chmod(0o644) + os.replace(temporary, path) +# Artwork becomes reachable before any adapter starts referring to it. +for folder in ('osticket/assets/seals', 'mybb/assets/seals'): + destination = target / folder + destination.mkdir(parents=True, exist_ok=True) + for key in entries: + for size in (150, 300): + name = f'{key}-{size}.png' + atomic(destination / name, (root / 'web/assets/seals' / name).read_bytes()) +manifest = target / 'seal-manifest.json' +existing = json.loads(manifest.read_text()) +existing.update(entries) # Keep every historical asset and entitlement. +atomic(manifest, (json.dumps(existing, indent=2)+'\n').encode()) +atomic(target / 'organisation-seals.json', (root / 'integrations/organisation-seals.json').read_bytes()) +for name in names: + atomic(target / name, (root / 'integrations' / name).read_bytes()) +print(f'Installed {len(entries)} seals and three custom adapters; native core unchanged') diff --git a/website/scripts/package-migration-seals.py b/website/scripts/package-migration-seals.py new file mode 100644 index 00000000..0bc484f0 --- /dev/null +++ b/website/scripts/package-migration-seals.py @@ -0,0 +1,22 @@ +"""Export approved raster originals; preserve alpha and never alter source art.""" +from pathlib import Path +import json +from PIL import Image + +root = Path(__file__).resolve().parents[1] +sources = root / 'artwork/seals/great-migration' +destination = root / 'web/assets/seals' +destination.mkdir(parents=True, exist_ok=True) +manifest = {} +catalogue = json.loads((sources / 'catalogue.json').read_text()) +for source in sorted(sources.glob('*-v1.png')): + with Image.open(source) as image: + if 'A' not in image.getbands() or image.getchannel('A').getextrema()[0] != 0: + raise ValueError(f'Missing transparency: {source.name}') + for size in (150, 300): + output = destination / f'{source.stem}-{size}.png' + image.convert('RGBA').resize((size, size), Image.Resampling.LANCZOS).save(output, optimize=True) + manifest[source.stem] = {**catalogue[source.stem], 'footer150': f'/assets/seals/{source.stem}-150.png', + 'standard300': f'/assets/seals/{source.stem}-300.png'} +(sources / 'export-manifest.json').write_text(json.dumps(manifest, indent=2)+'\n') +print(f'Exported {len(manifest)} transparent seals in two sizes') diff --git a/website/tests/official-account.test.mjs b/website/tests/official-account.test.mjs index 7ead046e..29bedd11 100644 --- a/website/tests/official-account.test.mjs +++ b/website/tests/official-account.test.mjs @@ -6,7 +6,7 @@ import {staffSealFor} from '../node/native-seals.mjs'; test('Official alt has no personal signature seal while the human Owner keeps their own',()=>{ const manifest={official:{role:'OWNER',label:'dunerealms',footer150:'/assets/seals/owner-dunerealms-150.png'},owner:{role:'OWNER',label:'unimatrix999',footer150:'/assets/seals/owner-unimatrix999-150.png'}}; assert.equal(staffSealFor({id:OFFICIAL_ACCOUNT.id,username:'dunerealms',ranks:['org_owner_ceo']},manifest),null); - assert.equal(staffSealFor({id:OFFICIAL_ACCOUNT.ownerId,username:'unimatrix999',ranks:['org_owner_ceo']},manifest),'/assets/seals/owner-unimatrix999-150.png'); + assert.equal(staffSealFor({id:OFFICIAL_ACCOUNT.ownerId,username:'unimatrix999',ranks:['org_owner_ceo']},manifest),'/assets/seals/personal-unimatrix999-ceo-v1-150.png'); }); 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}]:[];}}; diff --git a/website/tests/organisation-seals.test.mjs b/website/tests/organisation-seals.test.mjs new file mode 100644 index 00000000..c782e220 --- /dev/null +++ b/website/tests/organisation-seals.test.mjs @@ -0,0 +1,23 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {organisationPersonalSeal,organisationFunctionSeals,FUNCTION_SEALS} from '../node/organisation-seals.mjs'; +import {projectPublicOrganisation} from '../node/organisation-public-roster.mjs'; +test('Personal seals follow active staff status and executive titles cannot follow a demotion',()=>{ + assert.equal(organisationPersonalSeal('unimatrix999',['org_owner_ceo']),'/assets/seals/personal-unimatrix999-ceo-v1-150.png'); + assert.equal(organisationPersonalSeal('grmacken',['org_officer']),null); + assert.equal(organisationPersonalSeal('am_mk',['user']),null); + assert.match(organisationPersonalSeal('bedrock_s73ffupk7hx',['org_officer']),/personal-staff-s73ffupk7hx/); + assert.equal(organisationPersonalSeal('dunerealms',['org_owner_ceo']),null); +}); +test('Function seals use current scopes once, reject unrelated memberships, and cover the full organigram',()=>{ + assert.equal(Object.keys(FUNCTION_SEALS).length,11); + const scope={scopeType:'branch',scopeKey:'news_media'}; + assert.deepEqual(organisationFunctionSeals([scope,scope,{scopeType:'clan',scopeKey:'news_media'}]),[FUNCTION_SEALS.news_media]); + assert.deepEqual(organisationFunctionSeals([]),[]); +}); +test('Public staff cards carry personal and active function seals without exposing account IDs',()=>{ + const data=projectPublicOrganisation([{username:'am_mk',scope_type:'branch',scope_key:'customer_support',role_key:'officer',id:'secret'}]); + assert.match(data.staff[0].personalSeal.file,/personal-staff-am_mk/); + assert.equal(data.staff[0].functionSeals[0].label,'Customer Support'); + assert(!JSON.stringify(data).includes('secret')); +}); diff --git a/website/web/assets/seals/personal-grmacken-cto-v1-150.png b/website/web/assets/seals/personal-grmacken-cto-v1-150.png new file mode 100644 index 00000000..cae02007 Binary files /dev/null and b/website/web/assets/seals/personal-grmacken-cto-v1-150.png differ diff --git a/website/web/assets/seals/personal-grmacken-cto-v1-300.png b/website/web/assets/seals/personal-grmacken-cto-v1-300.png new file mode 100644 index 00000000..05934c66 Binary files /dev/null and b/website/web/assets/seals/personal-grmacken-cto-v1-300.png differ diff --git a/website/web/assets/seals/personal-mr_blueray-cco-v1-150.png b/website/web/assets/seals/personal-mr_blueray-cco-v1-150.png new file mode 100644 index 00000000..9e25174f Binary files /dev/null and b/website/web/assets/seals/personal-mr_blueray-cco-v1-150.png differ diff --git a/website/web/assets/seals/personal-mr_blueray-cco-v1-300.png b/website/web/assets/seals/personal-mr_blueray-cco-v1-300.png new file mode 100644 index 00000000..41560f76 Binary files /dev/null and b/website/web/assets/seals/personal-mr_blueray-cco-v1-300.png differ diff --git a/website/web/assets/seals/personal-richwjr-coo-v1-150.png b/website/web/assets/seals/personal-richwjr-coo-v1-150.png new file mode 100644 index 00000000..3eab6b56 Binary files /dev/null and b/website/web/assets/seals/personal-richwjr-coo-v1-150.png differ diff --git a/website/web/assets/seals/personal-richwjr-coo-v1-300.png b/website/web/assets/seals/personal-richwjr-coo-v1-300.png new file mode 100644 index 00000000..e8581363 Binary files /dev/null and b/website/web/assets/seals/personal-richwjr-coo-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-am_mk-v1-150.png b/website/web/assets/seals/personal-staff-am_mk-v1-150.png new file mode 100644 index 00000000..a482b0b9 Binary files /dev/null and b/website/web/assets/seals/personal-staff-am_mk-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-am_mk-v1-300.png b/website/web/assets/seals/personal-staff-am_mk-v1-300.png new file mode 100644 index 00000000..fb0886d9 Binary files /dev/null and b/website/web/assets/seals/personal-staff-am_mk-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-larry7517-v1-150.png b/website/web/assets/seals/personal-staff-larry7517-v1-150.png new file mode 100644 index 00000000..b8ad444c Binary files /dev/null and b/website/web/assets/seals/personal-staff-larry7517-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-larry7517-v1-300.png b/website/web/assets/seals/personal-staff-larry7517-v1-300.png new file mode 100644 index 00000000..f04518bf Binary files /dev/null and b/website/web/assets/seals/personal-staff-larry7517-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-mustafaje-v1-150.png b/website/web/assets/seals/personal-staff-mustafaje-v1-150.png new file mode 100644 index 00000000..315e6d06 Binary files /dev/null and b/website/web/assets/seals/personal-staff-mustafaje-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-mustafaje-v1-300.png b/website/web/assets/seals/personal-staff-mustafaje-v1-300.png new file mode 100644 index 00000000..a4b25d7e Binary files /dev/null and b/website/web/assets/seals/personal-staff-mustafaje-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-s73ffupk7hx-v1-150.png b/website/web/assets/seals/personal-staff-s73ffupk7hx-v1-150.png new file mode 100644 index 00000000..a321f211 Binary files /dev/null and b/website/web/assets/seals/personal-staff-s73ffupk7hx-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-s73ffupk7hx-v1-300.png b/website/web/assets/seals/personal-staff-s73ffupk7hx-v1-300.png new file mode 100644 index 00000000..0611a416 Binary files /dev/null and b/website/web/assets/seals/personal-staff-s73ffupk7hx-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-s_oio_s-v1-150.png b/website/web/assets/seals/personal-staff-s_oio_s-v1-150.png new file mode 100644 index 00000000..9d1cb3cb Binary files /dev/null and b/website/web/assets/seals/personal-staff-s_oio_s-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-s_oio_s-v1-300.png b/website/web/assets/seals/personal-staff-s_oio_s-v1-300.png new file mode 100644 index 00000000..5255b667 Binary files /dev/null and b/website/web/assets/seals/personal-staff-s_oio_s-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-the_game_lordyt-v1-150.png b/website/web/assets/seals/personal-staff-the_game_lordyt-v1-150.png new file mode 100644 index 00000000..3a8d207e Binary files /dev/null and b/website/web/assets/seals/personal-staff-the_game_lordyt-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-the_game_lordyt-v1-300.png b/website/web/assets/seals/personal-staff-the_game_lordyt-v1-300.png new file mode 100644 index 00000000..bc8a3698 Binary files /dev/null and b/website/web/assets/seals/personal-staff-the_game_lordyt-v1-300.png differ diff --git a/website/web/assets/seals/personal-staff-tyrario1703-v1-150.png b/website/web/assets/seals/personal-staff-tyrario1703-v1-150.png new file mode 100644 index 00000000..75a2e1d1 Binary files /dev/null and b/website/web/assets/seals/personal-staff-tyrario1703-v1-150.png differ diff --git a/website/web/assets/seals/personal-staff-tyrario1703-v1-300.png b/website/web/assets/seals/personal-staff-tyrario1703-v1-300.png new file mode 100644 index 00000000..a0160110 Binary files /dev/null and b/website/web/assets/seals/personal-staff-tyrario1703-v1-300.png differ diff --git a/website/web/assets/seals/personal-unimatrix999-ceo-v1-150.png b/website/web/assets/seals/personal-unimatrix999-ceo-v1-150.png new file mode 100644 index 00000000..6979e92c Binary files /dev/null and b/website/web/assets/seals/personal-unimatrix999-ceo-v1-150.png differ diff --git a/website/web/assets/seals/personal-unimatrix999-ceo-v1-300.png b/website/web/assets/seals/personal-unimatrix999-ceo-v1-300.png new file mode 100644 index 00000000..a24f80c7 Binary files /dev/null and b/website/web/assets/seals/personal-unimatrix999-ceo-v1-300.png differ diff --git a/website/web/assets/seals/scope-community_operations-v1-150.png b/website/web/assets/seals/scope-community_operations-v1-150.png new file mode 100644 index 00000000..a08bed8b Binary files /dev/null and b/website/web/assets/seals/scope-community_operations-v1-150.png differ diff --git a/website/web/assets/seals/scope-community_operations-v1-300.png b/website/web/assets/seals/scope-community_operations-v1-300.png new file mode 100644 index 00000000..cc81a76d Binary files /dev/null and b/website/web/assets/seals/scope-community_operations-v1-300.png differ diff --git a/website/web/assets/seals/scope-content_creative-v1-150.png b/website/web/assets/seals/scope-content_creative-v1-150.png new file mode 100644 index 00000000..318cc0cb Binary files /dev/null and b/website/web/assets/seals/scope-content_creative-v1-150.png differ diff --git a/website/web/assets/seals/scope-content_creative-v1-300.png b/website/web/assets/seals/scope-content_creative-v1-300.png new file mode 100644 index 00000000..aceb22a2 Binary files /dev/null and b/website/web/assets/seals/scope-content_creative-v1-300.png differ diff --git a/website/web/assets/seals/scope-customer_support-v1-150.png b/website/web/assets/seals/scope-customer_support-v1-150.png new file mode 100644 index 00000000..0bbddae2 Binary files /dev/null and b/website/web/assets/seals/scope-customer_support-v1-150.png differ diff --git a/website/web/assets/seals/scope-customer_support-v1-300.png b/website/web/assets/seals/scope-customer_support-v1-300.png new file mode 100644 index 00000000..fca8e497 Binary files /dev/null and b/website/web/assets/seals/scope-customer_support-v1-300.png differ diff --git a/website/web/assets/seals/scope-dunerealms_operations-v1-150.png b/website/web/assets/seals/scope-dunerealms_operations-v1-150.png new file mode 100644 index 00000000..fb928ece Binary files /dev/null and b/website/web/assets/seals/scope-dunerealms_operations-v1-150.png differ diff --git a/website/web/assets/seals/scope-dunerealms_operations-v1-300.png b/website/web/assets/seals/scope-dunerealms_operations-v1-300.png new file mode 100644 index 00000000..b4c8088e Binary files /dev/null and b/website/web/assets/seals/scope-dunerealms_operations-v1-300.png differ diff --git a/website/web/assets/seals/scope-engineering-v1-150.png b/website/web/assets/seals/scope-engineering-v1-150.png new file mode 100644 index 00000000..ee795623 Binary files /dev/null and b/website/web/assets/seals/scope-engineering-v1-150.png differ diff --git a/website/web/assets/seals/scope-engineering-v1-300.png b/website/web/assets/seals/scope-engineering-v1-300.png new file mode 100644 index 00000000..39ff6a66 Binary files /dev/null and b/website/web/assets/seals/scope-engineering-v1-300.png differ diff --git a/website/web/assets/seals/scope-it_operations-v1-150.png b/website/web/assets/seals/scope-it_operations-v1-150.png new file mode 100644 index 00000000..f34c1bbc Binary files /dev/null and b/website/web/assets/seals/scope-it_operations-v1-150.png differ diff --git a/website/web/assets/seals/scope-it_operations-v1-300.png b/website/web/assets/seals/scope-it_operations-v1-300.png new file mode 100644 index 00000000..8aa476ea Binary files /dev/null and b/website/web/assets/seals/scope-it_operations-v1-300.png differ diff --git a/website/web/assets/seals/scope-legal_compliance-v1-150.png b/website/web/assets/seals/scope-legal_compliance-v1-150.png new file mode 100644 index 00000000..f55ba787 Binary files /dev/null and b/website/web/assets/seals/scope-legal_compliance-v1-150.png differ diff --git a/website/web/assets/seals/scope-legal_compliance-v1-300.png b/website/web/assets/seals/scope-legal_compliance-v1-300.png new file mode 100644 index 00000000..7c799c90 Binary files /dev/null and b/website/web/assets/seals/scope-legal_compliance-v1-300.png differ diff --git a/website/web/assets/seals/scope-news_media-v1-150.png b/website/web/assets/seals/scope-news_media-v1-150.png new file mode 100644 index 00000000..2b7f9b1b Binary files /dev/null and b/website/web/assets/seals/scope-news_media-v1-150.png differ diff --git a/website/web/assets/seals/scope-news_media-v1-300.png b/website/web/assets/seals/scope-news_media-v1-300.png new file mode 100644 index 00000000..9f434b21 Binary files /dev/null and b/website/web/assets/seals/scope-news_media-v1-300.png differ diff --git a/website/web/assets/seals/scope-people_operations-v1-150.png b/website/web/assets/seals/scope-people_operations-v1-150.png new file mode 100644 index 00000000..fa3eced3 Binary files /dev/null and b/website/web/assets/seals/scope-people_operations-v1-150.png differ diff --git a/website/web/assets/seals/scope-people_operations-v1-300.png b/website/web/assets/seals/scope-people_operations-v1-300.png new file mode 100644 index 00000000..03e7e83a Binary files /dev/null and b/website/web/assets/seals/scope-people_operations-v1-300.png differ diff --git a/website/web/assets/seals/scope-sales_accounts-v1-150.png b/website/web/assets/seals/scope-sales_accounts-v1-150.png new file mode 100644 index 00000000..e8f41775 Binary files /dev/null and b/website/web/assets/seals/scope-sales_accounts-v1-150.png differ diff --git a/website/web/assets/seals/scope-sales_accounts-v1-300.png b/website/web/assets/seals/scope-sales_accounts-v1-300.png new file mode 100644 index 00000000..9bd65d50 Binary files /dev/null and b/website/web/assets/seals/scope-sales_accounts-v1-300.png differ diff --git a/website/web/assets/seals/scope-trust_safety-v1-150.png b/website/web/assets/seals/scope-trust_safety-v1-150.png new file mode 100644 index 00000000..c3485e3a Binary files /dev/null and b/website/web/assets/seals/scope-trust_safety-v1-150.png differ diff --git a/website/web/assets/seals/scope-trust_safety-v1-300.png b/website/web/assets/seals/scope-trust_safety-v1-300.png new file mode 100644 index 00000000..ae7f5998 Binary files /dev/null and b/website/web/assets/seals/scope-trust_safety-v1-300.png differ diff --git a/website/web/staff-directory.js b/website/web/staff-directory.js index 740e82e4..891c3398 100644 --- a/website/web/staff-directory.js +++ b/website/web/staff-directory.js @@ -1,11 +1,11 @@ const el=(tag,text,cls)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(cls)n.className=cls;return n;}; -const files={community_operations:'department-support-150.png',dunerealms_operations:'department-network-staff-150.png',customer_support:'department-support-150.png',sales_accounts:'department-sales-150.png',trust_safety:'department-ban-appeals-150.png',it_operations:'department-network-staff-150.png',engineering:'department-dev-150.png',legal_compliance:'department-legal-v2-150.png'}; +const files=Object.fromEntries(['community_operations','dunerealms_operations','customer_support','sales_accounts','content_creative','news_media','trust_safety','it_operations','engineering','people_operations','legal_compliance'].map(key=>[key,'scope-'+key+'-v1-150.png'])); function seal(file,label){const img=el('img');img.src='/assets/seals/'+file;img.alt=label;img.loading='lazy';img.addEventListener('error',()=>{img.hidden=true;},{once:true});return img;} function profile(p){const a=el('a',p.displayName||p.username);a.href=/^\/(?:people|memorial)\/[a-z0-9_%.-]+$/i.test(p.profile||'')?p.profile:'/people/'+encodeURIComponent(p.username);return a;} function holders(people,empty='VACANT'){const wrap=el('div',undefined,'staff-holders');if(!people.length)wrap.append(el('span',empty,'staff-vacant'));for(const p of people)wrap.append(profile(p));return wrap;} function card(p){const c=el('article',undefined,'staff-person'),head=el('header'),avatar=el('img');avatar.src=p.avatar||'https://cp.dunerealms.com/api/avatars/face/roster/'+encodeURIComponent(p.username);avatar.alt='';avatar.loading='lazy';avatar.width=avatar.height=64;head.append(avatar,profile(p));c.append(head,el('p',p.title||p.rank||'Staff','staff-title'),el('p',p.bio||'No public biography added yet.','staff-bio')); const list=el('ul');for(const f of p.functions||[]){const li=el('li');li.append(el('strong',f.scopeLabel),el('span',f.roleLabel));list.append(li);}c.append(list); - const marks=el('div',undefined,'staff-marks'),seen=new Set();for(const f of p.functions||[]){const file=files[f.scopeKey];if(file&&!seen.has(file)){marks.append(seal(file,f.scopeLabel+' function seal'));seen.add(file);}} + const marks=el('div',undefined,'staff-marks'),seen=new Set();if(p.personalSeal?.file&&/^[a-z0-9_-]+\.png$/.test(p.personalSeal.file))marks.append(seal(p.personalSeal.file,p.personalSeal.label));for(const f of p.functions||[]){const file=files[f.scopeKey];if(file&&!seen.has(file)){marks.append(seal(file,f.scopeLabel+' function seal'));seen.add(file);}} for(const a of p.seals||[])if(/^[a-z0-9_-]+\.png$/.test(a.file||''))marks.append(seal(a.file,a.label||'Earned honour'));if(marks.childElementCount){const details=el('details');details.append(el('summary','Function seals & earned honours'),marks);c.append(details);}return c;} function render(data){const chart=document.querySelector('#organisation-chart'),cards=document.querySelector('#staff-members'),order=document.querySelector('#order-members'); if(data.model!=='organisation-v2'){const people=new Map();for(const g of data.groups||[])for(const p of g.staff||[])people.set(p.username,p);for(const p of people.values())cards.append(card(p));chart.append(el('p','The new organigram will appear when its migration is activated.','staff-empty'));document.querySelector('#staff-status').textContent=people.size+' existing public staff profiles.';return;}