Phase 2: client military/social screens, WebSocket push, trade + endgame, review findings pending

Built: units/movements/reports/send/expansion screens, alliance/messages/rankings screens, ws client + server /ws push
(docs/PROTOCOL.md), Internet exchange trade, backbone endgame + world end, shared reports, buildDone relative levels.
Tested: npm test 175/175. Two adversarial reviews found issues (trade-leg recall exploit, __proto__ via validate.js,
rankings DoS, static headers, ...): fixes follow in the next commit.
NOT done: bots/balance, e2e suite, real-device checks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-11 19:05:03 +02:00
parent 249818a7aa
commit b18645dca1
87 changed files with 10201 additions and 71 deletions

View file

@ -17,6 +17,9 @@
if (n.type === 'build_done') {
return { icon: 'b-' + p.type, title: App.t('alerts.build_done', { name: App.buildingName(p.type), level: p.level }), detail: App.t('alerts.build_done.in', { town: townName(p.townId) }), go: 'pop' };
}
// Other screens describe their own notification types: App.alertKinds[type] = (n, p) => ({ icon, title, detail, go, params })
const ext = App.alertKinds && App.alertKinds[n.type];
if (ext) return ext(n, p);
return { icon: 'bell', title: App.t('alerts.unknown', { type: n.type }), detail: '', go: null };
}
@ -28,7 +31,7 @@
const d = describe(n);
const isNew = n.id > seenAtOpen;
listEl.appendChild(h('li', null,
h('button', { class: 'alert' + (isNew ? ' new' : ''), type: 'button', onclick: () => { if (d.go) App.go(d.go); } },
h('button', { class: 'alert' + (isNew ? ' new' : ''), type: 'button', onclick: () => { if (d.go) App.go(d.go, d.params); } },
h('span', { class: 'row-ic' }, icon(d.icon)),
h('span', { class: 'row-main' }, h('span', { class: 'row-title' }, h('b', { text: d.title }), isNew ? h('span', { class: 'pill accent', text: App.t('alerts.new') }) : null),
d.detail ? h('span', { class: 'row-sub', text: d.detail }) : null),
@ -57,7 +60,7 @@
}
App.registerScreen({
id: 'alerts', titleKey: 'screen.alerts', navKey: 'nav.alerts', icon: 'bell', hud: false,
id: 'alerts', titleKey: 'screen.alerts', navKey: 'nav.alerts', icon: 'bell', hud: false, navGroup: 'more',
render(container) {
box = container;
listEl = h('ul', { class: 'alert-list' });