summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2025-05-30 19:13:40 +0200
committerGravatar grunfink2025-05-30 19:13:40 +0200
commitffc7e52c6679d6cfeaa0567941cf803351031dcd (patch)
treed740e63c165802bf7c114ac5bc4a017623cfaae7
parentauto_follower_webhook.py new example program. (diff)
downloadpenes-snac2-ffc7e52c6679d6cfeaa0567941cf803351031dcd.tar.gz
penes-snac2-ffc7e52c6679d6cfeaa0567941cf803351031dcd.tar.xz
penes-snac2-ffc7e52c6679d6cfeaa0567941cf803351031dcd.zip
Added web UI to set the notify webhook.
-rw-r--r--html.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/html.c b/html.c
index 56dc2cc..a6e5f98 100644
--- a/html.c
+++ b/html.c
@@ -1290,6 +1290,7 @@ xs_html *html_top_controls(snac *user)
1290 const xs_val *show_foll = xs_dict_get(user->config, "show_contact_metrics"); 1290 const xs_val *show_foll = xs_dict_get(user->config, "show_contact_metrics");
1291 const char *latitude = xs_dict_get_def(user->config, "latitude", ""); 1291 const char *latitude = xs_dict_get_def(user->config, "latitude", "");
1292 const char *longitude = xs_dict_get_def(user->config, "longitude", ""); 1292 const char *longitude = xs_dict_get_def(user->config, "longitude", "");
1293 const char *webhook = xs_dict_get_def(user->config, "notify_webhook", "");
1293 1294
1294 xs *metadata = NULL; 1295 xs *metadata = NULL;
1295 const xs_dict *md = xs_dict_get(user->config, "metadata"); 1296 const xs_dict *md = xs_dict_get(user->config, "metadata");
@@ -1452,6 +1453,14 @@ xs_html *html_top_controls(snac *user)
1452 xs_html_attr("value", ntfy_token), 1453 xs_html_attr("value", ntfy_token),
1453 xs_html_attr("placeholder", L("ntfy token - if needed")))), 1454 xs_html_attr("placeholder", L("ntfy token - if needed")))),
1454 xs_html_tag("p", 1455 xs_html_tag("p",
1456 xs_html_text(L("Notify webhook:")),
1457 xs_html_sctag("br", NULL),
1458 xs_html_sctag("input",
1459 xs_html_attr("type", "url"),
1460 xs_html_attr("name", "notify_webhook"),
1461 xs_html_attr("value", webhook),
1462 xs_html_attr("placeholder", L("http://example.com/webhook")))),
1463 xs_html_tag("p",
1455 xs_html_text(L("Maximum days to keep posts (0: server settings):")), 1464 xs_html_text(L("Maximum days to keep posts (0: server settings):")),
1456 xs_html_sctag("br", NULL), 1465 xs_html_sctag("br", NULL),
1457 xs_html_sctag("input", 1466 xs_html_sctag("input",
@@ -4822,6 +4831,8 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4822 snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", "")); 4831 snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", ""));
4823 snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", "")); 4832 snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", ""));
4824 4833
4834 snac.config = xs_dict_set(snac.config, "notify_webhook", xs_dict_get_def(p_vars, "notify_webhook", ""));
4835
4825 if ((v = xs_dict_get(p_vars, "metadata")) != NULL) 4836 if ((v = xs_dict_get(p_vars, "metadata")) != NULL)
4826 snac.config = xs_dict_set(snac.config, "metadata", v); 4837 snac.config = xs_dict_set(snac.config, "metadata", v);
4827 4838