mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
- the client (1.3.0) sends one-way hashes of the device's ids at sign-in; the server keys them again with a secret of its own (data/device-key) and keeps them per account (lib/devices.js). a sign-in without them is refused with 426 (AJ_REQUIRE_DEVICE=0 lets it in), so 1.2 clients cannot sign in. - hardware bans: every device an account used in the last 90 days. any id but a network card blocks sign-in, sign-up and the game, on any account. a network card match, ids that look altered, or a device shared with a banned player raise hardware alerts instead. - both panels: hardware ban and lift, the account's hardware ids, search by hardware id, other accounts by device or address, a timeline (bans, staff actions, reports, alerts), and hardware bans and alerts in the bans tab. - jam-a-grams and wall posts go into the chat log, the filtered ones marked not sent. chat search filters by kind, by what the filter stopped, and from a time back; each player's page lists their jam-a-grams and wall posts, sent and received. - account search runs on the server and ranks exact names first, then names starting with the search; the admin panel no longer downloads every account. hidden tabs only refresh the waiting counts in the title. masterpieces can be searched by maker, approved ones too. reports can show the reported player's chat at the time. links follow the open tab and player. - admin actions on accounts go into the moderator log. - privacy policy covers hardware hashes and the new logs.
86 lines
2.8 KiB
JavaScript
86 lines
2.8 KiB
JavaScript
"use strict";
|
|
|
|
require("./lib/log.js"); // first, so everything printed reaches the admin panel's log view
|
|
|
|
const fs = require("fs");
|
|
const accounts = require("./lib/accounts.js");
|
|
const bans = require("./lib/bans.js");
|
|
const devices = require("./lib/devices.js");
|
|
const chatlog = require("./lib/chatlog.js");
|
|
const modlog = require("./lib/modlog.js");
|
|
const retention = require("./lib/retention.js");
|
|
const colours = require("./lib/colours.js");
|
|
const config = require("./config.js");
|
|
const defpacks = require("./lib/defpacks.js");
|
|
const http = require("./lib/http.js");
|
|
const masterpieces = require("./lib/masterpieces.js");
|
|
const panel = require("./lib/panel.js");
|
|
const reports = require("./lib/reports.js");
|
|
const roomInfo = require("./lib/roominfo.js");
|
|
const support = require("./lib/support.js");
|
|
const sfs = require("./lib/sfs.js");
|
|
const stats = require("./lib/stats.js");
|
|
const world = require("./lib/world.js");
|
|
|
|
// files this server makes are its own to read: accounts, logs, the cache.
|
|
process.umask(0o077);
|
|
|
|
const main = async () => {
|
|
if (config.problems.length) {
|
|
throw new Error(config.problems.join("; "));
|
|
}
|
|
if (!fs.existsSync(config.clientSwf)) {
|
|
throw new Error(`Client SWF not found at ${config.clientSwf} (set AJ_CLIENT_SWF)`);
|
|
}
|
|
await defpacks.init();
|
|
await roomInfo.preload();
|
|
accounts.load();
|
|
fs.chmodSync(config.dataDir, 0o700);
|
|
accounts.startBackups();
|
|
colours.load();
|
|
reports.load();
|
|
support.load();
|
|
bans.load();
|
|
devices.load();
|
|
chatlog.load();
|
|
modlog.load();
|
|
masterpieces.load();
|
|
retention.load();
|
|
stats.load(() => world.players().length);
|
|
panel.load();
|
|
await http.start();
|
|
await sfs.start(world);
|
|
console.log(`[server] ready at ${config.baseUrl}`);
|
|
};
|
|
|
|
// stopped on purpose: what is waiting to be written is written first.
|
|
const stop = code => {
|
|
stats.flush();
|
|
try {
|
|
accounts.flush();
|
|
}
|
|
catch (err) {
|
|
console.error(`[server] could not save while stopping: ${err.message}`);
|
|
}
|
|
process.exit(code);
|
|
};
|
|
process.on("SIGTERM", () => stop(0));
|
|
process.on("SIGINT", () => stop(0));
|
|
// the last resort. message handlers, timers and goodbyes each catch their
|
|
// own errors; what gets here was thrown somewhere nobody thought of, and the
|
|
// server's state can no longer be vouched for. it is written down, what can
|
|
// be saved is saved, and the process ends for whatever started it (systemd,
|
|
// with Restart=always) to start it again.
|
|
process.on("uncaughtException", err => {
|
|
console.error(`[server] uncaught error, stopping: ${err && err.stack ? err.stack : err}`);
|
|
stop(1);
|
|
});
|
|
process.on("unhandledRejection", err => {
|
|
console.error(`[server] unhandled rejection: ${err && err.stack ? err.stack : err}`);
|
|
});
|
|
|
|
main().catch(err => {
|
|
console.error(`[server] failed to start: ${err.message}`);
|
|
process.exit(1);
|
|
});
|