commit e569607

grunfink  ·  2026-06-02 07:38:09 +0000 UTC
parent 41fea22
Added web UI to set the 'excluded_langs'.
1 files changed,  +14, -0
M html.c
M html.c
+14, -0
 1@@ -1613,6 +1613,7 @@ xs_html *html_top_controls(snac *user)
 2     const char *longitude    = xs_dict_get_def(user->config, "longitude", "");
 3     const char *webhook      = xs_dict_get_def(user->config, "notify_webhook", "");
 4     const char *post_langs   = xs_dict_get_def(user->config, "post_langs", "");
 5+    const char *excluded_langs = xs_dict_get_def(user->config, "excluded_langs", "");
 6 
 7     xs *metadata = NULL;
 8     const xs_dict *md = xs_dict_get(user->config, "metadata");
 9@@ -1850,6 +1851,15 @@ xs_html *html_top_controls(snac *user)
10                         xs_html_attr("value", post_langs),
11                         xs_html_attr("placeholder", L("en fr es de_AT")))),
12 
13+                xs_html_tag("p",
14+                    xs_html_text(L("Exclude posts written in these languages:")),
15+                    xs_html_sctag("br", NULL),
16+                    xs_html_sctag("input",
17+                        xs_html_attr("type", "text"),
18+                        xs_html_attr("name", "excluded_langs"),
19+                        xs_html_attr("value", excluded_langs),
20+                        xs_html_attr("placeholder", L("en fr es de_AT")))),
21+
22                 xs_html_tag("p",
23                     xs_html_text(L("New password:")),
24                     xs_html_sctag("br", NULL),
25@@ -5991,6 +6001,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
26             snac.config = xs_dict_set(snac.config, "tz", v);
27         if ((v = xs_dict_get(p_vars, "post_langs")) != NULL)
28             snac.config = xs_dict_set(snac.config, "post_langs", v);
29+        if ((v = xs_dict_get(p_vars, "excluded_langs")) != NULL)
30+            snac.config = xs_dict_set(snac.config, "excluded_langs", v);
31+        else
32+            snac.config = xs_dict_del(snac.config, "excluded_langs");
33 
34         snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", ""));
35         snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", ""));