commit 0e30411

grunfink  ·  2025-06-18 07:40:10 +0000 UTC
parent 9b134e9
New field 'favicon_url' in server.json.
1 files changed,  +9, -4
M html.c
M html.c
+9, -4
 1@@ -636,13 +636,18 @@ static xs_html *html_base_head(void)
 2             xs_html_attr("content", USER_AGENT)));
 3 
 4     /* add server CSS and favicon */
 5-    xs *f;
 6-    f = xs_fmt("%s/favicon.ico", srv_baseurl);
 7+    xs *f = NULL;
 8+    const char *favicon = xs_dict_get(srv_config, "favicon_url");
 9+
10+    if (xs_is_string(favicon))
11+        f = xs_dup(favicon);
12+    else
13+        f = xs_fmt("%s/favicon.ico", srv_baseurl);
14+
15     const xs_list *p = xs_dict_get(srv_config, "cssurls");
16     const char *v;
17-    int c = 0;
18 
19-    while (xs_list_next(p, &v, &c)) {
20+    xs_list_foreach(p, v) {
21         xs_html_add(head,
22             xs_html_sctag("link",
23                 xs_html_attr("rel",  "stylesheet"),