commit aa7ed9b

default  ·  2023-06-11 19:06:08 +0000 UTC
parent d9d4ffb
Added Web UI to set the account 'bot' flag.
1 files changed,  +11, -0
M html.c
M html.c
+11, -0
 1@@ -443,6 +443,9 @@ d_char *html_top_controls(snac *snac, d_char *s)
 2         "<p><input type=\"checkbox\" name=\"drop_dm_from_unknown\" id=\"drop_dm_from_unknown\" %s>\n"
 3         "<label for=\"drop_dm_from_unknown\">%s</label></p>\n"
 4 
 5+        "<p><input type=\"checkbox\" name=\"bot\" id=\"bot\" %s>\n"
 6+        "<label for=\"bot\">%s</label></p>\n"
 7+
 8         "<p>%s:<br>\n"
 9         "<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n"
10 
11@@ -490,6 +493,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
12 
13     const char *d_dm_f_u = xs_dict_get(snac->config, "drop_dm_from_unknown");
14 
15+    const char *bot = xs_dict_get(snac->config, "bot");
16+
17     xs *s1 = xs_fmt(_tmpl,
18         snac->actor,
19         L("Sensitive content"),
20@@ -535,6 +540,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
21         purge_days,
22         xs_type(d_dm_f_u) == XSTYPE_TRUE ? "checked" : "",
23         L("Drop direct messages from people you don't follow"),
24+        xs_type(bot) == XSTYPE_TRUE ? "checked" : "",
25+        L("This account is a bot"),
26         L("Password (only to change it)"),
27         L("Repeat Password"),
28         L("Update user info")
29@@ -2044,6 +2051,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
30             snac.config = xs_dict_set(snac.config, "drop_dm_from_unknown", byes);
31         else
32             snac.config = xs_dict_set(snac.config, "drop_dm_from_unknown", bno);
33+        if ((v = xs_dict_get(p_vars, "bot")) != NULL && strcmp(v, "on") == 0)
34+            snac.config = xs_dict_set(snac.config, "bot", byes);
35+        else
36+            snac.config = xs_dict_set(snac.config, "bot", bno);
37 
38         /* avatar upload */
39         xs_list *avatar_file = xs_dict_get(p_vars, "avatar_file");