diff --git a/website/control-panel/public/cp-v2/cp-v2-postbank-credit.mjs b/website/control-panel/public/cp-v2/cp-v2-postbank-credit.mjs
index 89681801..f9920ae3 100644
--- a/website/control-panel/public/cp-v2/cp-v2-postbank-credit.mjs
+++ b/website/control-panel/public/cp-v2/cp-v2-postbank-credit.mjs
@@ -34,14 +34,14 @@ export function mountPostbankCredit(host,id,{fetcher=fetch}={}){
function applicationForm(host,product,account,values,data){
const grant=product.group==='grants',box=el('section',undefined,'pb-box'),motivation=el('textarea');motivation.required=!grant;motivation.minLength=10;motivation.maxLength=4000;box.append(el('h3',grant?'Accept your launch grant':'Request this credit'));const form=instruction(box,product.group==='grants'?'Accept launch grant':'Submit for bank review','/api/bank/credit/apply',()=>({...values,...(grant?{}:{motivation:motivation.value.trim()}),accepted:true,termsVersion:view.termsVersion}),{reason:false,confirmationField:'accepted',confirmation:'I accept the credit terms: '+data.quote.amount+' DM, '+data.quote.annualRate+'% annually, '+data.quote.monthly+' DM per month. '+(product.group==='grants'?'Disbursement is queued; this grant must be repaid.':'A bank decision and separate offer acceptance are required before funding.')});if(!grant)form.prepend(field('Purpose and repayment plan',motivation));host.append(box);
}
- function contractDetails(host,loan,staff=false){
- let loaded=false;const expand=el('details'),summary=el('summary','+ Contract details & actions'),body=el('div');expand.append(summary,body);host.append(expand);expand.ontoggle=async()=>{if(!expand.open||loaded)return;loaded=true;body.textContent='Loading current contract…';try{const d=await api.request((staff?'/api/bank/admin/credit/details':'/api/bank/credit/details')+'?loanId='+encodeURIComponent(loan.id));if(!active)return;body.replaceChildren(el('p',loan.motivation),el('p','Annual rate: '+d.quote.annualRate+'% · Total repayment: '+d.quote.totalRepayment+' DM · Collateral: '+d.collateral+' DM'),el('p','Settlement estimate today: '+d.settlement+' DM'),el('p',d.decision||'No decision recorded.'));if(d.supportTicket){const line=el('p',d.supportTicket.number?'Support review ticket: '+d.supportTicket.number:'Support review ticket is being linked. Your application is saved.');if(/^https:\/\/support\.dunerealms\.com\/(?:scp\/tickets\.php\?id=\d+|tickets\.php)$/.test(d.supportTicket.url||'')){const link=el('a','Open Support →');link.href=d.supportTicket.url;link.target='_blank';link.rel='noopener';line.append(' · ',link);}body.append(line);}if(d.replacedBy)body.append(el('p','Replaced by refinancing contract '+d.replacedBy+'. Original history is retained.'));for(const notice of d.notices||[]){const box=el('aside',undefined,'pb-credit-notice'+(d.state==='arrears'?' pb-credit-notice-alert':''));box.append(el('strong',notice.subject),el('p',notice.body));body.append(box);}const enabled=staff?view.processing==='active'&&view.canManage:view.intakeEnabled;
+ function contractDetails(host,loan,staff=false,detailRow=null){
+ let loaded=false;const expand=el('details'),summary=el('summary','+ Contract details & actions'),body=el('div');body.className='pb-credit-contract-panel';body.id='credit-contract-'+loan.id;summary.setAttribute('aria-controls',body.id);if(detailRow){detailRow.firstElementChild.append(body);expand.append(summary);}else expand.append(summary,body);host.append(expand);expand.ontoggle=async()=>{if(detailRow)detailRow.hidden=!expand.open;summary.setAttribute('aria-expanded',String(expand.open));if(!expand.open||loaded)return;loaded=true;body.textContent='Loading current contract…';try{const d=await api.request((staff?'/api/bank/admin/credit/details':'/api/bank/credit/details')+'?loanId='+encodeURIComponent(loan.id));if(!active)return;body.replaceChildren(el('p',loan.motivation),el('p','Annual rate: '+d.quote.annualRate+'% · Total repayment: '+d.quote.totalRepayment+' DM · Collateral: '+d.collateral+' DM'),el('p','Settlement estimate today: '+d.settlement+' DM'),el('p',d.decision||'No decision recorded.'));if(d.supportTicket){const line=el('p',d.supportTicket.number?'Support review ticket: '+d.supportTicket.number:'Support review ticket is being linked. Your application is saved.');if(/^https:\/\/support\.dunerealms\.com\/(?:scp\/tickets\.php\?id=\d+|tickets\.php)$/.test(d.supportTicket.url||'')){const link=el('a','Open Support →');link.href=d.supportTicket.url;link.target='_blank';link.rel='noopener';line.append(' · ',link);}body.append(line);}if(d.replacedBy)body.append(el('p','Replaced by refinancing contract '+d.replacedBy+'. Original history is retained.'));for(const notice of d.notices||[]){const box=el('aside',undefined,'pb-credit-notice'+(d.state==='arrears'?' pb-credit-notice-alert':''));box.append(el('strong',notice.subject),el('p',notice.body));body.append(box);}const enabled=staff?view.processing==='active'&&view.canManage:view.intakeEnabled;
if(enabled&&!staff){if(d.state==='offered')instruction(body,'Accept credit offer','/api/bank/credit/action',()=>({loanId:loan.id,action:'accept',expectedVersion:d.version,reason:'Accepted the disclosed credit offer'}),{reason:false,confirmation:'I accept the full repayment cost above and authorise the collateral reservation before disbursement.'});if(['submitted','approved_pending','offered','payout_queued'].includes(d.state))instruction(body,'Withdraw application','/api/bank/credit/action',()=>({loanId:loan.id,action:'withdraw'}));if(['active','arrears'].includes(d.state))instruction(body,'Make a repayment','/api/bank/credit/action',()=>({loanId:loan.id,action:'repay'}),{amount:true,confirmation:'Debit the linked current account at the next four-hour bank window. Earned interest is charged; future interest is waived. Confirmed reserved funds retain their bank value date.'});}
if(enabled&&staff){if(d.state==='submitted'&&loan.canReview){instruction(body,'Approve application','/api/bank/admin/credit/decision',()=>({loanId:loan.id,action:'approve'}),{risk:loan.score.score<400||loan.score.flags.includes('High Monthly Commitments')});instruction(body,'Decline application','/api/bank/admin/credit/decision',()=>({loanId:loan.id,action:'decline'}));}if(d.state==='arrears')instruction(body,'Recover pledged collateral','/api/bank/admin/credit/recover',()=>({loanId:loan.id,action:'recover'}),{amount:true,confirmation:'Recover only this contract’s pledged DM to reduce its debt. No inventory is involved.'});}
if(d.schedule.length){const {wrap,body:rows}=grid(['Due date','Principal · DM','Interest · DM','Paid · DM','Status']);for(const row of d.schedule){const tr=el('tr');for(const value of [new Date(row.dueAt).toLocaleDateString('en-GB'),row.principal,row.interest,row.paid,human(row.state)])tr.append(el('td',value));rows.append(tr);}body.append(wrap);}else body.append(el('p','The repayment schedule starts only when funds are disbursed.'));
}catch(error){if(active){body.textContent=error.message;loaded=false;}}};
}
- function myCredit(){const {wrap,body}=grid(['Application','Product','Status','Principal · DM','Outstanding · DM','Monthly · DM','Details']);for(const loan of view.loans){const tr=el('tr'),cell=el('td');contractDetails(cell,loan);for(const value of [loan.id,human(loan.productKey),human(loan.state),loan.principal,loan.outstanding,loan.monthly])tr.append(el('td',value));tr.append(cell);body.append(tr);}frame.content.append(wrap);if(!view.loans.length)frame.content.append(el('p','No applications or loans are registered for your authorised banking clients.'));}
- function management(){frame.content.append(el('p',view.processing==='active'?'Review the evidence before deciding. Treasury funds are reserved for approved offers; the borrower must accept before disbursement.':'Credit processing is not active yet.','pb-muted'));const {wrap,body}=grid(['Client','Product','Submitted','Amount · DM','State','Review']);for(const loan of view.applications){const tr=el('tr'),cell=el('td');cell.append(el('p','Credit score: '+loan.score.score+' / 1000 · '+loan.score.band+(loan.score.limitedHistory?' · Limited history':'')),el('p',loan.score.flags.join(' · ')));contractDetails(cell,loan,true);for(const value of [loan.entity,human(loan.productKey),new Date(loan.createdAt).toLocaleDateString('en-GB'),loan.principal,human(loan.state)])tr.append(el('td',value));tr.append(cell);body.append(tr);}frame.content.append(wrap);if(!view.applications.length)frame.content.append(el('p','No credit applications are awaiting review.'));}
+ function myCredit(){const {wrap,body}=grid(['Application','Product','Status','Principal · DM','Outstanding · DM','Monthly · DM','Details']);for(const loan of view.loans){const tr=el('tr'),cell=el('td'),expanded=el('tr'),content=el('td');expanded.className='pb-credit-detail-row';expanded.hidden=true;content.colSpan=7;expanded.append(content);contractDetails(cell,loan,false,expanded);for(const value of [loan.id,human(loan.productKey),human(loan.state),loan.principal,loan.outstanding,loan.monthly])tr.append(el('td',value));tr.append(cell);body.append(tr,expanded);}frame.content.append(wrap);if(!view.loans.length)frame.content.append(el('p','No applications or loans are registered for your authorised banking clients.'));}
+ function management(){frame.content.append(el('p',view.processing==='active'?'Review the evidence before deciding. Treasury funds are reserved for approved offers; the borrower must accept before disbursement.':'Credit processing is not active yet.','pb-muted'));const {wrap,body}=grid(['Client','Product','Submitted','Amount · DM','State','Review']);for(const loan of view.applications){const tr=el('tr'),cell=el('td'),expanded=el('tr'),content=el('td');expanded.className='pb-credit-detail-row';expanded.hidden=true;content.colSpan=6;expanded.append(content);cell.append(el('p','Credit score: '+loan.score.score+' / 1000 · '+loan.score.band+(loan.score.limitedHistory?' · Limited history':'')),el('p',loan.score.flags.join(' · ')));contractDetails(cell,loan,true,expanded);for(const value of [loan.entity,human(loan.productKey),new Date(loan.createdAt).toLocaleDateString('en-GB'),loan.principal,human(loan.state)])tr.append(el('td',value));tr.append(cell);body.append(tr,expanded);}frame.content.append(wrap);if(!view.applications.length)frame.content.append(el('p','No credit applications are awaiting review.'));}
void load();return()=>{active=false;abort.abort();frame.root.remove();};
}
diff --git a/website/control-panel/public/cp-v2/cp-v2-postbank-payroll.mjs b/website/control-panel/public/cp-v2/cp-v2-postbank-payroll.mjs
index 3520f847..8b91a245 100644
--- a/website/control-panel/public/cp-v2/cp-v2-postbank-payroll.mjs
+++ b/website/control-panel/public/cp-v2/cp-v2-postbank-payroll.mjs
@@ -4,7 +4,7 @@ const money=value=>(Number(value)/100).toFixed(2);
export async function renderPayroll(host,{api,isActive=()=>true}={}){
const data=await api.request('/api/bank/admin/payroll');if(!isActive())return;
host.replaceChildren(el('h2','People & Organisation'),el('p','One monthly salary per person, using the highest active rank. Missing personal current accounts receive free Start banking.'));
- const form=el('form',undefined,'pb-transfer-form'),enabled=el('input'),day=el('input'),reason=el('input'),status=el('p'),save=el('button','Save payroll settings');
+ const form=el('form',undefined,'pb-transfer-form pb-payroll-form'),enabled=el('input'),day=el('input'),reason=el('input'),status=el('p'),save=el('button','Save payroll settings');
enabled.type='checkbox';enabled.checked=data.policy.value.enabled;
day.type='number';day.min='1';day.max='28';day.step='1';day.required=true;day.value=data.policy.value.payDay;
reason.required=true;reason.minLength=5;reason.maxLength=200;
diff --git a/website/control-panel/public/cp-v2/v2.css b/website/control-panel/public/cp-v2/v2.css
index 70832cfa..56b78f06 100644
--- a/website/control-panel/public/cp-v2/v2.css
+++ b/website/control-panel/public/cp-v2/v2.css
@@ -234,3 +234,6 @@
.pb-credit-notice{padding:18px;border-left:4px solid #c7ae65;background:#263f31;border-radius:8px;margin:14px 0}.pb-credit-notice-alert{border-left-color:#df837c;background:#492b2a}.pb-credit-notice-alert strong{color:#ffc0b7}
.pb-payment-state[data-mode=service]{border-color:#bc8ae0!important;color:#ead2ff!important;background:#68468a55!important}.pb-compensation-summary{padding:16px;border:1px solid #aa87c9;border-radius:8px;background:#64428322;color:#e3c9fa}.pb-ledger-reference>button{display:block;margin-top:10px}
+
+.pb-credit-detail-row[hidden]{display:none!important}.pb-credit-detail-row>td{padding:24px!important;background:#102f25!important}.pb-credit-contract-panel{width:100%;min-width:0;max-width:100%;box-sizing:border-box}.pb-credit-contract-panel .pb-transfer-form,.pb-credit-contract-panel .pb-credit-instruction{width:100%;min-width:0;max-width:100%;box-sizing:border-box}.pb-credit-contract-panel input,.pb-credit-contract-panel textarea{max-width:100%;box-sizing:border-box}.pb-credit-contract-panel .pb-ledger-scroll{max-width:100%;overflow-x:auto}.pb-credit-contract-panel p,.pb-credit-contract-panel label{white-space:normal;overflow-wrap:anywhere}
+.pb-payroll-form>.pb-ledger-scroll,.pb-payroll-form>p,.pb-payroll-form>button{grid-column:1/-1}.pb-payroll-form .pb-ledger input{width:115px;max-width:100%;padding:10px;border:1px solid #82926d;border-radius:6px;background:#102e24;color:#eee6d2;box-sizing:border-box}.pb-payroll-form input[type=checkbox]{width:24px;height:24px;align-self:start;accent-color:#b89a50}.pb-payroll-form .pb-ledger th{white-space:normal}.pb-payroll-form .pb-ledger-scroll{min-width:0;max-width:100%}
diff --git a/website/control-panel/server.mjs b/website/control-panel/server.mjs
index a95ec58d..edf5e1d4 100644
--- a/website/control-panel/server.mjs
+++ b/website/control-panel/server.mjs
@@ -256,6 +256,11 @@ export function createPanel(db,settings={},dependencies={}){
if(path.startsWith('/assets/')&&sharedAssets.has(path.slice(8))){const file=path.slice(8);return new Response(request.method==='HEAD'?null:await readFile(new URL('../web/assets/'+file,import.meta.url)),{headers:{'Content-Type':file.endsWith('.svg')?'image/svg+xml':file.endsWith('.png')?'image/png':'image/webp','Cache-Control':'public, max-age=3600'}});}
if(path==='/federal-reserve'||path==='/federal-reserve/')return new Response(request.method==='HEAD'?null:await readFile(new URL('./public/cp-v2/reserve-ledger.html',import.meta.url)),{headers:{'Content-Type':'text/html; charset=utf-8','Cache-Control':'no-store','X-Content-Type-Options':'nosniff'}});
// V2 shell is public; private data and writes retain their authenticated API gates.
+ // All authored cp-v2 browser modules share this bounded public directory.
+ // New components must not require a second, manually maintained route list.
+ if(/^\/v2\/cp-v2-[a-z0-9-]+\.mjs$/.test(path)){
+ try{const bytes=await readFile(new URL('./public/cp-v2/'+path.slice('/v2/'.length),import.meta.url));return new Response(request.method==='HEAD'?null:bytes,{headers:{'Content-Type':'text/javascript; charset=utf-8','Cache-Control':'private, no-store','X-Content-Type-Options':'nosniff'}});}catch(error){if(error.code==='ENOENT')return new Response('Not found',{status:404});throw error;}
+ }
if(['/v2/citizen-directory.mjs','/v2/citizen-directory.css','/v2/organisation-permissions.mjs'].includes(path))return new Response(request.method==='HEAD'?null:await readFile(new URL('./public/cp-v2/'+path.slice('/v2/'.length),import.meta.url)),{headers:{'Content-Type':path.endsWith('.css')?'text/css; charset=utf-8':'text/javascript; charset=utf-8','Cache-Control':'private, no-store','X-Content-Type-Options':'nosniff'}});
if(['/','/index.html','/v2','/v2/','/v2/cp-v2-politics-pages.mjs','/v2/cp-v2-auth.mjs','/v2/cp-v2-access.mjs','/v2/citizens-registry.mjs','/v2/cp-v2-page-template.mjs','/v2/imperial-permissions.mjs','/v2/honours-seals.mjs','/v2/cp-v2-planned-pages.mjs','/v2/cp-v2-choam-pages.mjs','/v2/cp-v2-bureau-pages.mjs','/v2/cp-v2-service-pages.mjs','/v2/cp-v2-newsroom.mjs','/v2/cp-v2-moderation.mjs','/v2/cp-v2-native-services.mjs','/v2/cp-v2-exchange-authority.mjs','/v2/cp-v2-crysknife.mjs','/v2/cp-v2-post-menu.mjs','/v2/cp-v2-postbank-foundation.mjs','/v2/cp-v2-postbank-payments.mjs','/v2/cp-v2-postbank-admin.mjs','/v2/cp-v2-authorisations.mjs','/v2/cp-v2-tax-treasury.mjs','/v2/cp-v2-reserve-ledger.mjs','/v2/cp-v2-reserve-entry.mjs','/v2/cp-v2-postbank-credit.mjs','/v2/cp-v2-postbank-beneficiaries.mjs','/v2/cp-v2-postbank-statement-archive.mjs','/v2/cp-v2-bank-pages.mjs','/v2/cp-v2-post-pages.mjs','/v2/cp-v2-rewards.mjs','/v2/cp-v2-user-commerce.mjs','/v2/cp-v2-user-pages.mjs','/v2/cp-v2-user-api.mjs','/v2/cp-v2-security.mjs','/v2/cp-v2-passport.mjs','/v2/cp-v2-personal-records.mjs','/v2/cp-v2-design-pages.mjs','/v2/cp-v2-design-catalog.mjs','/v2/cp-v2-forge-pages.mjs','/v2/cp-v2-hosting.mjs','/v2/cp-v2-community-treasury.mjs','/v2/cp-v2-item-register.mjs','/v2/cp-v2-kit-directorate.mjs','/v2/cp-v2-campaigns.mjs','/v2/cp-v2-imperial-revenue.mjs','/v2/cp-v2-read-register.mjs','/v2/cp-v2-bureau-data.mjs','/v2/cp-v2-company-actions.mjs','/v2/v2.css','/v2/v2.js'].includes(path)){
const moduleFile=path.endsWith('.mjs')||path.endsWith('.js');
diff --git a/website/docs/postbank-payroll.md b/website/docs/postbank-payroll.md
index b27d9304..3b417a11 100644
--- a/website/docs/postbank-payroll.md
+++ b/website/docs/postbank-payroll.md
@@ -31,6 +31,14 @@ creating accounts. `--apply` enables the current policy and runs the initial
current-period payroll once. Repeating it cannot pay the same period/person
again. Use the physical release path when invoking the script.
+The rollout first prepares a versioned public tariff register and its PDF. A
+failed document render stops the rollout before payroll is enabled. The central
+scheduler retries pending tariff documents. Anonymous clients read
+`GET /api/bank/public/rates` and download the exact publication through
+`GET /api/bank/public/rates.pdf?version=UUID`; pending PDFs never fall back to an
+older document. Public snapshots contain tax parameters, not private rank wages
+or individual payslips. The public Rates & Charges page uses this same register.
+
Validation includes concurrent-run idempotency, account 108 provisioning,
salary/tax conservation and rollback on insufficient funds. The same concurrent
rollout was verified in isolated MySQL tables without production payments.
diff --git a/website/integrations/mybb/public-profile.php b/website/integrations/mybb/public-profile.php
index 5b60eed0..30e553fc 100644
--- a/website/integrations/mybb/public-profile.php
+++ b/website/integrations/mybb/public-profile.php
@@ -25,17 +25,22 @@ function dune_public_social_links($profile){
}
function dune_forum_clan_emblem(&$post,$profile=null){
if(!array_key_exists('useravatar',$post))return;
+ if(str_contains($post['useravatar'],'dune-author-identity'))return;
+ static$styled=false;
$name=$profile['username']??'';
$url=preg_match('/^[a-z0-9_]{3,32}$/i',$name)?'https://cp.dunerealms.com/api/clan-emblems/member/'.rawurlencode($name):'https://www.dunerealms.com/assets/nav-clan-v2.webp';
- $post['useravatar'].='
';}
dune_forum_clan_emblem($post,$profile);return$post;
}
diff --git a/website/node/postbank-api.mjs b/website/node/postbank-api.mjs
index fb636320..ad63500f 100644
--- a/website/node/postbank-api.mjs
+++ b/website/node/postbank-api.mjs
@@ -1,6 +1,7 @@
import {randomUUID} from 'node:crypto';
import {PostbankPayroll} from './postbank-payroll.mjs';
import {PostbankFinancialPolicies} from './postbank-financial-policy.mjs';
+import {PostbankRatePublications} from './postbank-rate-publications.mjs';
import {PostbankClientManagement} from './postbank-client-management.mjs';
import {PostbankCompensation} from './postbank-compensation.mjs';
import {PostbankStandingInstructions} from './postbank-standing-instructions.mjs';
@@ -37,12 +38,14 @@ export function createPostbankApi(central,bank,settings={},deps={}){
const beneficiaries=bank?new PostbankBeneficiaries(bank,deps):null;
const statements=bank?new PostbankStatementArchive(bank,payments,{...deps,...statementSettings(settings)}):null;
const reserveLedger=createReserveLedger(bank,deps);
+ const rates=bank?new PostbankRatePublications(bank,{...deps,python:settings.POSTBANK_PYTHON,logo:settings.POSTBANK_STATEMENT_LOGO}):null;
const authorisations=bank?new PostbankAuthorisations(bank,central,authority,deps):null;
const lookups=new Map(),transferAttempts=new Map();
const reply=(data,status=200)=>Response.json(data,{status,headers:{'Cache-Control':'private, no-store',Vary:'Cookie'}});
return async request=>{
const url=new URL(request.url),path=url.pathname;
if(path==='/api/bank/public/reserve-ledger')return reserveLedger(request);
+ if(['/api/bank/public/rates','/api/bank/public/rates.pdf'].includes(path))return rates?rates.publicResponse(request):Response.json({message:'The public tariff register is being prepared.'},{status:503,headers:{'Access-Control-Allow-Origin':'*','Cache-Control':'no-store'}});
const user=await auth(request);if(!user)return reply({message:'Sign in to use Imperial Postbank.'},401);
if(!service)return reply({message:'The independent bank database is not linked yet.',state:'not_linked'},503);
try{await reconcilePostbankClans(central,bank);}catch{return reply({message:'The bank could not verify the current organisation registry. Please retry shortly.'},503);}
diff --git a/website/node/postbank-financial-policy.mjs b/website/node/postbank-financial-policy.mjs
index 08eeec12..0947f07b 100644
--- a/website/node/postbank-financial-policy.mjs
+++ b/website/node/postbank-financial-policy.mjs
@@ -25,6 +25,7 @@ export async function makePublicRatesSnapshot(tx,{id=randomUUID(),now=Date.now()
return {version:id,publishedAt:now,policyVersions:{bank:bank.version,taxes:tax.version,payrollTax:payroll.version},packages:PACKAGES.map(p=>({key:p.key,name:p.name,...bank.value.packages[p.key]})),credit:CREDIT_PRODUCTS.map(p=>({key:p.key,name:p.name,annualBps:bank.value.creditAnnualBps[p.key],availability:p.automatic?'Automatic launch grant':p.revolving?'Planned credit line':'Subject to credit review'})),taxes:tax.value,payrollTax:payroll.value,serviceNotices:[bank.value.billingEnabled?'Monthly package charges are processed automatically.':'Monthly package billing is not enabled.', 'Standard transfers settle every four hours in Europe/Brussels. Instant transfers post immediately.', 'Balance Guard is a configured option; protection and billing remain inactive until that service is enabled.', 'Service compensation posts immediately. Statements are free for every package.']};
}
export async function queueRatesPublication(tx,actorId,now=Date.now()){
+ const previous=await tx.first('SELECT created_at FROM pb_rate_publications ORDER BY created_at DESC LIMIT 1 FOR UPDATE');now=Math.max(now,Number(previous?.created_at||0)+1);
const data=await makePublicRatesSnapshot(tx,{now});await tx.query("INSERT INTO pb_rate_publications(id,data_json,state,created_by,created_at) VALUES(?,?,'pending',?,?)",[data.version,JSON.stringify(data),actorId,now]);return data.version;
}
export class PostbankFinancialPolicies{
diff --git a/website/node/postbank-payments.mjs b/website/node/postbank-payments.mjs
index 0920cb9f..2f1a22fe 100644
--- a/website/node/postbank-payments.mjs
+++ b/website/node/postbank-payments.mjs
@@ -1,5 +1,6 @@
import {CentralScheduler} from './central-scheduler.mjs';
import {PostbankPayroll} from './postbank-payroll.mjs';
+import {PostbankRatePublications} from './postbank-rate-publications.mjs';
import {PostbankStandingInstructions} from './postbank-standing-instructions.mjs';
import {PostbankCreditSupport} from './postbank-credit-support.mjs';
import {PostbankTransferSecurity} from './postbank-transfer-security.mjs';
@@ -159,6 +160,7 @@ export function createPostbankTasks(central,bank,settings,deps={}){
{key:'credit_support',slot:now=>Math.floor(now/60000)*60000,run:()=>support.process()},
{key:'standing_instructions',slot:now=>Math.floor(now/60000)*60000,run:()=>new PostbankStandingInstructions(bank,deps.authority||createPostbankAuthority(central,{bank}),deps).process()},
{key:'staff_payroll',slot:now=>Math.floor(now/60000)*60000,run:()=>new PostbankPayroll(central,bank,deps).process()},
+ {key:'tariff_publications',slot:now=>Math.floor(now/60000)*60000,run:()=>new PostbankRatePublications(bank,{...deps,python:settings.POSTBANK_PYTHON,logo:settings.POSTBANK_STATEMENT_LOGO}).process()},
{key:'statement_index',slot:now=>Math.floor(now/3600000)*3600000,run:()=>archives.seed()},
{key:'statement_archives',slot:now=>Math.floor(now/60000)*60000,run:()=>archives.process()}
];
diff --git a/website/node/postbank-payroll-accounts.mjs b/website/node/postbank-payroll-accounts.mjs
index ad7c5a51..e95e0713 100644
--- a/website/node/postbank-payroll-accounts.mjs
+++ b/website/node/postbank-payroll-accounts.mjs
@@ -13,8 +13,8 @@ export async function ensurePayrollCurrentAccount(tx,recipient,{now=Date.now(),m
if(!entity||entity.kind!=='person'||Number(entity.active)!==1)throw Error('Personal banking identity needs review.');
let client=await tx.first('SELECT client_number FROM pb_clients WHERE entity_id=? FOR UPDATE',[id]);
if(client){
- const accounts=await tx.query('SELECT id,type_code,state,system_key FROM pb_accounts WHERE client_number=? ORDER BY id FOR UPDATE',[client.client_number]);
- const suitable=accounts.find(a=>!a.system_key&&a.state==='active'&&['102','108'].includes(a.type_code));
+ const accounts=await tx.query('SELECT a.id,a.type_code,a.state,a.system_key,p.state package_state FROM pb_accounts a LEFT JOIN pb_packages p ON p.id=a.package_id WHERE a.client_number=? ORDER BY a.id FOR UPDATE',[client.client_number]);
+ const suitable=accounts.find(a=>!a.system_key&&a.state==='active'&&a.package_state==='active'&&['102','108'].includes(a.type_code));
if(suitable)return {accountId:String(suitable.id),created:false,entityId:id};
// Do not evade an account restriction by opening another salary account.
if(accounts.some(a=>['102','108'].includes(a.type_code)))throw Error('Existing personal current account needs review.');
diff --git a/website/node/postbank-rate-publications.mjs b/website/node/postbank-rate-publications.mjs
new file mode 100644
index 00000000..cc96d547
--- /dev/null
+++ b/website/node/postbank-rate-publications.mjs
@@ -0,0 +1,51 @@
+import {spawn} from 'node:child_process';import {fileURLToPath} from 'node:url';import {randomUUID} from 'node:crypto';
+import {queueRatesPublication} from './postbank-financial-policy.mjs';
+export async function ensureRatesPublication(db,actorId,now=Date.now()){
+ return db.transaction(async tx=>{
+ await tx.query("INSERT INTO pb_financial_policies(policy_key,policy_json,version,updated_by,updated_at) VALUES('publication_guard','{}',0,?,?) ON DUPLICATE KEY UPDATE policy_key=VALUES(policy_key)",[actorId,now]);
+ await tx.first("SELECT policy_key FROM pb_financial_policies WHERE policy_key='publication_guard' FOR UPDATE");
+ const existing=await tx.first('SELECT id FROM pb_rate_publications ORDER BY created_at DESC,id DESC LIMIT 1 FOR UPDATE');
+ return existing?.id||await queueRatesPublication(tx,actorId,now);
+ });
+}
+export function renderRatesPDF(snapshot,{python='python3',logo=fileURLToPath(new URL('../web/assets/imperial-postbank-v2.png',import.meta.url))}={}){
+ return new Promise((resolve,reject)=>{
+ const child=spawn(python,[fileURLToPath(new URL('./postbank-rates-pdf.py',import.meta.url)),...(logo?[logo]:[])],{stdio:['pipe','pipe','pipe'],windowsHide:true}),chunks=[];let size=0,settled=false;
+ const finish=(error,value)=>{if(settled)return;settled=true;clearTimeout(timer);error?reject(error):resolve(value);};
+ const timer=setTimeout(()=>{child.kill();finish(Error('Tariff PDF rendering timed out.'));},30000);
+ child.stdout.on('data',chunk=>{size+=chunk.length;if(size>2000000){child.kill();finish(Error('Tariff PDF exceeds the size limit.'));}else chunks.push(chunk);});
+ child.stderr.resume();child.stdin.on('error',()=>{});child.on('error',()=>finish(Error('Tariff PDF renderer unavailable.')));
+ child.on('close',code=>{const pdf=Buffer.concat(chunks);if(code!==0||!pdf.subarray(0,5).equals(Buffer.from('%PDF-')))finish(Error('Tariff PDF could not be rendered.'));else finish(null,pdf);});
+ child.stdin.end(JSON.stringify(snapshot));
+ });
+}
+export class PostbankRatePublications{
+ constructor(db,{clock=Date.now,renderer=renderRatesPDF,...options}={}){this.db=db;this.clock=clock;this.renderer=snapshot=>renderer(snapshot,options);}
+ async process(){
+ const token=randomUUID(),now=this.clock(),row=await this.db.transaction(async tx=>{
+ const next=await tx.first("SELECT id,data_json FROM pb_rate_publications WHERE state<>'ready' AND lease_until<=? AND retry_at<=? ORDER BY created_at,id LIMIT 1 FOR UPDATE",[now,now]);
+ if(!next)return null;await tx.query("UPDATE pb_rate_publications SET lease_token=?,lease_until=?,state='rendering' WHERE id=?",[token,now+60000,next.id]);return next;
+ });
+ if(!row)return {generated:0,failed:0};
+ try{const pdf=await this.renderer(JSON.parse(row.data_json));
+ const result=await this.db.query("UPDATE pb_rate_publications SET pdf_blob=?,state='ready',lease_token='',lease_until=0,retry_at=0 WHERE id=? AND lease_token=?",[pdf,row.id,token]);return {generated:result.affectedRows?1:0,failed:0};
+ }catch{await this.db.query("UPDATE pb_rate_publications SET state='pending',lease_token='',lease_until=0,retry_at=? WHERE id=? AND lease_token=?",[this.clock()+300000,row.id,token]);return {generated:0,failed:1};}
+ }
+ async publicResponse(request){
+ const url=new URL(request.url),headers={'Access-Control-Allow-Origin':'*','Cache-Control':'no-store','X-Content-Type-Options':'nosniff'};
+ const reply=(body,status=200)=>Response.json(body,{status,headers});
+ if(!['GET','HEAD'].includes(request.method))return reply({message:'Method not allowed.'},405);
+ if([...url.searchParams.keys()].some(k=>k!=='version')||url.searchParams.getAll('version').length>1)return reply({message:'Choose one publication version.'},400);
+ const version=url.searchParams.get('version');if(version&&!/^[a-f0-9-]{36}$/i.test(version))return reply({message:'Invalid publication version.'},400);
+ try{
+ const row=await this.db.first('SELECT id,data_json,state FROM pb_rate_publications '+(version?'WHERE id=? ':'')+'ORDER BY created_at DESC,id DESC LIMIT 1',version?[version]:[]);
+ if(!row)return reply({message:'The public tariff register is being prepared.'},503);
+ if(url.pathname.endsWith('.pdf')){
+ if(row.state!=='ready')return reply({message:'This publication PDF is being prepared.'},503);
+ const ready=await this.db.first("SELECT pdf_blob FROM pb_rate_publications WHERE id=? AND state='ready'",[row.id]);if(!ready?.pdf_blob)return reply({message:'The publication PDF is unavailable.'},503);
+ return new Response(request.method==='HEAD'?null:ready.pdf_blob,{headers:{...headers,'Content-Type':'application/pdf','Content-Disposition':'attachment; filename="imperial-postbank-rates-'+row.id+'.pdf"'}});
+ }
+ return reply({...JSON.parse(row.data_json),pdfReady:row.state==='ready',pdfUrl:'/api/bank/public/rates.pdf?version='+row.id});
+ }catch{return reply({message:'The tariff register could not be loaded.'},503);}
+ }
+}
diff --git a/website/node/postbank-rates-pdf.py b/website/node/postbank-rates-pdf.py
new file mode 100644
index 00000000..1e18016a
--- /dev/null
+++ b/website/node/postbank-rates-pdf.py
@@ -0,0 +1,70 @@
+"""Render an immutable public game-bank tariff snapshot; JSON in, PDF out."""
+import io
+import json
+import os
+import sys
+from datetime import datetime
+from zoneinfo import ZoneInfo
+from xml.sax.saxutils import escape
+import reportlab
+from PIL import Image
+from reportlab.lib.utils import ImageReader
+from reportlab.lib import colors
+from reportlab.lib.pagesizes import A4
+from reportlab.lib.styles import ParagraphStyle
+from reportlab.pdfbase import pdfmetrics
+from reportlab.pdfbase.ttfonts import TTFont
+from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
+
+def render(data,logo=None):
+ fonts=os.path.join(os.path.dirname(reportlab.__file__),'fonts')
+ regular=os.path.join(fonts,'Vera.ttf');bold=os.path.join(fonts,'VeraBd.ttf')
+ if not os.path.isfile(regular):
+ regular='/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf';bold='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf'
+ pdfmetrics.registerFont(TTFont('Rates',regular))
+ pdfmetrics.registerFont(TTFont('RatesBold',bold))
+ pdfmetrics.registerFontFamily('Rates',normal='Rates',bold='RatesBold',italic='Rates',boldItalic='RatesBold')
+ green=colors.HexColor('#173c30');gold=colors.HexColor('#af914c');ink=colors.HexColor('#243e34')
+ body=ParagraphStyle('RatesBody',fontName='Rates',fontSize=9,leading=13,textColor=ink,spaceAfter=8)
+ title=ParagraphStyle('RatesTitle',fontName='RatesBold',fontSize=25,leading=30,textColor=green,spaceAfter=15)
+ heading=ParagraphStyle('RatesHeading',fontName='RatesBold',fontSize=14,leading=19,textColor=green,spaceBefore=10,spaceAfter=7)
+ small=ParagraphStyle('RatesSmall',parent=body,fontSize=7.5,leading=11)
+ p=lambda text,style=body:Paragraph(escape(str(text)),style)
+ cash=lambda n:f'{int(n)//100:,}.{int(n)%100:02d} DM'
+ percent=lambda n:f'{int(n)/100:.2f}%'
+ published=datetime.fromtimestamp(data['publishedAt']/1000,ZoneInfo('Europe/Brussels')).strftime('%d %B %Y %H:%M')
+ logo_image=None
+ if logo and os.path.isfile(logo):
+ with Image.open(logo) as image:
+ image=image.convert('RGBA');image.thumbnail((720,200));logo_image=ImageReader(image.copy())
+ output=io.BytesIO();document=SimpleDocTemplate(output,pagesize=A4,leftMargin=42,rightMargin=42,topMargin=101,bottomMargin=61,title='Imperial Postbank - Rates & Charges',author='Imperial Postbank')
+ def frame(canvas,doc):
+ w,h=A4;canvas.setFillColor(green);canvas.rect(0,h-80,w,80,fill=1,stroke=0)
+ if logo_image:canvas.drawImage(logo_image,42,h-66,width=163,height=45,preserveAspectRatio=True,mask='auto')
+ else:canvas.setFillColor(colors.white);canvas.setFont('RatesBold',18);canvas.drawString(42,h-44,'Imperial Postbank')
+ canvas.setFillColor(colors.HexColor('#eedca7'));canvas.setFont('RatesBold',10);canvas.drawRightString(w-42,h-36,'RATES & CHARGES');canvas.setFont('Rates',8);canvas.drawRightString(w-42,h-54,published+' - Brussels')
+ canvas.setStrokeColor(gold);canvas.line(42,47,w-42,47);canvas.setFillColor(ink);canvas.setFont('Rates',7);canvas.drawString(42,33,'DuneRealms | Fictional game currency | No real-world banking product');canvas.drawRightString(w-42,33,'Page '+str(doc.page))
+ def grid(headers,rows,widths):
+ table=Table([[p(c,small) for c in headers]]+[[p(c,small) for c in row]for row in rows],colWidths=widths,repeatRows=1,hAlign='LEFT')
+ table.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),colors.HexColor('#e4ece5')),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,colors.HexColor('#f5f7f3')]),('VALIGN',(0,0),(-1,-1),'TOP'),('LINEBELOW',(0,0),(-1,0),1,gold),('LINEBELOW',(0,1),(-1,-1),.3,colors.HexColor('#d8e0d5')),('LEFTPADDING',(0,0),(-1,-1),9),('RIGHTPADDING',(0,0),(-1,-1),9),('TOPPADDING',(0,0),(-1,-1),6),('BOTTOMPADDING',(0,0),(-1,-1),6)]));return table
+ story=[p('Rates & Charges',title),p('Public tariff register for Imperial Postbank. All amounts are Dunemarks (DM), a fictional game currency.'),p('Publication '+data['version']+' | '+published,small),p('Account packages',heading)]
+ story.append(grid(['Package','Monthly charge','Additional current account'],[[r['name'],cash(r['monthlyMinor']),cash(r['extraMinor'])]for r in data['packages']],[180,150,181]))
+ story.append(p('Existing accepted package prices remain recorded on each contract. Published changes apply to new package acceptance; changing an existing package requires confirmation.',small))
+ story.append(p('Services & payment processing',heading))
+ for notice in data.get('serviceNotices',[]):story.append(p(notice))
+ story.extend([PageBreak(),p('Credit interest',title)]);story.append(grid(['Product','Annual interest','Availability'],[[r['name'],percent(r['annualBps']),r.get('availability','Subject to approval')]for r in data['credit']],[240,110,161]))
+ story.append(p('Accepted credit contracts keep their agreed interest rate and repayment schedule. Grants remain interest-free.',small))
+ story.extend([PageBreak(),p('Taxes & deductions',title),p('These are DuneRealms game rules. The payroll model uses selected Belgian-inspired parameters; it is not a personal tax calculation or a Belgian payslip.'),p('Account & transaction taxes',heading)])
+ taxes=data['taxes'];story.append(grid(['Tax','Rate'],[['VAT on applicable game sales',percent(taxes['vatBps'])],['VAT on bank fees',percent(taxes['bankFeeVatBps'])],['Monthly account tax',cash(taxes['monthlyAccountTaxMinor'])]],[350,161]))
+ tax=data['payrollTax'];story.append(p('Payroll contributions',heading));story.append(grid(['Contribution','Rate'],[['Employee social contribution',percent(tax['employeeSocialBps'])],['Employer social contribution',percent(tax['employerSocialBps'])],['Annual basic allowance',cash(tax['annualAllowanceMinor'])]],[350,161]))
+ bands=[];start=0
+ for b in tax['bands']:
+ bands.append([cash(start)+' to '+cash(b['upToMinor']) if b['upToMinor']is not None else 'Above '+cash(start),percent(b['bps'])]);start=b['upToMinor']
+ story.append(p('Annual progressive payroll income tax',heading));story.append(grid(['Taxable annual band','Rate'],bands,[350,161]))
+ story.append(p('The basic allowance is applied as a tax credit. Household circumstances, regional additions, work bonuses and other real-world deductions are outside this fictional model. Individual staff salaries are private and are not included here.',small))
+ story.append(p('Destinations & transparency',heading));story.append(p('Bank service charges go to the Website bank treasury. Game taxes and payroll deductions go to I.D. Taxes. Posted entries remain in the relevant account ledgers.'))
+ story.append(p('Sources for the selected payroll parameters',heading))
+ for source in tax.get('sources',[]):story.append(p(source,small))
+ document.build(story,onFirstPage=frame,onLaterPages=frame);return output.getvalue()
+
+if __name__=='__main__':sys.stdout.buffer.write(render(json.load(sys.stdin),sys.argv[1]if len(sys.argv)>1 else None))
diff --git a/website/scripts/bank-rates-page.mjs b/website/scripts/bank-rates-page.mjs
index fcffd8a9..a2c9215a 100644
--- a/website/scripts/bank-rates-page.mjs
+++ b/website/scripts/bank-rates-page.mjs
@@ -6,5 +6,5 @@ export function bankRatesPage(){
const version=createHash('sha256').update(JSON.stringify([PACKAGES,CREDIT_PRODUCTS])).digest('hex').slice(0,10);
const packages=PACKAGES.map(p=>`
¹ Published additional-account limits and prices, subject to feature availability. Flow includes a savings account. Start has no instant payments. Instant quotas are server usage limits.
02 / BORROWING
Credit rates
Annual rates for new applications. Your accepted contract and repayment schedule govern your loan.
Product
Annual rate
Principal range
Available terms
${credit}
Launch grants are repayable at 0% interest. Ordinary loans require review and 25% blocked DM collateral. Eligibility, available funding and refinancing conditions apply. Existing fixed-rate contracts retain their agreed rate. Revolving credit is not available.
03 / TRANSPARENCY
Services & taxes
Monthly statements
Free
Automatically archived PDF statements after month-end.
Balance Guard
1.00 DM / month
Published optional price per eligible account. Preference saving is available; protection and charging are not active yet.
Tax policy
Not yet published
VAT and account-tax rates await central configuration. No unconfirmed rate is presented as active.
Your tariff guide
Generated from the bank catalogues on each build. Version ${version}. Package terms: ${BANK_VERSION}. Credit terms: ${CREDIT_VERSION}.
Catalogue references identify source terms, not a new effective date. Administrative rate editing and automatic downloadable PDF publication are planned. You can print or save this guide as PDF now.
No private account or transaction data is published here.
¹ Published additional-account limits and prices, subject to feature availability. Flow includes a savings account. Start has no instant payments. Instant quotas are server usage limits.
02 / BORROWING
Credit rates
Annual rates for new applications. Your accepted contract and repayment schedule govern your loan.
Product
Annual rate
Principal range
Available terms
${credit}
Launch grants are repayable at 0% interest. Ordinary loans require review and 25% blocked DM collateral. Eligibility, available funding and refinancing conditions apply. Existing fixed-rate contracts retain their agreed rate. Revolving credit is not available.
03 / TRANSPARENCY
Services & taxes
Monthly statements
Free
Automatically archived PDF statements after month-end.
Balance Guard
1.00 DM / month
Published optional price per eligible account. Preference saving is available; protection and charging are not active yet.
Tax policy
Not yet published
VAT and account-tax rates await central configuration. No unconfirmed rate is presented as active.
Your tariff guide
Generated from the bank catalogues on each build. Version ${version}. Package terms: ${BANK_VERSION}. Credit terms: ${CREDIT_VERSION}.
Catalogue references identify source terms, not a new effective date. Administrative rate editing and automatic downloadable PDF publication are planned. You can print or save this guide as PDF now.
No private account or transaction data is published here.
`;
}
diff --git a/website/scripts/rollout-postbank-payroll.mjs b/website/scripts/rollout-postbank-payroll.mjs
index 1980ec0d..94c03729 100644
--- a/website/scripts/rollout-postbank-payroll.mjs
+++ b/website/scripts/rollout-postbank-payroll.mjs
@@ -3,6 +3,7 @@ import {openDatabase} from '../node/mysql.mjs';import {openPostbankDatabase} fro
import {canRunScheduler} from '../node/scheduler-authority.mjs';import {PostbankPayroll} from '../node/postbank-payroll.mjs';
import {PostbankFinancialPolicies} from '../node/postbank-financial-policy.mjs';import {createPostbankAuthority} from '../node/postbank-authority.mjs';
import {randomUUID} from 'node:crypto';
+import {ensureRatesPublication,PostbankRatePublications} from '../node/postbank-rate-publications.mjs';
if(process.argv[1]&&fileURLToPath(import.meta.url)===resolve(process.argv[1])){
const central=await openDatabase(process.env),bank=await openPostbankDatabase(process.env);
try{
@@ -11,6 +12,9 @@ if(process.argv[1]&&fileURLToPath(import.meta.url)===resolve(process.argv[1])){
const payroll=new PostbankPayroll(central,bank),preview=await payroll.overview();
if(!process.argv.includes('--apply'))console.log(JSON.stringify({plan:true,eligibleStaff:preview.eligibleCount,enabled:preview.policy.value.enabled,payDay:preview.policy.value.payDay,missingAccountPackage:'pb_start',missingAccountType:'108'}));
else{
+ const publication=await ensureRatesPublication(bank,user.id),publisher=new PostbankRatePublications(bank,{python:process.env.POSTBANK_PYTHON,logo:process.env.POSTBANK_STATEMENT_LOGO});
+ for(let i=0;i<20;i++){const row=await bank.first('SELECT state FROM pb_rate_publications WHERE id=?',[publication]);if(row?.state==='ready')break;const result=await publisher.process();if(result.failed||!result.generated)throw Error('The tariff publication must be ready before payroll rollout. Retry after checking the publication worker.');}
+ if((await bank.first('SELECT state FROM pb_rate_publications WHERE id=?',[publication]))?.state!=='ready')throw Error('Tariff publication is not ready.');
if(!preview.policy.value.enabled)await new PostbankFinancialPolicies(bank,central,createPostbankAuthority(central,{bank})).save(user,'payroll',{requestId:randomUUID(),version:preview.policy.version,value:{...preview.policy.value,enabled:true},reason:'Owner-authorised P&O rollout and initial payroll tick',confirmed:true});
console.log(JSON.stringify(await payroll.process({rollout:true})));
}
diff --git a/website/tests/cp-v2-module-routing.test.mjs b/website/tests/cp-v2-module-routing.test.mjs
new file mode 100644
index 00000000..09eaf64f
--- /dev/null
+++ b/website/tests/cp-v2-module-routing.test.mjs
@@ -0,0 +1,9 @@
+import {test} from 'node:test';import assert from 'node:assert/strict';import {readdirSync} from 'node:fs';
+import {createPanel} from '../control-panel/server.mjs';import {LocalD1} from './d1-adapter.mjs';
+test('every shipped CP browser component is reachable through the actual panel router',async()=>{
+ const db=new LocalD1(),app=createPanel(db);try{
+ const files=readdirSync(new URL('../control-panel/public/cp-v2/',import.meta.url)).filter(name=>/^cp-v2-[a-z0-9-]+\.mjs$/.test(name));
+ for(const file of files){const response=await app(new Request('https://cp.dunerealms.com/v2/'+file));assert.equal(response.status,200,file);assert.match(response.headers.get('Content-Type'),/javascript/);assert((await response.text()).length>0,file);}
+ for(const path of ['/v2/cp-v2-missing.mjs','/v2/../server.mjs','/v2/cp-v2-..%2fserver.mjs','/v2/cp-v2-x.env'])assert.equal((await app(new Request('https://cp.dunerealms.com'+path))).status,404,path);
+ }finally{db.close();}
+});
diff --git a/website/tests/postbank-credit-ui.test.mjs b/website/tests/postbank-credit-ui.test.mjs
index 085e1aad..55521588 100644
--- a/website/tests/postbank-credit-ui.test.mjs
+++ b/website/tests/postbank-credit-ui.test.mjs
@@ -1,8 +1,8 @@
import {randomUUID} from 'node:crypto';import {BankFixture} from './postbank-fixture.mjs';import {PostbankService} from '../node/postbank-service.mjs';import {PostbankCredit} from '../node/postbank-credit.mjs';import {BANK_VERSION} from '../node/postbank-catalogue.mjs';import {CREDIT_VERSION} from '../node/postbank-credit-model.mjs';
import test from 'node:test';import assert from 'node:assert/strict';import {mountPostbankCredit,creditTheme} from '../control-panel/public/cp-v2/cp-v2-postbank-credit.mjs';
-class Node{constructor(tag){this.tagName=tag.toUpperCase();this.children=[];this.attrs={};this.classList={add:()=>{}};this.value='';this.disabled=false;this.dataset={};this._text='';}set textContent(v){this._text=String(v);this.children=[];}get textContent(){return this._text+this.children.map(n=>n.textContent).join('');}append(...nodes){for(const n of nodes){n.parent=this;this.children.push(n);if(this.tagName==='SELECT'&&!this.value)this.value=n.value;}}prepend(...nodes){for(const n of nodes)n.parent=this;this.children.unshift(...nodes);}get elements(){return all(this).filter(n=>['INPUT','SELECT','TEXTAREA','BUTTON'].includes(n.tagName));}replaceChildren(...nodes){this._text='';this.children=[];this.append(...nodes);}setAttribute(k,v){this.attrs[k]=String(v);}closest(){return null;}remove(){if(this.parent)this.parent.children=this.parent.children.filter(n=>n!==this);}focus(){}reportValidity(){return true;}}
+class Node{constructor(tag){this.tagName=tag.toUpperCase();this.children=[];this.attrs={};this.classList={add:()=>{}};this.value='';this.disabled=false;this.dataset={};this._text='';}set textContent(v){this._text=String(v);this.children=[];}get textContent(){return this._text+this.children.map(n=>n.textContent).join('');}append(...nodes){for(const n of nodes){n.parent=this;this.children.push(n);if(this.tagName==='SELECT'&&!this.value)this.value=n.value;}}prepend(...nodes){for(const n of nodes)n.parent=this;this.children.unshift(...nodes);}get firstElementChild(){return this.children[0]||null;}get elements(){return all(this).filter(n=>['INPUT','SELECT','TEXTAREA','BUTTON'].includes(n.tagName));}replaceChildren(...nodes){this._text='';this.children=[];this.append(...nodes);}setAttribute(k,v){this.attrs[k]=String(v);}closest(){return null;}remove(){if(this.parent)this.parent.children=this.parent.children.filter(n=>n!==this);}focus(){}reportValidity(){return true;}}
const all=n=>n.children.flatMap(c=>[c,...all(c)]),settle=async()=>{for(let i=0;i<6;i++)await new Promise(r=>setImmediate(r));};
-async function fixture(run,{enabled=false,uncertain=false,validateApplication=null,includeGrant=false}={}){const prior=globalThis.document;globalThis.document={createElement:t=>new Node(t),createElementNS:(ns,t)=>new Node(t)};let applyAttempts=0;const host=new Node('div'),calls=[],products=[...(includeGrant?[{key:'grant_start',name:'Launch Start',group:'grants',kinds:['person'],amount:'2500.00',annualBps:0}]:[]),{key:'personal_loan',name:'Personal Loan',group:'personal',kinds:['person'],min:'1000.00',max:'25000.00',annualBps:839,terms:[3,6]},{key:'business_loan',name:'Business Loan',group:'professional',kinds:['clan'],min:'5000.00',max:'100000.00',annualBps:450,terms:[6,12]}],accounts=[{id:'1',name:'Personal current',number:'DR25102000000005',kind:'person',canApply:true},{id:'2',name:'Clan current',number:'DR14105000000004',kind:'clan',canApply:true}],fetcher=async(path,options={})=>{calls.push({path,...options});if(path.endsWith('/apply')&&validateApplication){try{const result=await validateApplication(JSON.parse(options.body));if(!uncertain||applyAttempts++>0)return Response.json(result);}catch(error){return Response.json({message:error.message},{status:error.status||400});}}if(path.endsWith('/apply')&&uncertain&&applyAttempts++===0)return Response.json({message:'Uncertain result'},{status:503});return Response.json(path.endsWith('/simulate')?{quote:{monthly:'100.00',annualRate:'8.39',months:12,totalInterest:'200.00',totalRepayment:'1200.00',schedule:[]},collateral:'250.00',notice:'No financial change'}:{accounts,products,loans:[],intakeEnabled:enabled,termsVersion:CREDIT_VERSION});};const dispose=mountPostbankCredit(host,'loan-centre',{fetcher});try{await settle();await run({host,calls,nodes:()=>all(host)});}finally{dispose();globalThis.document=prior;}}
+async function fixture(run,{enabled=false,uncertain=false,validateApplication=null,includeGrant=false,loans=[],pageId="loan-centre"}={}){const prior=globalThis.document;globalThis.document={createElement:t=>new Node(t),createElementNS:(ns,t)=>new Node(t)};let applyAttempts=0;const host=new Node('div'),calls=[],products=[...(includeGrant?[{key:'grant_start',name:'Launch Start',group:'grants',kinds:['person'],amount:'2500.00',annualBps:0}]:[]),{key:'personal_loan',name:'Personal Loan',group:'personal',kinds:['person'],min:'1000.00',max:'25000.00',annualBps:839,terms:[3,6]},{key:'business_loan',name:'Business Loan',group:'professional',kinds:['clan'],min:'5000.00',max:'100000.00',annualBps:450,terms:[6,12]}],accounts=[{id:'1',name:'Personal current',number:'DR25102000000005',kind:'person',canApply:true},{id:'2',name:'Clan current',number:'DR14105000000004',kind:'clan',canApply:true}],fetcher=async(path,options={})=>{calls.push({path,...options});if(path.includes('/details?'))return Response.json({quote:{annualRate:'0.00',totalRepayment:'10000.00'},collateral:'0.00',settlement:'10000.00',schedule:[],state:'disbursed'});if(path.endsWith('/apply')&&validateApplication){try{const result=await validateApplication(JSON.parse(options.body));if(!uncertain||applyAttempts++>0)return Response.json(result);}catch(error){return Response.json({message:error.message},{status:error.status||400});}}if(path.endsWith('/apply')&&uncertain&&applyAttempts++===0)return Response.json({message:'Uncertain result'},{status:503});return Response.json(path.endsWith('/simulate')?{quote:{monthly:'100.00',annualRate:'8.39',months:12,totalInterest:'200.00',totalRepayment:'1200.00',schedule:[]},collateral:'250.00',notice:'No financial change'}:{accounts,products,loans,intakeEnabled:enabled,termsVersion:CREDIT_VERSION});};const dispose=mountPostbankCredit(host,pageId,{fetcher});try{await settle();await run({host,calls,nodes:()=>all(host)});}finally{dispose();globalThis.document=prior;}}
test('borrowing tabs filter product cards and simulation replaces the catalogue rather than appearing below it',()=>fixture(async({nodes,calls})=>{const tabs=nodes().filter(n=>n.attrs.role==='tab');assert.equal(tabs.length,2);assert.equal(nodes().filter(n=>n.tagName==='SELECT').length,0);assert.ok(nodes().some(n=>n.className?.includes('pb-choice-card')&&n.className.includes('pb-plan-flow')));tabs[1].onclick();assert.ok(nodes().some(n=>n.tagName==='H5'&&n.textContent==='Business Loan'));assert.ok(!nodes().some(n=>n.tagName==='H5'&&n.textContent==='Personal Loan'));nodes().find(n=>n.tagName==='BUTTON'&&n.textContent==='Simulate repayments').onclick();assert.ok(!nodes().some(n=>n.className?.includes('pb-credit-products')));assert.ok(nodes().some(n=>n.className==='pb-credit-calculator'));const form=nodes().find(n=>n.tagName==='FORM');await form.onsubmit({preventDefault(){}});assert.equal(JSON.parse(calls.find(c=>c.method==='POST').body).accountId,'2');assert.ok(nodes().some(n=>n.className==='pb-credit-monthly'&&n.textContent==='100.00 DM'));nodes().find(n=>n.tagName==='INPUT').oninput();assert.ok(!nodes().some(n=>n.className==='pb-credit-monthly'));nodes().find(n=>n.tagName==='BUTTON'&&n.textContent.startsWith('← Back')).onclick();assert.ok(nodes().some(n=>n.tagName==='H5'&&n.textContent==='Business Loan'));assert.equal(calls.filter(c=>c.method==='POST').length,1);}));
test('credit groups reuse the banking package palette',()=>{assert.equal(creditTheme({key:'grant_start'}),'start');assert.equal(creditTheme({key:'grant_build'}),'connect');assert.equal(creditTheme({key:'grant_advance'}),'scale');assert.equal(creditTheme({key:'business_loan'}),'connect');assert.equal(creditTheme({key:'civic_loan'}),'civic');assert.equal(creditTheme({key:'personal_refinance',group:'refinancing'}),'scale');});
@@ -13,3 +13,12 @@ test('bank oversight menus require staff view permission rather than ordinary pe
test('the real credit form payload is accepted by the strict application service without stray confirmation fields',async()=>{const db=new BankFixture(),user={id:randomUUID(),username:'UI contract borrower'},entity={id:randomUUID(),kind:'person',key:user.id,name:user.username},authority=async()=>({entities:[{...entity,canView:true,canActivate:true,canPay:true}]});try{await new PostbankService(db,authority).activate(user,{entityId:entity.id,packageKey:'pb_flow',termsVersion:BANK_VERSION,accepted:true,requestId:randomUUID()});const credit=new PostbankCredit(db,authority);await fixture(async({nodes,calls})=>{nodes().find(n=>n.tagName==='BUTTON'&&n.textContent==='Simulate repayments').onclick();await nodes().find(n=>n.tagName==='FORM').onsubmit({preventDefault(){}});const form=nodes().find(n=>n.className==='pb-credit-action-form');all(form).find(n=>n.tagName==='TEXTAREA').value='Testing the new submitted credit flow';all(form).find(n=>n.type==='checkbox').checked=true;await form.onsubmit({preventDefault(){}});const payload=JSON.parse(calls.find(c=>c.path.endsWith('/apply')).body);assert.equal(Object.hasOwn(payload,'confirmed'),false);assert.equal(payload.accepted,true);assert.equal((await db.first('SELECT COUNT(*) n FROM pb_credit_loans')).n,1);assert.equal((await db.first('SELECT COUNT(*) n FROM pb_orders')).n,0);assert.ok(nodes().some(n=>!n.hidden&&n.textContent.includes('Application recorded for bank review.')));},{enabled:true,validateApplication:body=>credit.apply(user,body)});}finally{db.close();}});
test('autoaccepted grants show no motivation field and submit without a motivation property',()=>fixture(async({nodes,calls})=>{nodes().find(n=>n.tagName==='BUTTON'&&n.textContent==='Simulate repayments').onclick();await nodes().find(n=>n.tagName==='FORM').onsubmit({preventDefault(){}});assert.equal(nodes().filter(n=>n.tagName==='TEXTAREA').length,0);const form=nodes().find(n=>n.className==='pb-credit-action-form');all(form).find(n=>n.type==='checkbox').checked=true;await form.onsubmit({preventDefault(){}});const payload=JSON.parse(calls.find(c=>c.path.endsWith('/apply')).body);assert.equal(payload.productKey,'grant_start');assert.equal(Object.hasOwn(payload,'motivation'),false);assert.equal(payload.accepted,true);},{enabled:true,includeGrant:true}));
+
+test('expanding a personal loan uses the full table width and collapses cleanly',()=>fixture(async({nodes})=>{
+ const expand=nodes().find(n=>n.tagName==='DETAILS'),row=nodes().find(n=>n.className==='pb-credit-detail-row');
+ assert(row);assert.equal(row.hidden,true);assert.equal(row.firstElementChild.colSpan,7);
+ expand.open=true;await expand.ontoggle();assert.equal(row.hidden,false);
+ assert(row.textContent.includes('Settlement estimate today: 10000.00 DM'));
+ assert.equal(expand.children.length,1);
+ expand.open=false;await expand.ontoggle();assert.equal(row.hidden,true);
+},{pageId:'bank-loans',loans:[{id:'loan-1',productKey:'grant_advance',state:'disbursed',principal:'10000.00',outstanding:'10000.00',monthly:'834.00'}]}));
diff --git a/website/tests/postbank-payroll-accounts.test.mjs b/website/tests/postbank-payroll-accounts.test.mjs
index 85600204..e90e106e 100644
--- a/website/tests/postbank-payroll-accounts.test.mjs
+++ b/website/tests/postbank-payroll-accounts.test.mjs
@@ -9,7 +9,7 @@ function fixture(accounts=[],hasClient=true){
};
}
test('payroll reuses an existing personal current account without opening a package',async()=>{
- const tx=fixture([{id:19,type_code:'102',state:'active',system_key:null}]);
+ const tx=fixture([{id:19,type_code:'102',state:'active',package_state:'active',system_key:null}]);
const result=await ensurePayrollCurrentAccount(tx,recipient);
assert.equal(result.accountId,'19');assert.equal(result.created,false);
assert.equal(tx.writes.some(w=>w.sql.includes('INSERT INTO pb_packages')),false);
@@ -34,3 +34,8 @@ test('an official account is not selected as the personal salary destination',as
const result=await ensurePayrollCurrentAccount(tx,recipient);
assert.equal(result.created,true);assert.equal(result.accountId,'77');
});
+test('an inactive package cannot be bypassed by reusing its otherwise active account',async()=>{
+ const tx=fixture([{id:19,type_code:'108',state:'active',package_state:'closed',system_key:null}]);
+ await assert.rejects(ensurePayrollCurrentAccount(tx,recipient),/needs review/);
+ assert.equal(tx.writes.some(w=>w.sql.includes('INSERT INTO pb_packages')),false);
+});
diff --git a/website/tests/postbank-rate-publications.test.mjs b/website/tests/postbank-rate-publications.test.mjs
new file mode 100644
index 00000000..64ebaaaf
--- /dev/null
+++ b/website/tests/postbank-rate-publications.test.mjs
@@ -0,0 +1,30 @@
+import {test} from 'node:test';import assert from 'node:assert/strict';import {BankFixture} from './postbank-fixture.mjs';
+import {PostbankRatePublications,ensureRatesPublication} from '../node/postbank-rate-publications.mjs';import {queueRatesPublication} from '../node/postbank-financial-policy.mjs';
+import {createPostbankApi} from '../node/postbank-api.mjs';
+const actor='00000000-0000-4000-8000-000000000001',request=path=>new Request('https://cp.dunerealms.com/api/bank/public/'+path);
+test('the tariff register is anonymous and does not invoke account authentication',async()=>{
+ const db=new BankFixture();try{await ensureRatesPublication(db,actor,100);let calls=0;const api=createPostbankApi({},db,{}, {authenticate:async()=>{calls++;return null;}});const response=await api(request('rates'));assert.equal(response.status,200);assert.equal(calls,0);assert.equal(response.headers.get('Access-Control-Allow-Origin'),'*');}finally{db.close();}
+});
+test('public register publishes immutable versioned PDFs without private payroll wages',async()=>{
+ const db=new BankFixture();try{
+ const id=await ensureRatesPublication(db,actor,100),publisher=new PostbankRatePublications(db,{clock:()=>200,renderer:async()=>Buffer.from('%PDF-test')});
+ assert.equal(await ensureRatesPublication(db,actor,101),id);
+ const before=await publisher.publicResponse(request('rates')),data=await before.json();assert.equal(data.pdfReady,false);assert(!JSON.stringify(data).includes('netMinor'));assert.equal(before.headers.get('Access-Control-Allow-Origin'),'*');
+ assert.equal((await publisher.publicResponse(request('rates.pdf?version='+id))).status,503);
+ assert.equal((await publisher.process()).generated,1);
+ const pdf=await publisher.publicResponse(request('rates.pdf?version='+id));assert.equal(pdf.headers.get('Content-Type'),'application/pdf');assert.equal(await pdf.text(),'%PDF-test');
+ const next=await db.transaction(tx=>queueRatesPublication(tx,actor,100));assert.notEqual(next,id);
+ const latest=await (await publisher.publicResponse(request('rates'))).json();assert.equal(latest.version,next);assert.equal(latest.pdfReady,false);assert(latest.publishedAt>data.publishedAt);
+ assert.equal((await publisher.publicResponse(request('rates.pdf'))).status,503);
+ assert.equal((await publisher.publicResponse(request('rates.pdf?version='+id))).status,200);
+ }finally{db.close();}
+});
+test('worker leases prevent concurrent duplicate rendering and failures remain retryable',async()=>{
+ const db=new BankFixture();try{
+ await ensureRatesPublication(db,actor,100);let broken=true,calls=0;
+ const publisher=new PostbankRatePublications(db,{clock:()=>200,renderer:async()=>{calls++;if(broken)throw Error('Renderer private error');return Buffer.from('%PDF-test');}});
+ const first=await Promise.all([publisher.process(),publisher.process()]);assert.equal(calls,1);assert.equal(first.reduce((n,r)=>n+r.failed,0),1);
+ assert.equal((await publisher.process()).generated,0);broken=false;publisher.clock=()=>400000;assert.equal((await publisher.process()).generated,1);
+ assert.equal((await publisher.publicResponse(request('rates?accountId=1'))).status,400);
+ }finally{db.close();}
+});
diff --git a/website/web/bank-rates.js b/website/web/bank-rates.js
new file mode 100644
index 00000000..ee9030d7
--- /dev/null
+++ b/website/web/bank-rates.js
@@ -0,0 +1,24 @@
+/* Anonymous public register: never sends account cookies or personal data. */
+(()=>{
+ const origin='https://cp.dunerealms.com',money=n=>(Number(n)/100).toFixed(2)+' DM',percent=n=>(Number(n)/100).toFixed(2)+'%';
+ const el=(tag,text)=>{const node=document.createElement(tag);if(text!==undefined)node.textContent=text;return node;};
+ async function load(){
+ const documentBox=document.querySelector('.document'),status=el('p','Loading the current public tariff publication…');documentBox?.append(status);
+ try{
+ const response=await fetch(origin+'/api/bank/public/rates',{credentials:'omit',cache:'no-store'});if(!response.ok)throw Error('Current publication unavailable.');const data=await response.json();
+ document.querySelector('.stamp').textContent='PUBLIC TARIFF REGISTER · '+new Date(data.publishedAt).toLocaleDateString('en-GB',{timeZone:'Europe/Brussels'});
+ for(const row of document.querySelectorAll('#packages tbody tr')){const rate=data.packages.find(p=>p.name===row.children[0].textContent);if(rate){row.children[2].textContent=money(rate.monthlyMinor);if(row.children[4].textContent!=='—')row.children[4].textContent=money(rate.extraMinor);}}
+ for(const row of document.querySelectorAll('#credit tbody tr')){const rate=data.credit.find(p=>p.name===row.children[0].textContent);if(rate)row.children[1].textContent=percent(rate.annualBps);}
+ const notice=document.querySelector('.notice p');if(notice)notice.textContent='All amounts are fictional Dunemarks (DM). '+data.serviceNotices.join(' ');
+ const taxCard=document.querySelector('#services .service-grid article:last-child');if(taxCard){taxCard.replaceChildren(el('h3','Configured game taxes'),el('p','VAT on applicable sales: '+percent(data.taxes.vatBps)),el('p','VAT on bank fees: '+percent(data.taxes.bankFeeVatBps)),el('p','Monthly account tax: '+money(data.taxes.monthlyAccountTaxMinor)),el('small','Collection applies to supported game flows; monthly package billing and Balance Guard availability are disclosed above.'));}
+ const section=el('section');section.id='payroll-tax';section.append(el('span','04 / PEOPLE & ORGANISATION'),el('h2','Payroll contributions & income tax'),el('p','Employee social contribution: '+percent(data.payrollTax.employeeSocialBps)+' · Employer social contribution: '+percent(data.payrollTax.employerSocialBps)),el('p','Annual basic allowance: '+money(data.payrollTax.annualAllowanceMinor)));
+ const wrap=el('div');wrap.className='table-wrap';const table=el('table'),head=el('thead'),header=el('tr'),body=el('tbody');for(const text of ['Annual taxable income','Tax rate'])header.append(el('th',text));head.append(header);let lower=0;
+ for(const band of data.payrollTax.bands){const row=el('tr');row.append(el('td',band.upToMinor===null?'Above '+money(lower):money(lower)+'–'+money(band.upToMinor)),el('td',percent(band.bps)));body.append(row);lower=band.upToMinor;}
+ table.append(head,body);wrap.append(table);section.append(wrap,el('p','Fictional game payroll using selected Belgian-inspired parameters. The basic allowance is a tax credit; individual salaries remain private.'));documentBox.before(section);
+ const description=documentBox.querySelector('div');if(description){description.replaceChildren(el('h2','Download the public tariff guide'),el('p','Publication '+data.version+' · '+new Date(data.publishedAt).toLocaleString('en-GB',{timeZone:'Europe/Brussels'})),el('p','The PDF and live register use the same immutable publication. Accepted loan rates and recorded package prices retain their agreed terms.'));}
+ status.textContent=data.pdfReady?'Current publication verified.':'The current publication PDF is being prepared. Reload shortly.';
+ if(data.pdfReady){const link=el('a','Download Rates & Charges PDF');link.href=origin+data.pdfUrl;link.className='pdf-download';documentBox.append(link);}
+ }catch{status.textContent='Live publication unavailable. Catalogue reference prices are shown; retry before relying on a changed tariff.';}
+ }
+ if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',load,{once:true});else void load();
+})();
diff --git a/website/web/forum-author.css b/website/web/forum-author.css
new file mode 100644
index 00000000..2b9bc7fc
--- /dev/null
+++ b/website/web/forum-author.css
@@ -0,0 +1,10 @@
+/* Public author cards: retain MyBB post content and controls, group identity only. */
+.post:not(.classic) .post_author:has(.dune-author-identity){display:grid!important;grid-template-columns:112px minmax(0,1fr) 190px!important;align-items:start!important;gap:20px!important;min-height:0!important;padding:22px!important;box-sizing:border-box!important;background:linear-gradient(110deg,#163a2cee,#0d2921f5),url('https://www.dunerealms.com/assets/sietch.webp') center/cover!important}
+.post .dune-author-identity{display:flex!important;flex-direction:column!important;align-items:center!important;gap:18px!important;min-width:0!important;padding:15px 10px!important;border:1px solid #a9925d99!important;border-radius:10px!important;background:#0d2a21dd!important;box-sizing:border-box!important;grid-column:1!important;grid-row:1!important}
+.post .dune-author-identity .author_avatar{float:none!important;width:auto!important;margin:0!important;padding:0!important;display:block!important}.post .dune-author-identity .author_avatar img{max-width:72px!important;max-height:72px!important;border-radius:8px!important;object-fit:contain!important}.post .dune-author-clan{width:90px!important;padding-top:12px!important;margin:0!important;border-top:1px solid #8b9a6d55!important;text-align:center!important}.post .dune-author-clan small{display:block!important;font:700 8px/1.4 system-ui!important;letter-spacing:.16em!important;color:#bca66c!important;margin-bottom:9px!important}.post .dune-author-clan img{display:block!important;width:84px!important;height:84px!important;object-fit:contain!important;filter:drop-shadow(0 3px 5px #0005)!important;margin:0 auto!important}
+.post:not(.classic) .post_author:has(.dune-author-identity)>.author_information{float:none!important;width:auto!important;min-width:0!important;max-width:none!important;padding:20px!important;border:1px solid #70856688!important;border-radius:10px!important;background:#14372be8!important;box-sizing:border-box!important;grid-column:2!important;grid-row:1!important}.post .post_author:has(.dune-author-identity) .largetext{font-size:21px!important;line-height:1.4!important}.post .post_author:has(.dune-author-identity) .author_information>.smalltext{display:block!important;font-size:12px!important;line-height:1.6!important;margin-top:6px!important}
+.post .dune-author-recognition,.post .dune-author-bio{display:block!important;border-top:1px solid #8b9a6d44!important;padding-top:13px!important;margin-top:14px!important;max-width:none!important}.post .dune-author-recognition>small,.post .dune-author-bio>small{display:block!important;color:#bca66c!important;font:700 9px/1.5 system-ui!important;letter-spacing:.12em!important;margin-bottom:9px!important}.post .dune-author-awards{display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:10px!important;min-height:0!important}.post .dune-author-awards img{max-width:130px!important;max-height:70px!important;object-fit:contain!important;float:none!important;margin:0!important}.post .dune-author-socials{clear:both!important;gap:4px!important;margin-top:12px!important}.post .dune-author-bio p{margin:0!important;color:#c8d6c3!important;font:12px/1.7 system-ui!important;overflow-wrap:anywhere!important}
+.post:not(.classic) .post_author:has(.dune-author-identity)>.author_statistics{float:none!important;position:static!important;width:auto!important;min-width:0!important;max-width:none!important;padding:18px!important;margin:0!important;border:1px solid #a9925d77!important;border-radius:10px!important;background:#0c291fdc!important;box-sizing:border-box!important;grid-column:3!important;grid-row:1!important;font:12px/1.9 system-ui!important}.post .post_author:has(.dune-author-identity)>.author_statistics::before{content:'ACTIVITY';display:block;margin-bottom:10px;font:700 9px/1.5 system-ui;letter-spacing:.14em;color:#bca66c}
+.post.classic .dune-author-identity{margin-bottom:16px!important}.post.classic .post_author .author_information,.post.classic .post_author .author_statistics{float:none!important;width:auto!important;min-width:0!important;padding:14px!important;margin-bottom:12px!important;border:1px solid #70856688!important;border-radius:8px!important;background:#102e24!important}
+@media(max-width:850px){.post:not(.classic) .post_author:has(.dune-author-identity){grid-template-columns:94px minmax(0,1fr)!important;gap:14px!important;padding:16px!important}.post:not(.classic) .post_author:has(.dune-author-identity)>.author_statistics{grid-column:1/-1!important;grid-row:2!important}.post .dune-author-identity{padding:12px 6px!important}.post .dune-author-clan{width:76px!important}.post .dune-author-clan img{width:72px!important;height:72px!important}.post:not(.classic) .post_author:has(.dune-author-identity)>.author_information{padding:16px!important}}
+@media(max-width:480px){.post:not(.classic) .post_author:has(.dune-author-identity){grid-template-columns:1fr!important}.post:not(.classic) .post_author:has(.dune-author-identity)>.author_information{grid-column:1!important;grid-row:2!important}.post:not(.classic) .post_author:has(.dune-author-identity)>.author_statistics{grid-row:3!important}.post .dune-author-identity{flex-direction:row!important;justify-content:center!important;gap:25px!important}.post .dune-author-clan{border-top:0!important;border-left:1px solid #8b9a6d55!important;padding:0 0 0 18px!important;width:90px!important}}