commit 84e8cb4

default  ·  2023-08-09 12:34:22 +0000 UTC
parent b3797d2
Added web interface for hide_followers_only.
1 files changed,  +11, -0
M html.c
M html.c
+11, -0
 1@@ -486,6 +486,9 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
 2         "<p><input type=\"checkbox\" name=\"bot\" id=\"bot\" %s>\n"
 3         "<label for=\"bot\">%s</label></p>\n"
 4 
 5+        "<p><input type=\"checkbox\" name=\"hide_followers_only\" id=\"hide_followers_only\" %s>\n"
 6+        "<label for=\"hide_followers_only\">%s</label></p>\n"
 7+
 8         "<p>%s:<br>\n"
 9         "<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n"
10 
11@@ -541,6 +544,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
12     xs *es5 = encode_html(telegram_chat_id);
13     xs *es6 = encode_html(purge_days);
14 
15+    const char *hfo = xs_dict_get(snac->config, "hide_followers_only");
16+
17     xs *s1 = xs_fmt(_tmpl,
18         L("New Post..."),
19         snac->actor,
20@@ -590,6 +595,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s)
21         L("Drop direct messages from people you don't follow"),
22         xs_type(bot) == XSTYPE_TRUE ? "checked" : "",
23         L("This account is a bot"),
24+        xs_type(hfo) == XSTYPE_TRUE ? "checked" : "",
25+        L("Hide posts for followers only (and not for you)"),
26         L("New password"),
27         L("Repeat new password"),
28         L("Update user info")
29@@ -2292,6 +2299,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
30             snac.config = xs_dict_set(snac.config, "bot", xs_stock_true);
31         else
32             snac.config = xs_dict_set(snac.config, "bot", xs_stock_false);
33+        if ((v = xs_dict_get(p_vars, "hide_followers_only")) != NULL && strcmp(v, "on") == 0)
34+            snac.config = xs_dict_set(snac.config, "hide_followers_only", xs_stock_true);
35+        else
36+            snac.config = xs_dict_set(snac.config, "hide_followers_only", xs_stock_false);
37 
38         /* avatar upload */
39         xs_list *avatar_file = xs_dict_get(p_vars, "avatar_file");