Revert "Add missing admin action files and navigation links"
This reverts commit 41be6835bf.
This commit is contained in:
1 parent
4a1e1115b3
commit
4d515bc400
338 files changed
+5949
-28144
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import os from "node:os";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Activity } from "lucide-react";
|
||||
import { Activity } from 'lucide-react';
|
||||
import {
|
||||
hotelAlert,
|
||||
updateCatalog,
|
||||
@@ -58,20 +58,21 @@ function uptime(seconds: number): string {
|
||||
export default async function CommandoCentrum() {
|
||||
const t = await getTranslations("pages.admin.commandocentrum");
|
||||
|
||||
const [onlineCount, totalUsers, errors, dbOk, emulatorOnline, maintenance, activity] = await Promise.all([
|
||||
prisma.user.count({ where: { online: "1" } }).catch(() => 0),
|
||||
prisma.user.count().catch(() => -1),
|
||||
prisma.emulatorErrors.findMany({ orderBy: { timestamp: "desc" }, take: 50 }).catch(() => []),
|
||||
prisma.websiteSetting
|
||||
.count()
|
||||
.then(() => true)
|
||||
.catch(() => false),
|
||||
rcon.send("ping", null).catch(() => false),
|
||||
siteSettings.getBool("maintenance_enabled", false),
|
||||
prisma.staffActivities
|
||||
.findMany({ orderBy: { createdAt: "desc" }, take: 12 })
|
||||
.catch(() => [] as Awaited<ReturnType<typeof prisma.staffActivities.findMany>>),
|
||||
]);
|
||||
const [onlineCount, totalUsers, errors, dbOk, emulatorOnline, maintenance, activity] =
|
||||
await Promise.all([
|
||||
prisma.user.count({ where: { online: "1" } }).catch(() => 0),
|
||||
prisma.user.count().catch(() => -1),
|
||||
prisma.emulatorErrors.findMany({ orderBy: { timestamp: "desc" }, take: 50 }).catch(() => []),
|
||||
prisma.websiteSetting
|
||||
.count()
|
||||
.then(() => true)
|
||||
.catch(() => false),
|
||||
rcon.send("ping", null).catch(() => false),
|
||||
siteSettings.getBool("maintenance_enabled", false),
|
||||
prisma.staffActivities
|
||||
.findMany({ orderBy: { createdAt: "desc" }, take: 12 })
|
||||
.catch(() => [] as Awaited<ReturnType<typeof prisma.staffActivities.findMany>>),
|
||||
]);
|
||||
|
||||
const staffIds = Array.from(new Set(activity.map((a) => Number(a.userId)))).filter((n) => n > 0);
|
||||
let nameById = new Map<number, string>();
|
||||
@@ -99,10 +100,7 @@ export default async function CommandoCentrum() {
|
||||
</div>
|
||||
|
||||
{/* ── Live status ────────────────────────────────────────── */}
|
||||
<div
|
||||
className="grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3.5 mb-6"
|
||||
style={{ marginTop: "1.1rem" }}
|
||||
>
|
||||
<div className="grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3.5 mb-6" style={{ marginTop: "1.1rem" }}>
|
||||
<StatusCard
|
||||
label={t("playersOnline")}
|
||||
value={onlineCount}
|
||||
@@ -136,7 +134,10 @@ export default async function CommandoCentrum() {
|
||||
{/* ── Online users widget ───────────────────────────────── */}
|
||||
<section className="admin-card mb-6">
|
||||
<h2 className="admin-section-title">{t("onlineUsers")}</h2>
|
||||
<OnlineUsersWidget users={[]} isLoading={false} />
|
||||
<OnlineUsersWidget
|
||||
users={[]}
|
||||
isLoading={false}
|
||||
/>
|
||||
</section>
|
||||
|
||||
{/* ── Server info + diagnostics ──────────────────────────── */}
|
||||
@@ -197,7 +198,9 @@ export default async function CommandoCentrum() {
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
<form action={updateCatalog} className="admin-card">
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("updateCatalog")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">{t("updateCatalogDesc")}</p>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">
|
||||
{t("updateCatalogDesc")}
|
||||
</p>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
{t("updateCatalog")}
|
||||
</button>
|
||||
@@ -205,7 +208,9 @@ export default async function CommandoCentrum() {
|
||||
|
||||
<form action={updateWordFilter} className="admin-card">
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("updateWordFilter")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">{t("updateWordFilterDesc")}</p>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">
|
||||
{t("updateWordFilterDesc")}
|
||||
</p>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
{t("updateWordFilter")}
|
||||
</button>
|
||||
@@ -213,7 +218,9 @@ export default async function CommandoCentrum() {
|
||||
|
||||
<form action={updateNavigator} className="admin-card">
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("updateNavigator")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">{t("updateNavigatorDesc")}</p>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">
|
||||
{t("updateNavigatorDesc")}
|
||||
</p>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
{t("updateNavigator")}
|
||||
</button>
|
||||
@@ -222,7 +229,9 @@ export default async function CommandoCentrum() {
|
||||
|
||||
<form action={hotelAlert} className="admin-card mt-6">
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("hotelAlert")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("hotelAlertDesc")}</p>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">
|
||||
{t("hotelAlertDesc")}
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
name="message"
|
||||
@@ -241,31 +250,18 @@ export default async function CommandoCentrum() {
|
||||
{/* ── User RCON actions ──────────────────────────────────── */}
|
||||
<section className="mt-6">
|
||||
<h2 className="admin-section-title">{t("userActions")}</h2>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">{t("userActionsDesc")}</p>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-4">
|
||||
{t("userActionsDesc")}
|
||||
</p>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
<form action={disconnectUser} className="admin-card">
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("actions.disconnect")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("disconnectDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="username"
|
||||
type="text"
|
||||
placeholder={t("usernameRequired")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-danger w-full">
|
||||
{t("actions.disconnect")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="username" type="text" placeholder={t("usernameRequired")} required className="w-full" />
|
||||
<button type="submit" className="btn btn-danger w-full">{t("actions.disconnect")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -273,25 +269,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("actions.alert")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("alertDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="message"
|
||||
type="text"
|
||||
placeholder={t("alertMessage")}
|
||||
required
|
||||
maxLength={512}
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("actions.alert")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="message" type="text" placeholder={t("alertMessage")} required maxLength={512} className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("actions.alert")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -299,25 +279,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("forwardToRoom")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("forwardDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="roomId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("roomId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("forwardUser")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="roomId" type="number" min={1} placeholder={t("roomId")} required className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("forwardUser")}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -327,25 +291,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("giveCredits")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("giveCreditsDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="credits"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("amount")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("giveCredits")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="credits" type="number" min={1} placeholder={t("amount")} required className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("giveCredits")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -353,25 +301,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("giveDuckets")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("giveDucketsDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="amount"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("amount")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("giveDuckets")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="amount" type="number" min={1} placeholder={t("amount")} required className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("giveDuckets")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -379,25 +311,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("giveDiamonds")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("giveDiamondsDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="amount"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("amount")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("giveDiamonds")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="amount" type="number" min={1} placeholder={t("amount")} required className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("giveDiamonds")}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -407,25 +323,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("giveBadge")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("giveBadgeDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="badge"
|
||||
type="text"
|
||||
placeholder={t("badgeCode")}
|
||||
required
|
||||
maxLength={32}
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("giveBadge")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="badge" type="text" placeholder={t("badgeCode")} required maxLength={32} className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("giveBadge")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -433,25 +333,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("setMotto")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("setMottoDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="motto"
|
||||
type="text"
|
||||
placeholder={t("newMotto")}
|
||||
required
|
||||
maxLength={127}
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("setMotto")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="motto" type="text" placeholder={t("newMotto")} required maxLength={127} className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("setMotto")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -459,26 +343,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("setRank")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("setRankDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="rank"
|
||||
type="number"
|
||||
min={0}
|
||||
max={10}
|
||||
placeholder={t("rankPlaceholder")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("setRank")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="rank" type="number" min={0} max={10} placeholder={t("rankPlaceholder")} required className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("setRank")}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -488,25 +355,9 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("executeCommand")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("executeCommandDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="command"
|
||||
type="text"
|
||||
placeholder={t("commandPlaceholder")}
|
||||
required
|
||||
maxLength={100}
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("execute")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="command" type="text" placeholder={t("commandPlaceholder")} required maxLength={100} className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("execute")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -514,33 +365,10 @@ export default async function CommandoCentrum() {
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] mb-2">{t("sendGift")}</h3>
|
||||
<p className="text-xs text-[var(--color-text-muted)] mb-3">{t("sendGiftDesc")}</p>
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
name="userId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("userId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="itemId"
|
||||
type="number"
|
||||
min={1}
|
||||
placeholder={t("furniId")}
|
||||
required
|
||||
className="w-full"
|
||||
/>
|
||||
<input
|
||||
name="message"
|
||||
type="text"
|
||||
placeholder={t("giftMessage")}
|
||||
maxLength={255}
|
||||
defaultValue={t("defaultGiftMessage")}
|
||||
className="w-full"
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
{t("sendGift")}
|
||||
</button>
|
||||
<input name="userId" type="number" min={1} placeholder={t("userId")} required className="w-full" />
|
||||
<input name="itemId" type="number" min={1} placeholder={t("furniId")} required className="w-full" />
|
||||
<input name="message" type="text" placeholder={t("giftMessage")} maxLength={255} defaultValue={t("defaultGiftMessage")} className="w-full" />
|
||||
<button type="submit" className="btn btn-primary w-full">{t("sendGift")}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -570,9 +398,7 @@ export default async function CommandoCentrum() {
|
||||
</td>
|
||||
<td>{nameById.get(Number(a.userId)) ?? `#${a.userId}`}</td>
|
||||
<td>
|
||||
<span className="inline-block text-[0.6rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">
|
||||
{a.action}
|
||||
</span>
|
||||
<span className="inline-block text-[0.6rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">{a.action}</span>
|
||||
</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400">{a.description}</td>
|
||||
</tr>
|
||||
@@ -600,7 +426,7 @@ export default async function CommandoCentrum() {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{errors.map((e) => {
|
||||
{errors.map((e) => {
|
||||
const trace = decodeStacktrace(e.stacktrace);
|
||||
const snippet = trace
|
||||
? trace.split("\n").slice(0, 20).join("\n") +
|
||||
|
||||
Reference in new issue
Block a user