commit 7a62d55
grunfink
·
2026-09-01 14:19:37 +0000 UTC
parent 32953e4
Added web UI for setting the 'text_browser_uas' user config field.
1 files changed,
+14,
-1
M
html.c
M
html.c
+14,
-1
1@@ -1624,6 +1624,7 @@ xs_html *html_top_controls(snac *user, int tb_friendly)
2 const char *webhook = xs_dict_get_def(user->config, "notify_webhook", "");
3 const char *post_langs = xs_dict_get_def(user->config, "post_langs", "");
4 const char *excluded_langs = xs_dict_get_def(user->config, "excluded_langs", "");
5+ const char *text_browser_uas = xs_dict_get_def(user->config, "text_browser_uas", "");
6
7 xs *metadata = NULL;
8 const xs_dict *md = xs_dict_get(user->config, "metadata");
9@@ -1870,6 +1871,16 @@ xs_html *html_top_controls(snac *user, int tb_friendly)
10 xs_html_attr("value", excluded_langs),
11 xs_html_attr("placeholder", L("en fr es de_AT")))),
12
13+ xs_html_tag("p",
14+ xs_html_text(L("Show a simpler web UI for browsers with these user agents (one per line):")),
15+ xs_html_sctag("br", NULL),
16+ xs_html_tag("textarea",
17+ xs_html_attr("name", "text_browser_uas"),
18+ xs_html_attr("cols", "40"),
19+ xs_html_attr("rows", "4"),
20+ xs_html_attr("placeholder", "Links\nLynx\nNetSurf"),
21+ xs_html_text(text_browser_uas))),
22+
23 xs_html_tag("p",
24 xs_html_text(L("New password:")),
25 xs_html_sctag("br", NULL),
26@@ -4698,7 +4709,7 @@ int text_browser_friendly(const snac *user, const char *user_agent)
27
28 xs *v2 = xs_strip_i(xs_dup(v));
29
30- /* a * means "all browsers", then yes */
31+ /* an asterisk alone means "all browsers", so yes */
32 if (strcmp(v2, "*") == 0)
33 return 1;
34
35@@ -6119,6 +6130,8 @@ int html_post_handler(const xs_dict *req, const char *q_path,
36 if ((v = xs_dict_get(p_vars, "metadata")) != NULL)
37 snac.config = xs_dict_set(snac.config, "metadata", v);
38
39+ snac.config = xs_dict_set(snac.config, "text_browser_uas", xs_dict_get_def(p_vars, "text_browser_uas", ""));
40+
41 /* uploads */
42 const char *uploads[] = { "avatar", "header", NULL };
43 int n;