snac2

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

commit 4175c7022649cfd5446cc32fca5d16139f7b494d
parent 645900c5d2831b39d5b6e4bf159fe8528e6d902d
Author: default <nobody@localhost>
Date:   Wed,  3 Jul 2024 13:34:22 +0200

Added web UI for the auto-boost option.

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

diff --git a/html.c b/html.c @@ -1001,6 +1001,7 @@ xs_html *html_top_controls(snac *snac) const xs_val *d_dm_f_u = xs_dict_get(snac->config, "drop_dm_from_unknown"); const xs_val *bot = xs_dict_get(snac->config, "bot"); const xs_val *a_private = xs_dict_get(snac->config, "private"); + const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost"); xs *metadata = xs_str_new(NULL); const xs_dict *md = xs_dict_get(snac->config, "metadata"); @@ -1138,6 +1139,15 @@ xs_html *html_top_controls(snac *snac) xs_html_tag("p", xs_html_sctag("input", xs_html_attr("type", "checkbox"), + xs_html_attr("name", "auto_boost"), + xs_html_attr("id", "auto_boost"), + xs_html_attr(xs_is_true(auto_boost) ? "checked" : "", NULL)), + xs_html_tag("label", + xs_html_attr("for", "auto_boost"), + xs_html_text(L("Auto-boost all mentions to this account")))), + xs_html_tag("p", + xs_html_sctag("input", + xs_html_attr("type", "checkbox"), xs_html_attr("name", "private"), xs_html_attr("id", "private"), xs_html_attr(xs_type(a_private) == XSTYPE_TRUE ? "checked" : "", NULL)), @@ -3337,6 +3347,11 @@ int html_post_handler(const xs_dict *req, const char *q_path, snac.config = xs_dict_set(snac.config, "private", xs_stock(XSTYPE_TRUE)); else snac.config = xs_dict_set(snac.config, "private", xs_stock(XSTYPE_FALSE)); + if ((v = xs_dict_get(p_vars, "auto_boost")) != NULL && strcmp(v, "on") == 0) + snac.config = xs_dict_set(snac.config, "auto_boost", xs_stock(XSTYPE_TRUE)); + else + snac.config = xs_dict_set(snac.config, "auto_boost", xs_stock(XSTYPE_FALSE)); + if ((v = xs_dict_get(p_vars, "metadata")) != NULL) { /* split the metadata and store it as a dict */ xs_dict *md = xs_dict_new();