Add test notification endpoint and UI button

- Add POST /api/test-notification endpoint to send test to saved config URL
- Refactor send_notification to return Result instead of bool
- Add NotificationError enum for proper error handling
- Add test notification button in config UI with explanatory text
- Button tests saved configuration URL, not input field value
This commit is contained in:
Rupert Carr
2025-12-25 00:51:50 +00:00
committed by Markus Unterwaditzer
parent 579c2c1f3f
commit d3290a2c2d
5 changed files with 142 additions and 24 deletions

View File

@@ -23,6 +23,7 @@ use crate::pcap::get_pcap;
use crate::qmdl_store::RecordingStore;
use crate::server::{
ServerState, debug_set_display_state, get_config, get_qmdl, get_zip, serve_static, set_config,
test_notification,
};
use crate::stats::{get_qmdl_manifest, get_system_stats};
@@ -68,6 +69,7 @@ fn get_router() -> AppRouter {
.route("/api/analysis/{name}", post(start_analysis))
.route("/api/config", get(get_config))
.route("/api/config", post(set_config))
.route("/api/test-notification", post(test_notification))
.route("/api/debug/display-state", post(debug_set_display_state))
.route("/", get(|| async { Redirect::permanent("/index.html") }))
.route("/{*path}", get(serve_static))