Remove pre-1.0 audit and protected request scaffolding

This commit is contained in:
npc0-hue
2026-08-20 23:42:02 +08:00
parent 40b35b05c7
commit a7e2e4c6c0
130 changed files with 526 additions and 3767 deletions
+11 -14
View File
@@ -1,24 +1,21 @@
import { describe, expect, it } from "vitest";
import { scumAnnouncementCommand, scumManagementRCONCommandRequest } from "./scumManagementRcon";
import { scumSourceRCONChatRequest, scumSourceRCONCommandRequest } from "./scumManagementRcon";
describe("SCUM management RCON bridge schema", () => {
it("builds a protected bridge request without connection material", () => {
describe("SCUM management Source RCON schema", () => {
it("builds a direct RCON job request without connection material", () => {
const stamp = Date.UTC(2026, 7, 3, 8, 0, 0);
expect(scumManagementRCONCommandRequest("server/unsafe", " ListPlayers ", stamp)).toEqual({
profileKey: "scum-client-manager",
commandType: "management.rcon.request",
payload: { requestText: "#ListPlayers" },
idempotencyKey: `web:scum-rcon:server-unsafe:${stamp}`,
priority: 20,
expiresAt: "2026-08-03T08:02:00.000Z"
expect(scumSourceRCONCommandRequest("server/unsafe", " ListPlayers ", stamp)).toEqual({
kind: "command",
command: "#ListPlayers",
idempotencyKey: `web:scum-rcon:server-unsafe:${stamp}`
});
});
it("formats announcements and rejects framed command text", () => {
expect(scumAnnouncementCommand("Restart in ten minutes")).toBe("#Announce Restart in ten minutes");
expect(scumManagementRCONCommandRequest("server-1", "#SetTime 12").payload).toEqual({ requestText: "#SetTime 12" });
expect(() => scumManagementRCONCommandRequest("server-1", "ListPlayers\nSetTime 12")).toThrow("管理指令必须是受限的单行文本");
it("formats direct commands and rejects framed text", () => {
expect(scumSourceRCONChatRequest("server-1", "Restart in ten minutes", 42)).toEqual({ kind: "chat", chatType: 4, message: "Restart in ten minutes", idempotencyKey: "web:scum-rcon-chat:server-1:42" });
expect(scumSourceRCONCommandRequest("server-1", "#SetTime 12").command).toBe("#SetTime 12");
expect(() => scumSourceRCONCommandRequest("server-1", "ListPlayers\nSetTime 12")).toThrow("管理指令必须是单行文本");
});
});