From 8368692b99f7174c63b5231b70063b0451f0ed26 Mon Sep 17 00:00:00 2001 From: Burrowdev Date: Tue, 20 Oct 2026 23:44:16 +0300 Subject: [PATCH] feat(modpanel): the mod log as its own page The admin panel's "What they did" table, in the moderator panel too: the latest 300 entries. A new permission, staff.log, which moderators and admins have by default, guards the page and its route. Co-Authored-By: Claude Opus 5.5 --- lib/modpanel.js | 11 +++++++++++ lib/roles.js | 3 ++- public/mod.html | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/lib/modpanel.js b/lib/modpanel.js index ffd9ea8..fd6bb26 100644 --- a/lib/modpanel.js +++ b/lib/modpanel.js @@ -670,6 +670,17 @@ const handle = async (req, res, url, from, web) => { return; } + // the mod log (lib/modlog.js): what staff did, as the admin panel's + // Moderators page shows it. + if (route === "GET /mod/api/modlog") { + if (!roles.can(mod, "staff.log")) { + reply(403, {error: "Your role does not allow that."}); + return; + } + reply(200, {log: modlog.recent()}); + return; + } + // everything else shows players and what they did: not for a role that // only makes things. if (!roles.can(mod, "player.view")) { diff --git a/lib/roles.js b/lib/roles.js index 87045f7..ac33c27 100644 --- a/lib/roles.js +++ b/lib/roles.js @@ -33,10 +33,11 @@ const PERMISSIONS = { "room.effects": "run temporary room-wide size and colour effects (!roomfx)", "theater.control": "play or stop a YouTube video for everyone in the theatre", "music.upload": "upload MP3s as den music tracks, and delete those uploaded (the Music page)", + "staff.log": "read the mod log: what staff did, in the panels and the game (the Mod log page)", }; const HELPER = ["server.view", "player.view", "staff.list", "player.warn", "player.goto", "chat.silence"]; -const MODERATOR = [...HELPER, "player.kick", "player.summon", "staff.invisible", "player.ban", "player.names", "address.ban", "items.approve", "items.restrict", "theater.control"]; +const MODERATOR = [...HELPER, "player.kick", "player.summon", "staff.invisible", "player.ban", "player.names", "address.ban", "items.approve", "items.restrict", "theater.control", "staff.log"]; const ADMIN = [...MODERATOR, "items.create", "room.effects", "music.upload"]; // a developer makes things, and moderates nobody. const DEVELOPER = ["server.view", "staff.list", "items.create", "room.effects", "theater.control"]; diff --git a/public/mod.html b/public/mod.html index b474f0f..ef93b98 100644 --- a/public/mod.html +++ b/public/mod.html @@ -475,6 +475,7 @@ + @@ -992,6 +993,17 @@ + +