Add recoverable administrator room removal and restoration
Preserve room JSON, seats, credentials and messages while removed rooms deny ordinary reads and writes. Add deliberate room-scoped controls, removed-directory filters, persistent player notices and live-authorized atomic version/revision audit receipts. Retain uncertain room/seat requests and hidden recovery drafts through removal; restore the prior pause/join settings without reviving revoked credentials. Fix AI readiness after a joining human or human faction change so real lobby starts remain legal. Verified types, lint, 5314 offline tests, 52 HTTP tests and build. Fourteen authenticated HTTP groups and independent privacy/persistence review passed. Desktop/mobile browser QA confirmed a saved removal after a lost response and refresh, one audit on exact retry, persistent notices and recovery draft continuity. All 1,945 baseline rooms, 4,121 seats and related records preserved. Positive authenticated production admin acceptance remains pending authorized QA operator access; full admin and rules gates remain open.
This commit is contained in:
1 parent
c0cc4de9e1
commit
238de3860d
44 files changed
+4626
-90
No files matched your search
@@ -137,8 +137,10 @@ export async function createAdminRoom(
|
||||
),
|
||||
database
|
||||
.prepare(`SELECT c.operation_id,c.actor_admin_id,c.room_code,c.host_id,c.request_hash,c.session_hash,
|
||||
EXISTS (SELECT 1 FROM room_removals WHERE room_code = c.room_code AND removed = 1) AS room_removed,
|
||||
EXISTS (SELECT 1 FROM seats s JOIN rooms r ON r.code = s.room_code
|
||||
WHERE s.token_hash = c.session_hash AND s.room_code = c.room_code AND s.player_id = c.host_id AND s.revoked = 0
|
||||
AND NOT EXISTS (SELECT 1 FROM room_removals WHERE room_code = r.code AND removed = 1)
|
||||
AND CASE WHEN json_valid(r.state) THEN EXISTS (
|
||||
SELECT 1 FROM json_each(CASE WHEN json_type(r.state, '$.players') = 'array' THEN json_extract(r.state, '$.players') ELSE '[]' END) p
|
||||
WHERE json_extract(CASE WHEN p.type = 'object' THEN p.value ELSE '{}' END, '$.id') = c.host_id
|
||||
@@ -168,6 +170,7 @@ export async function createAdminRoom(
|
||||
request_hash: string;
|
||||
session_hash: string;
|
||||
host_access: number;
|
||||
room_removed: number;
|
||||
}
|
||||
| undefined;
|
||||
if (receipt) {
|
||||
@@ -186,6 +189,7 @@ export async function createAdminRoom(
|
||||
hostId: receipt.host_id,
|
||||
replayed: results[1].meta.changes !== 1,
|
||||
hostAccess: receipt.host_access === 1,
|
||||
...(receipt.room_removed === 1 ? { roomRemoved: true as const } : {}),
|
||||
};
|
||||
}
|
||||
const conflict = results[5].results[0] as {
|
||||
|
||||
Reference in new issue
Block a user