Notification routing rules, per-browser push wishes, escalation of unacknowledged alerts

- Routing: rules pick channels by kind, severity and server tags (first match wins, none = nobody); mixed batches split per route; recoveries follow their alert; quiet-hours digest keeps each notification's audience
- Push: each subscribed browser can ask for a minimum severity and some kinds
- Escalation: up to three timed steps re-notify alerts nobody has acknowledged, through chosen channels and an optional extra email; an acknowledgement stops them
- Fix ntfy: titles with an em dash made every ntfy send fail (header not Latin-1); now RFC 2047 encoded

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 19:44:45 +02:00
1 parent 9caa414829
commit 43fc5e0272
21 files changed
+4769 -55

No files matched your search

+34
View File
@@ -409,6 +409,32 @@ export interface WebhookSettings {
secret: string;
}
export type NotifyChannelId = "gotify" | "ntfy" | "smtp" | "webhook" | "webPush";
export interface RoutingRule {
id: string;
name: string;
enabled: boolean;
categories: AlertCategory[];
minSeverity: "warning" | "critical" | null;
tags: string[];
channels: NotifyChannelId[];
}
export interface RoutingSettings {
rules: RoutingRule[];
}
export interface EscalationStep {
afterMinutes: number;
minSeverity: "warning" | "critical";
channels: NotifyChannelId[];
extraEmail: string;
evenInQuietHours: boolean;
}
export interface EscalationSettings {
enabled: boolean;
steps: EscalationStep[];
}
export interface WebPushSettings {
enabled: boolean;
/** An email address or https address a push service can reach whoever runs this on. Blank is fine. */
@@ -423,6 +449,10 @@ export interface PushDevice {
endpoint: string;
createdAt: string;
lastSuccessAt: string | null;
/** This browser only wants alerts at least this bad; null = every severity. */
minSeverity: "warning" | "critical" | null;
/** Only these kinds of alert; null = every kind. */
categories: AlertCategory[] | null;
}
export interface NotificationEvents {
@@ -490,6 +520,8 @@ export interface AppSettings {
smtp: SmtpSettings;
webhook: WebhookSettings;
webPush: WebPushSettings;
routing: RoutingSettings;
escalation: EscalationSettings;
notifications: NotificationEvents;
providerColors: Record<string, string>;
integrationColors: Record<string, string>;
@@ -1718,6 +1750,8 @@ export const api = {
mine: () => request<{ enabled: boolean; subscriptions: PushDevice[] }>("/api/push/mine"),
subscribe: (data: { endpoint: string; keys: { p256dh: string; auth: string }; label?: string }) => request<{ id: number }>("/api/push/subscribe", { method: "POST", body: JSON.stringify(data) }),
remove: (id: number) => request<void>(`/api/push/${id}`, { method: "DELETE" }),
setPrefs: (id: number, data: { minSeverity: "warning" | "critical" | null; categories: AlertCategory[] | null }) =>
request<{ minSeverity: string | null; categories: AlertCategory[] | null }>(`/api/push/${id}`, { method: "PATCH", body: JSON.stringify(data) }),
test: () => request<{ sent: number; removed: number; failed: number }>("/api/push/test", { method: "POST" }),
},
dependencies: {