plugins/website/shared/error.js
2026-11-27 23:43:05 +00:00

12 lines
2.8 KiB
JavaScript

const query=new URLSearchParams(location.search),reason=location.pathname==='/account-required.html'?'not-linked':query.get('reason')||'not-linked';
const modes={
'age-restricted':{title:'Forums are for ages 15 and over',message:'Your account is marked as under 15, so forum access is unavailable.',detail:'You can still use your DuneRealms account and contact support. If your age setting is incorrect, ask staff to review it.',button:'Open account panel →',url:'https://cp.dunerealms.com/'},
'not-linked':{title:'Link your Minecraft account',message:'Dear traveller, to use this functionality you must link your Minecraft account to your DuneRealms website account.',detail:'Open Game identity in your account panel, generate your private link command, then enter it in game. Your Minecraft UUID verifies the link.',button:'Link Minecraft account →',url:'https://cp.dunerealms.com/#game'},
'signed-out':{title:'Sign in to continue',message:'Dear traveller, sign in to your DuneRealms website account to use this functionality.',detail:'Use your existing website username and password. Your Minecraft or Microsoft password is never needed.',button:'Sign in to DuneRealms →',url:'https://cp.dunerealms.com/'},
'forbidden':{title:'This area needs permission',message:'Dear traveller, your account does not have access to this functionality.',detail:'If you believe you should have access, contact the staff team through support.',button:'Open support →',url:'https://cp.dunerealms.com/#tickets'},
'not-found':{title:'This route is uncharted',message:'Dear traveller, we could not find that page.',detail:'The page may have moved. Return to the portal or open your account panel.',button:'Return to the portal →',url:'https://www.dunerealms.com/'},
'unavailable':{title:'A short pause in the caravan',message:'Dear traveller, this service is temporarily unavailable.',detail:'Please try again shortly. If the problem continues, let the staff team know through support.',button:'Open account panel →',url:'https://cp.dunerealms.com/'}
};
const mode=modes[reason]||modes['not-found'];document.title=mode.title+' · DuneRealms';for(const key of ['title','message','detail'])document.getElementById(key).textContent=mode[key];const primary=document.getElementById('primary');primary.textContent=mode.button;primary.href=mode.url;
if(query.get('context')==='forum'){const link=document.getElementById('secondary');link.textContent='Return to forums';link.href='https://www.dunerealms.com/forums.html';}else if(query.get('context')==='support'){const link=document.getElementById('secondary');link.textContent='Appeal a ban without linking';link.href='https://cp.dunerealms.com/support/dune-sso.php?appeal=';}
if(reason!=='not-linked')document.getElementById('footnote').textContent='Your DuneRealms website account is managed in the account control panel.';