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

@ -89,10 +89,16 @@ function createQueries({ db, clock, scheduler }) {
r = Math.min(r, 40);
const x0 = Math.max(-rad, x - r), x1 = Math.min(rad, x + r), y0 = Math.max(-rad, y - r), y1 = Math.min(rad, y + r);
const specials = [];
const age = R.worldAgeDays(world.start_at, now, world.speed);
const sites = new Map(require('./endgame').siteStates(db, world, now).map(({ site, row }) => [site.index, require('./endgame').siteView(db, world, site, row)]));
for (let yy = y0; yy <= y1; yy++) {
for (let xx = x0; xx <= x1; xx++) {
const t = R.tileAt(world.seed, rad, xx, yy);
const t = R.tileAt(world.seed, rad, xx, yy, age);
if (t.type === 'rural' || t.type === 'incumbent') specials.push({ x: xx, y: yy, type: t.type, bonus: t.bonus || null });
else if (t.type === 'backbone') { // end game: landing site with its holder and node level
const v = sites.get(t.site);
specials.push({ x: xx, y: yy, type: 'backbone', bonus: null, site: { id: v.id, index: v.index, holder: v.holder, level: v.level, maxLevel: v.maxLevel } });
}
}
}
const towns = db.all(`SELECT t.id, t.name, t.x, t.y, t.is_capital, o.id AS oid, o.name AS oname, o.as_number AS asn, o.alliance_id AS ally, a.tag AS atag, a.name AS aname, o.protection_until AS prot