mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-20 07:23:13 +09:00
Add a watch list and read state to exp_reports
Players on the watch list are announced to every online admin on every instance when they join, and the join is posted to the Discord and JSON webhooks. The Reports page has a second table for the watch list with an Add button and a Delete button per row. Reports can be marked read or unread from the web interface. Each report row also has an Add to watch list button which opens the add form filled in with the player and reason. Setting exp_reports.watch_unread_reports treats players with unread reports as watched. Reports now store created_at_ms because marking them read changes updated_at_ms. Old reports.json files migrate on load with updated_at_ms as the creation time. The report webhook moved from the datastore update listener to the create handler so reading a report is not posted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82abc2c332
commit
44ae3a5f0e
14 files changed
+826
-43
No files matched your search
@@ -7,12 +7,18 @@ import * as messages from "../messages.js";
|
||||
import ReportsPage from "./components/ReportsPage";
|
||||
|
||||
let reports: lib.MapSubscriber<messages.ReportUpdatedEvent> | undefined;
|
||||
let watchList: lib.MapSubscriber<messages.WatchListUpdatedEvent> | undefined;
|
||||
|
||||
export function useReports() {
|
||||
const subscribe = useCallback((cb: () => void) => reports!.subscribe(cb), []);
|
||||
return useSyncExternalStore(subscribe, () => reports!.getSnapshot());
|
||||
}
|
||||
|
||||
export function useWatchList() {
|
||||
const subscribe = useCallback((cb: () => void) => watchList!.subscribe(cb), []);
|
||||
return useSyncExternalStore(subscribe, () => watchList!.getSnapshot());
|
||||
}
|
||||
|
||||
export default function registerPlugin(context: WebPluginContext) {
|
||||
context.control.hooks.pages.attach("exp_reports", () => [
|
||||
{
|
||||
@@ -24,4 +30,5 @@ export default function registerPlugin(context: WebPluginContext) {
|
||||
]);
|
||||
|
||||
reports = new lib.MapSubscriber(messages.ReportUpdatedEvent, context.control);
|
||||
watchList = new lib.MapSubscriber(messages.WatchListUpdatedEvent, context.control);
|
||||
}
|
||||
Reference in new issue
Block a user