snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit ffc7e52c6679d6cfeaa0567941cf803351031dcd
parent e1b6ea0cbee222839185cdb608bc729c970dd1ec
Author: grunfink <grunfink@comam.es>
Date:   Fri, 30 May 2025 19:13:40 +0200

Added web UI to set the notify webhook.

Diffstat:
Mhtml.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/html.c b/html.c @@ -1290,6 +1290,7 @@ xs_html *html_top_controls(snac *user) const xs_val *show_foll = xs_dict_get(user->config, "show_contact_metrics"); const char *latitude = xs_dict_get_def(user->config, "latitude", ""); const char *longitude = xs_dict_get_def(user->config, "longitude", ""); + const char *webhook = xs_dict_get_def(user->config, "notify_webhook", ""); xs *metadata = NULL; const xs_dict *md = xs_dict_get(user->config, "metadata"); @@ -1452,6 +1453,14 @@ xs_html *html_top_controls(snac *user) xs_html_attr("value", ntfy_token), xs_html_attr("placeholder", L("ntfy token - if needed")))), xs_html_tag("p", + xs_html_text(L("Notify webhook:")), + xs_html_sctag("br", NULL), + xs_html_sctag("input", + xs_html_attr("type", "url"), + xs_html_attr("name", "notify_webhook"), + xs_html_attr("value", webhook), + xs_html_attr("placeholder", L("http://example.com/webhook")))), + xs_html_tag("p", xs_html_text(L("Maximum days to keep posts (0: server settings):")), xs_html_sctag("br", NULL), xs_html_sctag("input", @@ -4822,6 +4831,8 @@ int html_post_handler(const xs_dict *req, const char *q_path, snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", "")); snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", "")); + snac.config = xs_dict_set(snac.config, "notify_webhook", xs_dict_get_def(p_vars, "notify_webhook", "")); + if ((v = xs_dict_get(p_vars, "metadata")) != NULL) snac.config = xs_dict_set(snac.config, "metadata", v);