Minecraft server dashboard (Next.js)
Find a file
hurkicorgi 1ac5513d2c Role-based access: admin vs superadmin
- Credentials provider now resolves two distinct accounts from env:
    SUPERADMIN_USERNAME / SUPERADMIN_PASSWORD → role "superadmin"
    ADMIN_USERNAME      / ADMIN_PASSWORD      → role "admin"
  The role is carried through the JWT and Session callbacks so the UI
  and API can gate on it. Types extended via types/next-auth.d.ts.
- lib/auth.ts exports requireRole(minRole) and sessionRole(session).
- /api/players POST rejects "op" and "deop" with 403 unless the caller
  is superadmin. All other player actions (whitelist add/remove, ban,
  pardon) remain available to both roles.
- lib/use-role.ts (client hook) exposes role / isSuperadmin / authed
  for UI gating without duplicating session typing.
- PlayerManager: Add-OP button and per-row Deop action are hidden or
  disabled for non-superadmin; when a regular admin is viewing the
  Ops tab, a banner explains the read-only state.
- PlayerDrawer: Make Op / Deop button disabled with tooltip for
  non-superadmin; whitelist, ban, pardon unchanged.
- Navbar: subtle role pill next to the user name ("Super" for
  superadmin amber-tinted, "Admin" for admin).
- Migration note: the existing ADMIN_* credentials now log in as the
  restricted admin role. Set SUPERADMIN_USERNAME + SUPERADMIN_PASSWORD
  in .env.local to retain operator-management ability. A placeholder
  superadmin account was generated in .env.local; the password is in
  the commit terminal output only, not the repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 06:52:05 -06:00
app Role-based access: admin vs superadmin 2026-04-13 06:52:05 -06:00
components Role-based access: admin vs superadmin 2026-04-13 06:52:05 -06:00
lib Role-based access: admin vs superadmin 2026-04-13 06:52:05 -06:00
public SSE events bridge, PWA service worker, offline banner, lazy admin tabs 2026-04-13 05:48:00 -06:00
scripts Expanded scheduled tasks + keyboard shortcuts 2026-04-13 05:57:39 -06:00
types Role-based access: admin vs superadmin 2026-04-13 06:52:05 -06:00
.gitignore Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
AGENTS.md Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
bun.lock Bundle analyzer, task run-now/toggle/weekly, error reporter, OG image, a11y 2026-04-13 06:08:48 -06:00
CLAUDE.md Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
components.json Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
eslint.config.mjs Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
middleware.ts Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
next.config.ts Bundle analyzer, task run-now/toggle/weekly, error reporter, OG image, a11y 2026-04-13 06:08:48 -06:00
package.json Bundle analyzer, task run-now/toggle/weekly, error reporter, OG image, a11y 2026-04-13 06:08:48 -06:00
postcss.config.mjs Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
README.md Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00
tsconfig.json Initial commit: Minecraft dashboard 2026-04-13 00:46:58 -06:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.