commit ffc7e52

grunfink  ·  2025-05-30 17:13:40 +0000 UTC
parent e1b6ea0
Added web UI to set the notify webhook.
1 files changed,  +11, -0
M html.c
M html.c
+11, -0
 1@@ -1290,6 +1290,7 @@ xs_html *html_top_controls(snac *user)
 2     const xs_val *show_foll  = xs_dict_get(user->config, "show_contact_metrics");
 3     const char *latitude     = xs_dict_get_def(user->config, "latitude", "");
 4     const char *longitude    = xs_dict_get_def(user->config, "longitude", "");
 5+    const char *webhook      = xs_dict_get_def(user->config, "notify_webhook", "");
 6 
 7     xs *metadata = NULL;
 8     const xs_dict *md = xs_dict_get(user->config, "metadata");
 9@@ -1451,6 +1452,14 @@ xs_html *html_top_controls(snac *user)
10                         xs_html_attr("name", "ntfy_token"),
11                         xs_html_attr("value", ntfy_token),
12                         xs_html_attr("placeholder", L("ntfy token - if needed")))),
13+                xs_html_tag("p",
14+                    xs_html_text(L("Notify webhook:")),
15+                    xs_html_sctag("br", NULL),
16+                    xs_html_sctag("input",
17+                        xs_html_attr("type", "url"),
18+                        xs_html_attr("name", "notify_webhook"),
19+                        xs_html_attr("value", webhook),
20+                        xs_html_attr("placeholder", L("http://example.com/webhook")))),
21                 xs_html_tag("p",
22                     xs_html_text(L("Maximum days to keep posts (0: server settings):")),
23                     xs_html_sctag("br", NULL),
24@@ -4822,6 +4831,8 @@ int html_post_handler(const xs_dict *req, const char *q_path,
25         snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", ""));
26         snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", ""));
27 
28+        snac.config = xs_dict_set(snac.config, "notify_webhook", xs_dict_get_def(p_vars, "notify_webhook", ""));
29+
30         if ((v = xs_dict_get(p_vars, "metadata")) != NULL)
31             snac.config = xs_dict_set(snac.config, "metadata", v);
32