mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 15:51:26 +00:00
feat(notifications): ntfy/Gotify push channels with live delivery (#69)
Per-user notification_channels (ntfy + Gotify): every
insertUserNotification now fans out best-effort to enabled channels —
deployment/backup/security/agent alerts reach the user's phone via the
ntfy app with zero extra infrastructure.
- POST/GET/DELETE /notifications/channels + POST .../:id/test which
pushes a real probe so misconfiguration surfaces before alerts depend
on it (502 DELIVERY_FAILED on endpoint errors).
- ntfy: POST to endpoint (topic in path), Title/Tags headers, optional
Bearer token. Gotify: POST {endpoint}/message?token=...
- Delivery is best-effort by design — a dead relay never breaks the
producing flow; one shared 5s-timeout client.
- CLI `notifications channels list|add|test|remove`, MCP tools,
OpenAPI paths + NotificationChannel schema.
- Web settings "Push notifications" section and a Push channels card on
the mobile notifications tab (add/test/remove).
Verified live: channel CRUD, test-ping hit a recording endpoint with
correct headers/body, and a real deployment fanned out "Deployment
succeeded" through the channel end-to-end.
Generated with [Devin](https://devin.ai)
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
60145f7b21
commit
9243d020cc
19 files changed
+1261
-6
No files matched your search
@@ -94,6 +94,14 @@ export interface AppNotification {
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
export interface NotificationChannel {
|
||||
id: string;
|
||||
kind: 'ntfy' | 'gotify';
|
||||
endpoint: string;
|
||||
enabled: boolean;
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
// Masked value the API returns for secret variables; echoing it back on
|
||||
// update preserves the stored ciphertext.
|
||||
export const MASKED_SECRET = '********';
|
||||
@@ -238,6 +246,33 @@ export class Api {
|
||||
return this.req<unknown>('POST', '/notifications/read-all');
|
||||
}
|
||||
|
||||
notificationChannels() {
|
||||
return this.req<{ channels: NotificationChannel[] }>(
|
||||
'GET',
|
||||
'/notifications/channels',
|
||||
).then((r) => r.channels ?? []);
|
||||
}
|
||||
|
||||
addNotificationChannel(input: {
|
||||
kind: 'ntfy' | 'gotify';
|
||||
endpoint: string;
|
||||
token?: string;
|
||||
}) {
|
||||
return this.req<{ channel: NotificationChannel }>(
|
||||
'POST',
|
||||
'/notifications/channels',
|
||||
input,
|
||||
);
|
||||
}
|
||||
|
||||
deleteNotificationChannel(id: string) {
|
||||
return this.req<unknown>('DELETE', `/notifications/channels/${id}`);
|
||||
}
|
||||
|
||||
testNotificationChannel(id: string) {
|
||||
return this.req<unknown>('POST', `/notifications/channels/${id}/test`, {});
|
||||
}
|
||||
|
||||
serviceDeployments(id: string) {
|
||||
return this.req<{ deployments: Deployment[] }>(
|
||||
'GET',
|
||||
|
||||
Reference in new issue
Block a user