mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
feat(server): staff tools, player-made items, picture safety, chat, multiplayer games
Staff and moderation
- Invisible staff (!invisible, "xiv"): hidden from players, half see-through
to other staff, cannot chat while hidden. New permission staff.invisible.
- Summon and goto land on the player's exact spot ("xgt" before the move).
- Custom warnings (!warn PLAYER custom TEXT), shown in the warning popup.
- Mod notes (!note, !notes; lib/modnotes.js), on the player page and the
dashboard.
- Granular permissions: per-role overrides (setting rolePermissions) and
per-account grants and denies, applied live to staff who are playing
(refreshStaff re-sends "xsp").
- Item control (lib/itemcontrol.js): lock items out of the item finder
(!lock, !unlock, !locked), take an item from a player (!take), delete a
custom item from the game and every inventory.
- GET items/find: search any item by name or id, marked locked, for the
dashboards' quick lock.
Player-made items (lib/playeritems.js, "xcm")
- The Item Maker: make, rename, set the worn look, delete. 5 a day, 20 in all;
names go through the name filter.
- Admin switches: Item Maker on/off, new items wait for approval, and a
separate switch (on by default) that holds every player-uploaded picture
for a moderator. Review queue for items.approve (moderator and up).
- Pictures (lib/itemart.js): PNG, JPEG and GIF cleaned of metadata, BMP
converted to PNG; 512px and 300KB at most once cleaned.
- Worn as the maker chooses: a sticker (the picture) or a texture (the
item's shape painted with the picture).
Picture safety
- A picture waiting for approval is never served publicly: /itemart/ 404s it,
and it is only shown through /account|/mod|/admin/api/itemart to its maker
and to staff who review or make items.
- A picture turned away or taken off is remembered by SHA-256 and cannot be
uploaded again.
- Three strikes: three pictures turned away stops a player's uploads until a
moderator lets them again. Staff can stop or allow uploads by hand.
- Accounts under 24 hours old cannot upload pictures (AJ_ITEM_ART_MIN_HOURS);
uploads capped at 10 a day.
- Optional Google Cloud Vision SafeSearch (lib/image-moderation.js) for item
pictures and Art Studio paintings when AJ_GOOGLE_VISION_API_KEY is set;
fails closed when the scanner is unreachable.
Chat
- Emoji: Twemoji pictures served at /emoji/<codepoints>.png and cached in
data/emoji (lib/emoji.js).
- Smart spam filtering before the word filter (lib/chatspam.js): long runs of
one character, repeated words and lines, huge words and emoji floods are
tidied, and repeats within 20 seconds are dropped.
- Typing indicator: "xty" is passed on to everyone in the room who can see
the player, at most every 2 seconds.
Games (lib/minigames.js)
- Room games can be played together: a MULTIPLAYER table gives a game a
waiting list (Single Player / Multiplayer). Players in the same room are
matched, taken into the game together, and each one's moves are relayed to
the others. Gem Breaker is the first: two players, "pos", "shoot" and
"playerLost" relayed.
- Gem Breaker's start message now lists each player's id. Without it no
player counted as local, so even single player could not aim.
Other
- Players stay connected through the client's new 75-minute AFK limit
(idleTimeoutMs 80 minutes).
- Jam-a-Grams carry custom items and colours; Jammer Wall avatar photos are
validated (walls.js photoParam).
- Weak passwords refused (common words, or containing the username).
- Code-scanning fixes: every logged value goes through logText
(lib/logtext.js) against log injection, HSTS, path-only error logs, a
single file read in lib/names.js.
Tests: items (pictures, approval, strikes, re-upload refusal, the hidden
waiting picture, the dashboard search), staff (invisibility, goto and summon
spots, custom warnings, notes), buddygames (two-player Gem Breaker, the
typing relay), and updates for main's verified badge and spawn rooms.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
da7eb9af58
commit
e05565787f
50 files changed
+2904
-277
No files matched your search
+22
-22
@@ -44,7 +44,7 @@ const panel = page("admin");
|
||||
|
||||
const run = async () => {
|
||||
const register = (username, avatarType) => fetch(`${BASE}/api/register`, {method: "POST", headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify({username, password: "Password01", avatarType, agreed: true})});
|
||||
body: JSON.stringify({username, password: "KettlePass01", avatarType, agreed: true})});
|
||||
assert.strictEqual((await register("Ann", 4)).status, 200);
|
||||
assert.strictEqual((await register("Ben", 24)).status, 200);
|
||||
// what a client shows beside its login form.
|
||||
@@ -55,8 +55,8 @@ const run = async () => {
|
||||
assert.match(await (await fetch(`${BASE}/account`)).text(), /Your account/);
|
||||
assert.strictEqual((await mine("me")).status, 401);
|
||||
assert.strictEqual((await mine("login", {username: "Ann", password: "wrong"})).status, 401);
|
||||
assert.strictEqual((await mine("login", {username: "Nobody", password: "Password01"})).status, 401);
|
||||
const signedIn = await mine("login", {username: "ann", password: "Password01"});
|
||||
assert.strictEqual((await mine("login", {username: "Nobody", password: "KettlePass01"})).status, 401);
|
||||
const signedIn = await mine("login", {username: "ann", password: "KettlePass01"});
|
||||
assert.strictEqual(signedIn.status, 200);
|
||||
assert.match(signedIn.cookie, /^ajc_account=[0-9a-f]{48}$/);
|
||||
const ann = signedIn.cookie;
|
||||
@@ -67,8 +67,8 @@ const run = async () => {
|
||||
assert.deepStrictEqual(me.history.map(login => [login.via, login.ok]), [["web", true], ["web", false]]);
|
||||
|
||||
// --- parts of the game switched off
|
||||
const {client: a, roomId} = await arrive("Ann", "Password01");
|
||||
const {client: b} = await arrive("Ben", "Password01");
|
||||
const {client: a, roomId} = await arrive("Ann", "KettlePass01");
|
||||
const {client: b} = await arrive("Ben", "KettlePass01");
|
||||
await a.untilXt("ac");
|
||||
const set = async (feature, on) => assert.strictEqual((await mine("act", {action: "feature", feature, on}, ann)).status, 200);
|
||||
assert.strictEqual((await mine("act", {action: "feature", feature: "flying", on: false}, ann)).status, 400);
|
||||
@@ -144,7 +144,7 @@ const run = async () => {
|
||||
}
|
||||
b.xt("ts", roomId, 0, 1, 0, benHas[9]); // ben puts his scarf up for trade, in the game
|
||||
await b.untilXt("tl");
|
||||
const benPageCookie = (await mine("login", {username: "Ben", password: "Password01"})).cookie;
|
||||
const benPageCookie = (await mine("login", {username: "Ben", password: "KettlePass01"})).cookie;
|
||||
const tradable = (await mine("tradable?of=ben", undefined, ann)).data;
|
||||
assert.deepStrictEqual([tradable.found, tradable.theirs.map(item => item.name), tradable.mine.map(item => item.name)], [true, [scarfName], [hatName]]);
|
||||
assert.strictEqual((await mine("act", {action: "offer", to: "Ben", wanted: tradable.theirs[0], offered: []}, ann)).status, 400);
|
||||
@@ -182,27 +182,27 @@ const run = async () => {
|
||||
assert.strictEqual((await panel("support", {action: "approve", id: waiting.names[0].id}, admin)).status, 200);
|
||||
assert.strictEqual((await panel("support", {action: "approve", id: waiting.names[0].id}, admin)).status, 400); // only once
|
||||
assert.strictEqual((await mine("me", undefined, ann)).status, 401); // renamed: sign in again, with the new name
|
||||
assert.strictEqual((await authenticate("Ann", "Password01")).status, 401);
|
||||
const annabel = (await mine("login", {username: "Annabel", password: "Password01"})).cookie;
|
||||
assert.strictEqual((await authenticate("Ann", "KettlePass01")).status, 401);
|
||||
const annabel = (await mine("login", {username: "Annabel", password: "KettlePass01"})).cookie;
|
||||
me = (await mine("me", undefined, annabel)).data;
|
||||
assert.deepStrictEqual([me.username, me.nameRequests[0].status, me.feedback[0].handledAt > 0], ["Annabel", "approved", true]);
|
||||
|
||||
// --- the lock: out of the game, and no way back in until it is undone
|
||||
const {token} = await arrive("Annabel", "Password01");
|
||||
const {token} = await arrive("Annabel", "KettlePass01");
|
||||
assert.strictEqual((await mine("act", {action: "lock", locked: true}, annabel)).status, 200);
|
||||
assert.strictEqual((await authenticate("Annabel", "Password01")).status, 401);
|
||||
assert.strictEqual((await authenticate("Annabel", "KettlePass01")).status, 401);
|
||||
assert.strictEqual((await postJson(`${BASE}/authenticate`, {refresh_token: token})).status, 401); // the saved sign-in is gone
|
||||
assert.strictEqual((await panel("accounts", undefined, admin)).data.accounts.find(account => account.username === "Annabel").locked, true);
|
||||
assert.strictEqual((await mine("login", {username: "Annabel", password: "Password01"})).status, 200); // the page still lets her in
|
||||
assert.strictEqual((await mine("login", {username: "Annabel", password: "KettlePass01"})).status, 200); // the page still lets her in
|
||||
assert.strictEqual((await mine("act", {action: "lock", locked: false}, annabel)).status, 200);
|
||||
assert.strictEqual((await authenticate("Annabel", "Password01")).status, 200);
|
||||
assert.strictEqual((await authenticate("Annabel", "KettlePass01")).status, 200);
|
||||
|
||||
// --- the password: the old one is asked for, and stops working
|
||||
assert.strictEqual((await mine("act", {action: "password", current: "wrong", password: "Password02"}, annabel)).status, 400);
|
||||
assert.strictEqual((await mine("act", {action: "password", current: "Password01", password: "short"}, annabel)).status, 400);
|
||||
assert.strictEqual((await mine("act", {action: "password", current: "Password01", password: "Password02"}, annabel)).status, 200);
|
||||
assert.strictEqual((await authenticate("Annabel", "Password01")).status, 401);
|
||||
assert.strictEqual((await authenticate("Annabel", "Password02")).status, 200);
|
||||
assert.strictEqual((await mine("act", {action: "password", current: "wrong", password: "KettlePass02"}, annabel)).status, 400);
|
||||
assert.strictEqual((await mine("act", {action: "password", current: "KettlePass01", password: "short"}, annabel)).status, 400);
|
||||
assert.strictEqual((await mine("act", {action: "password", current: "KettlePass01", password: "KettlePass02"}, annabel)).status, 200);
|
||||
assert.strictEqual((await authenticate("Annabel", "KettlePass01")).status, 401);
|
||||
assert.strictEqual((await authenticate("Annabel", "KettlePass02")).status, 200);
|
||||
me = (await mine("me", undefined, annabel)).data;
|
||||
assert.ok(me.history.some(login => login.via === "launcher" && !login.ok) && me.history.some(login => login.via === "game" && login.ok));
|
||||
|
||||
@@ -210,14 +210,14 @@ const run = async () => {
|
||||
assert.strictEqual((await mine("me", undefined, annabel)).status, 401);
|
||||
|
||||
// --- deleting one's own account: the password and the name, then it is gone
|
||||
const {client: b2} = await arrive("Ben", "Password01");
|
||||
const ben = (await mine("login", {username: "Ben", password: "Password01"})).cookie;
|
||||
const {client: b2} = await arrive("Ben", "KettlePass01");
|
||||
const ben = (await mine("login", {username: "Ben", password: "KettlePass01"})).cookie;
|
||||
assert.strictEqual((await mine("act", {action: "delete", current: "wrong", confirm: "Ben"}, ben)).status, 400);
|
||||
assert.strictEqual((await mine("act", {action: "delete", current: "Password01", confirm: "Annabel"}, ben)).status, 400);
|
||||
const gone = await mine("act", {action: "delete", current: "Password01", confirm: "ben"}, ben);
|
||||
assert.strictEqual((await mine("act", {action: "delete", current: "KettlePass01", confirm: "Annabel"}, ben)).status, 400);
|
||||
const gone = await mine("act", {action: "delete", current: "KettlePass01", confirm: "ben"}, ben);
|
||||
assert.deepStrictEqual([gone.status, gone.data.deleted, gone.data.account], [200, true, undefined]);
|
||||
assert.strictEqual((await mine("me", undefined, ben)).status, 401);
|
||||
assert.strictEqual((await authenticate("Ben", "Password01")).status, 401);
|
||||
assert.strictEqual((await authenticate("Ben", "KettlePass01")).status, 401);
|
||||
assert.ok(!(await panel("accounts", undefined, admin)).data.accounts.some(account => account.username === "Ben"));
|
||||
// the name is held for a while (lib/accounts.js, NAME_HELD_DAYS): the
|
||||
// players Ben met still know him by it.
|
||||
|
||||
Reference in new issue
Block a user