+
diff --git a/Overlord-Server/src/main-server.ts b/Overlord-Server/src/main-server.ts
index e3bc828..382f4f3 100644
--- a/Overlord-Server/src/main-server.ts
+++ b/Overlord-Server/src/main-server.ts
@@ -12,7 +12,7 @@ import { v4 as uuidv4 } from "uuid";
import { authenticateRequest } from "./auth";
import { loadConfig, getConfig } from "./config";
import { flushAuditLogsSync } from "./auditLog";
-import { getUserById, getUsersForNotificationDeliveryByClient, canUserAccessClient, setUserClientAccessRule, setUserClientAccessScope, getUserClientAccessScope } from "./users";
+import { getUserById, getUsersForNotificationDelivery, getUsersForNotificationDeliveryByClient, canUserAccessClient, setUserClientAccessRule, setUserClientAccessScope, getUserClientAccessScope } from "./users";
import { requireAuth, requirePermission } from "./rbac";
import { metrics } from "./metrics";
import { ensureDataDir } from "./paths";
@@ -282,6 +282,25 @@ const notificationPluginHandlers = createNotificationPluginHandlers({
getUserRole: (userId: number) => getUserById(userId)?.role,
storeNotificationScreenshot: storeNotificationScreenshotForPending,
deliverNotificationWithScreenshot: deliverNotificationWithScreenshotForRecord,
+ getDeliveryTargetsForClientEvent: (event: string, clientId: string): UserDeliveryTarget[] => {
+ const mapRow = (u: any): UserDeliveryTarget => ({
+ userId: u.id,
+ username: u.username,
+ webhookEnabled: u.webhook_enabled === 1,
+ webhookUrl: u.webhook_url || "",
+ webhookTemplate: u.webhook_template,
+ telegramEnabled: u.telegram_enabled === 1,
+ telegramBotToken: u.telegram_bot_token || "",
+ telegramChatId: u.telegram_chat_id || "",
+ telegramTemplate: u.telegram_template,
+ });
+ if (event === "client_purgatory") {
+ return getUsersForNotificationDelivery()
+ .filter((u) => u.role === "admin" || u.role === "operator")
+ .map(mapRow);
+ }
+ return getUsersForNotificationDeliveryByClient(clientId).map(mapRow);
+ },
savePluginState,
});
diff --git a/Overlord-Server/src/server/notification-delivery.ts b/Overlord-Server/src/server/notification-delivery.ts
index def208c..7db53cf 100644
--- a/Overlord-Server/src/server/notification-delivery.ts
+++ b/Overlord-Server/src/server/notification-delivery.ts
@@ -385,3 +385,120 @@ export async function deliverNotificationWithScreenshot(
]);
}
+export type ClientEventInfo = {
+ id: string;
+ host?: string;
+ user?: string;
+ os?: string;
+ ip?: string;
+ country?: string;
+};
+
+const CLIENT_EVENT_LABELS: Record