Skip to content

Admin dashboard

A web dashboard at /admin for the people who run an AcidBoy server. It is only for staff: Admins and Moderators.

Rule How it is enforced
Staff sign in with GitHub only /admin/login/github starts the shared GitHub OAuth handler and marks the round trip as an admin sign-in (in the encrypted OAuth state). /admin/signin-complete accepts only that, from the GitHub handler (issuer GitHub)
Only staff get in A player who signs in is sent to Access denied and gets no dashboard cookie
Game tokens never work here The dashboard runs in its own /admin pipeline branch that only reads its own cookie; JWTs are not looked at
The developer name-only sign-in never works here It produces game tokens only
Its own session Cookie acidboy.admin: path /admin, HttpOnly, SameSite=Strict, Secure (except plain HTTP in Development), 8 hours, not sliding
Roles are always current The Moderator and Admin policies read the role from the database on every request. Every action re-checks it too, because an open dashboard page (a Blazor circuit) outlives a role change. Removing someone’s role locks them out at once, banned staff included
Changes are protected Forms carry an antiforgery token (logout is a POST); actions are limited to 30 per staff member per minute; every change is written to the audit log in the same transaction
  1. Create a GitHub OAuth app with the callback https://<host>/auth/callback/github (or http://localhost:5280/auth/callback/github locally).

  2. Configure the server, in user-secrets or environment variables:

    Terminal window
    dotnet user-secrets set "Auth:Providers:github:ClientId" "<client id>"
    dotnet user-secrets set "Auth:Providers:github:ClientSecret" "<client secret>"
    dotnet user-secrets set "Admin:Bootstrap:0" "github:<numeric GitHub user id>" # gh api user --jq .id
  3. Open /admin and sign in with GitHub.

Bootstrap identities are always Admins: they are promoted at startup and on sign-in. Add more staff from the Roles page. They need a GitHub sign-in on record, from the emulator or the dashboard.

Moderator Admin
Overview, Live, Players, Matches, Leaderboards, Chat
Kick, mute, ban and unban players
Moderate other staff Moderators only (Admins must be demoted first)
Channels: create, edit, reorder, delete
Roles: grant and remove Moderator and Admin
Audit log Own actions Everyone’s

Safeguards:

  • nobody can change their own role;
  • the last Admin can’t be removed;
  • nobody can moderate themselves.
Page What it shows
Overview Online now, in a lobby, linked now, accounts, staff, banned. 30-day charts of matches and new accounts. How matches ended, the most played games, win-detection coverage, and popular games without win detection (what to add next). Refreshes every 5 s
Live Links being relayed (players, start, traffic, link to the match), everyone online with their game and lobby, every channel and room with its members. Refreshes every 2 s
Players Search by name or account id
Player profile Account, sign-ins, where they are now, friends, ban and mute state, W/L records per game, recent matches with results, moderation history, and the moderation actions
Matches Filter by player, game, outcome (has a winner, draw, no winner, linked now) and dates. Each row shows players (winner in bold), game, score, when, length, how it ended
Match Result card (winner and score). Both players with their game and ROM SHA-1, and whether they ran the same ROM. A timeline: challenge accepted, connected, decided, ended and by whom. Every round, set and trade with Verified, One side only or Reports differ (both versions shown). Staff actions on either player during the match
Leaderboards Pick a game: rank, wins, losses, draws, win rate, rounds won
Chat The last 50 messages of every open channel and room (chat is not stored on disk). Refreshes every 3 s
Channels (Admin) Create (id: 2-32 lowercase letters, digits, dashes), edit name and description, move up and down, delete (players inside are moved out and told)
Roles (Admin) Current staff; make Admin or Moderator, or remove; find a player and promote them
Audit log Who did what to whom, when, with the reason and details

Each action takes a reason, which is shown to the player and kept in the audit log, and a duration: 10 minutes, 1 hour, 1 day, 7 days, 30 days or permanent.

Action Effect on the player, immediately
Kick Removed from their channel or room: “You were removed from the lobby by a moderator: ”. They stay online
Mute Chat is refused: “You are muted until …”. They are told when muted and when a moderator unmutes them; a timed mute just runs out
Ban Told why (pop-up). All refresh tokens revoked, live access tokens stop working, the lobby connection closes about 1 s later, and any relayed link ends as Moderated. Signing in is refused with the reason and end date until the ban expires
Unmute / Unban Back to normal (an unbanned player signs in again)
Piece Where
Hosting, sign-in, policies, bootstrap Admin/AdminSetup.cs: app.Map("/admin", …) branch with routing, its own authentication, authorization and antiforgery; MapRazorComponents<App>().AddInteractiveServerRenderMode().RequireAuthorization("Moderator")
All queries and actions Admin/AdminService.cs. Each public method calls ActorAsync, which clears the change tracker, re-reads the actor and checks the role
Pages and UI pieces Admin/Components/Pages/*.razor, Admin/Components/Ui/*.razor (cards, badges, tables, charts)
Page base class AdminPage: RunAsync for actions (shows refusals as a message), RefreshAsync for timers, one database operation at a time per page
Result descriptions Admin/ResultText.cs
Enforcement ModerationCache (bans on every API request), TokenService.RevokeAllAsync, LobbyState.KickFromLobbyAsync/DisconnectAccountAsync/SetMute, LinkRelay.EndMatchesFor

Tailwind CSS v4 through the standalone CLI, so no Node is needed:

What Where
Source Admin/Styles/admin.css (@import "tailwindcss", @source "../Components", an @theme with the AcidBoy teal)
Output wwwroot/admin.css, generated, git-ignored, served fingerprinted as a static asset
Build step The AcidBoyTailwind MSBuild target in AcidBoy.Server.csproj

The build step:

  1. downloads the CLI for the current OS into obj/tailwind/<version>/, pinned by TailwindVersion;
  2. verifies its pinned SHA-256 and deletes it on a mismatch;
  3. runs it whenever a .razor or the CSS source changes.

To change version, update TailwindVersion and the per-platform TailwindSha256 values from the release’s sha256sums.txt. Offline, build with -p:AcidBoySkipTailwind=true to keep the last generated CSS.

The layout is responsive: a sidebar on wide screens, a scrolling top menu on phones. It also follows the system light or dark mode.