commit 4175c70
default
·
2024-07-03 11:34:22 +0000 UTC
parent 645900c
Added web UI for the auto-boost option.
1 files changed,
+15,
-0
M
html.c
M
html.c
+15,
-0
1@@ -1001,6 +1001,7 @@ xs_html *html_top_controls(snac *snac)
2 const xs_val *d_dm_f_u = xs_dict_get(snac->config, "drop_dm_from_unknown");
3 const xs_val *bot = xs_dict_get(snac->config, "bot");
4 const xs_val *a_private = xs_dict_get(snac->config, "private");
5+ const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost");
6
7 xs *metadata = xs_str_new(NULL);
8 const xs_dict *md = xs_dict_get(snac->config, "metadata");
9@@ -1135,6 +1136,15 @@ xs_html *html_top_controls(snac *snac)
10 xs_html_tag("label",
11 xs_html_attr("for", "bot"),
12 xs_html_text(L("This account is a bot")))),
13+ xs_html_tag("p",
14+ xs_html_sctag("input",
15+ xs_html_attr("type", "checkbox"),
16+ xs_html_attr("name", "auto_boost"),
17+ xs_html_attr("id", "auto_boost"),
18+ xs_html_attr(xs_is_true(auto_boost) ? "checked" : "", NULL)),
19+ xs_html_tag("label",
20+ xs_html_attr("for", "auto_boost"),
21+ xs_html_text(L("Auto-boost all mentions to this account")))),
22 xs_html_tag("p",
23 xs_html_sctag("input",
24 xs_html_attr("type", "checkbox"),
25@@ -3337,6 +3347,11 @@ int html_post_handler(const xs_dict *req, const char *q_path,
26 snac.config = xs_dict_set(snac.config, "private", xs_stock(XSTYPE_TRUE));
27 else
28 snac.config = xs_dict_set(snac.config, "private", xs_stock(XSTYPE_FALSE));
29+ if ((v = xs_dict_get(p_vars, "auto_boost")) != NULL && strcmp(v, "on") == 0)
30+ snac.config = xs_dict_set(snac.config, "auto_boost", xs_stock(XSTYPE_TRUE));
31+ else
32+ snac.config = xs_dict_set(snac.config, "auto_boost", xs_stock(XSTYPE_FALSE));
33+
34 if ((v = xs_dict_get(p_vars, "metadata")) != NULL) {
35 /* split the metadata and store it as a dict */
36 xs_dict *md = xs_dict_new();