The site now ingests the sidecar's live WebSocket feed and persists it to its own MariaDB, and re-broadcasts curated events to browsers over SSE. - schema: shard_events (append-only notable-kind log, sha1 dedupe_key + INSERT IGNORE for idempotent reconnect backfill), shard_online (current players, upsert/refresh/remove), shard_economy (gold-supply series), shard_houses (per-house decay stage + derived is_idoc). - model/shardEvents + model/shardState: the .db.js/.model.js split; writes take camelCase event data, reads are shaped; online upsert uses COALESCE so a partial char.vitals refresh never blanks login fields. - utils/shardIngest: single dispatcher routing each kind to state writes and/or the event log, then the broadcaster. High-frequency kinds (char.vitals, economy.supply) update state only. A changed server.hello bootId clears the stale online roster. Deps are injected for unit testing. - utils/uoLinkSocket: the server's first outbound WS client (ws dep). Verifies the ws.hello protocol, backfills via /history + /economy on every (re)connect (dedupe handles overlap), reconnects with capped backoff, and mirrors connection state into uo_link_config. Self-guards: only connects when the integration is enabled with a token. - utils/shardBroadcast: SSE fan-out with public (safe kinds only) and admin (all) channels, keepalive pings, per-client cleanup. - server.js: start the ingest socket on boot (no-op until configured) and stop it + close SSE streams on graceful shutdown. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011qPmpmVH1xGCiZoz9m9vW3
47 lines
1.1 KiB
JSON
47 lines
1.1 KiB
JSON
{
|
|
"name": "uomysticmoon-server",
|
|
"version": "1.0.0",
|
|
"description": "REST API for the UOMysticmoon website and admin panel",
|
|
"main": "src/server.js",
|
|
"scripts": {
|
|
"start": "node src/server.js",
|
|
"dev": "nodemon src/server.js",
|
|
"seed": "node db/seed.js",
|
|
"swagger": "node swagger/swagger.js",
|
|
"test": "node --test"
|
|
},
|
|
"keywords": [
|
|
"express",
|
|
"mariadb",
|
|
"jwt",
|
|
"bcrypt"
|
|
],
|
|
"author": "whitlocktech",
|
|
"license": "ISC",
|
|
"dependencies": {
|
|
"bcryptjs": "^2.4.3",
|
|
"cookie-parser": "^1.4.6",
|
|
"cors": "^2.8.5",
|
|
"dotenv": "^16.4.5",
|
|
"express": "^4.19.2",
|
|
"express-rate-limit": "^7.4.0",
|
|
"express-slow-down": "^3.1.0",
|
|
"express-validator": "^7.2.0",
|
|
"helmet": "^7.1.0",
|
|
"jsonwebtoken": "^9.0.2",
|
|
"mariadb": "^3.3.1",
|
|
"morgan": "^1.10.0",
|
|
"multer": "^2.0.1",
|
|
"nodemailer": "^9.0.1",
|
|
"qrcode": "^1.5.4",
|
|
"sanitize-html": "^2.17.5",
|
|
"speakeasy": "^2.0.0",
|
|
"swagger-ui-express": "^5.0.1",
|
|
"ws": "^8.21.0"
|
|
},
|
|
"devDependencies": {
|
|
"nodemon": "^3.1.4",
|
|
"swagger-autogen": "^2.23.7"
|
|
}
|
|
}
|