commit b2598ca
default
·
2023-06-26 06:54:09 +0000 UTC
parent 7a0efc3
If the user style.css does not exist, return the server-wide version.
1 files changed,
+13,
-1
M
html.c
M
html.c
+13,
-1
1@@ -225,7 +225,19 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
2 xs *css = NULL;
3 int size;
4
5- if (valid_status(static_get(snac, "style.css", &css, &size))) {
6+ /* try to open the user css */
7+ if (!valid_status(static_get(snac, "style.css", &css, &size))) {
8+ /* it's not there; try to open the server-wide css */
9+ FILE *f;
10+ xs *g_css_fn = xs_fmt("%s/style.css", srv_basedir);
11+
12+ if ((f = fopen(g_css_fn, "r")) != NULL) {
13+ css = xs_readall(f);
14+ fclose(f);
15+ }
16+ }
17+
18+ if (css != NULL) {
19 xs *s1 = xs_fmt("<style>%s</style>\n", css);
20 s = xs_str_cat(s, s1);
21 }