reset UUID y shame persistente

This commit is contained in:
2025-08-16 00:56:16 -06:00
parent b18397deb4
commit 730c7bda9e
5 changed files with 291 additions and 6 deletions

View File

@@ -336,6 +336,32 @@ adminRouter.post("/admin/send-all-to-lobby", async (req: Request, res: Response)
}
});
// Reset all stored UUID profiles (name, color, shame tokens)
adminRouter.post("/admin/reset-uuid-profiles", async (req: Request, res: Response) => {
try {
const allowlist = listAllowedUuids();
const known = NameManager.getInstance().getAllKnownUuids();
const all = Array.from(new Set([...(allowlist || []), ...(known || [])]));
let resetCount = 0;
all.forEach(uuid => {
if (uuid) {
NameManager.getInstance().clearPlayerProfile(uuid);
resetCount++;
}
});
// Optionally, we could also update active rooms, but we keep it as future joins behavior.
// Broadcast dashboard update so clients refresh any derived data
setTimeout(() => { try { broadcastDashboardUpdate(); } catch {} }, 100);
res.json({ success: true, message: `Reset profiles for ${resetCount} UUIDs` });
} catch (error) {
console.error("[AdminAPI] Error resetting UUID profiles:", error);
res.status(500).json({ error: "Failed to reset UUID profiles" });
}
});
adminRouter.post("/admin/shuffle-players", async (req: Request, res: Response) => {
try {
console.log("[AdminAPI] Starting player shuffle...");