Playtime from PlaytimeHistory's database (SAW_PT_DSN)

A public Playtime tab and player-drawer playtime, and staff-only figures
(who's on, staff activity, disconnect reasons, countries, names, sessions)
for @css/generic on the staff panel and on the public site when signed in.
Hidden unless SAW_PT_DSN is set and its tables are there.
This commit is contained in:
Astra 2026-10-04 21:05:57 +01:00
parent daa7ec2dbc
commit 6d0fc6e463
18 changed files with 2238 additions and 12 deletions

View file

@ -6,6 +6,8 @@ const PAGES = [
{ id: "players", label: "Players" },
{ id: "bans", label: "Bans" },
{ id: "comms", label: "Gags & mutes" },
// Only when the panel has PlaytimeHistory's database (playtime.js).
{ id: "playtime", label: "Playtime", show: () => !!state.me?.playtimeStaff },
{ id: "staff", label: "Staff & ranks", flag: "@zio/webpanel" },
// Only when GroupVerify's tables are in the database.
{ id: "verify", label: "Verification", show: () => !!state.me?.verify },
@ -798,6 +800,7 @@ async function openPlayer(sid) {
</dl>
</section>
${verifySection(d.verify, p.steamid, name)}
${ptDrawer(d.playtime, d.online)}
${manage ? `<section>
<h3>Rank</h3>
<div style="display:flex;gap:8px">
@ -941,7 +944,9 @@ async function act(path, method, body) {
/* ---------- Routing & events ---------- */
const RENDER = { overview, players, bans, comms, staff, verify, settings, notifications };
const playtime = () => ptPage(state.me, () => state.page === "playtime");
const RENDER = { overview, players, bans, comms, playtime, staff, verify, settings, notifications };
function renderNav() {
const c = state.counts;