The missing piece of hands-off updates/backups: when a task fails while nobody has the WebUI open, LibrePortal now says so — email (via the existing Mail settings), ntfy, Gotify, Discord, Slack, Telegram, or Pushover, configured under Settings → Notifications. One hook, everywhere: the task processor reports every terminal task to `libreportal notify task <id>` (detached, never load-bearing — hard curl timeouts, failures ignored). The POLICY lives in the notify command, not the daemon: CFG_NOTIFY_EVENTS = failures (default) | all | off, and cancelled tasks never notify. Failure copy is task-aware — a failed update says the app was already rolled back and won't be retried, so the reader knows the box is safe before opening the WebUI. `libreportal notify test` sends to every enabled channel with per-channel results. Verified against a local mock endpoint: all webhook payloads, JSON escaping (quotes/newlines), the events policy, and fail-fast on dead endpoints (8ms, exit nonzero). The v0.1.0 per-app NOTIFY_* field-mapping scaffolding (never wired to a sender) stays as-is; this global channel is the system it was waiting on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
21 lines
866 B
Bash
21 lines
866 B
Bash
#!/bin/bash
|
|
|
|
# Notification Commands Header
|
|
# Shows available `libreportal notify` subcommands.
|
|
|
|
cliShowNotifyHelp()
|
|
{
|
|
echo ""
|
|
echo "Available Notification Commands:"
|
|
echo ""
|
|
echo " libreportal notify test - Send a test message to every enabled channel"
|
|
echo " libreportal notify send <sev> <title> <body> - Send one message now (sev: info|high)"
|
|
echo " libreportal notify task <task-id> - Notify about a finished task (used by the task processor)"
|
|
echo ""
|
|
echo "Channels (email, ntfy, Gotify, Discord, Slack, Telegram, Pushover) are"
|
|
echo "configured under Settings → Notifications. The default policy notifies"
|
|
echo "on FAILED background tasks only — a failed automatic update or backup"
|
|
echo "reaches you without the WebUI being open. Cancelled tasks never notify."
|
|
echo ""
|
|
}
|