summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-06-26 08:54:09 +0200
committerdefault <nobody@localhost>2023-06-26 08:54:09 +0200
commitb2598ca307cacb17977e2748730a6a6c37687935 (patch)
treec0536cdee6b60ecf3817a2ee84fc4bd564a86bf4 /html.c
parent7a0efc368040ed51610a3a224b021b4cc183d85b (diff)
If the user style.css does not exist, return the server-wide version.
Diffstat (limited to 'html.c')
-rw-r--r--html.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/html.c b/html.c
index 35e3fb8..b120f9f 100644
--- a/html.c
+++ b/html.c
@@ -225,7 +225,19 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
xs *css = NULL;
int size;
- if (valid_status(static_get(snac, "style.css", &css, &size))) {
+ /* try to open the user css */
+ if (!valid_status(static_get(snac, "style.css", &css, &size))) {
+ /* it's not there; try to open the server-wide css */
+ FILE *f;
+ xs *g_css_fn = xs_fmt("%s/style.css", srv_basedir);
+
+ if ((f = fopen(g_css_fn, "r")) != NULL) {
+ css = xs_readall(f);
+ fclose(f);
+ }
+ }
+
+ if (css != NULL) {
xs *s1 = xs_fmt("<style>%s</style>\n", css);
s = xs_str_cat(s, s1);
}