diff options
| author | 2023-06-26 08:54:09 +0200 | |
|---|---|---|
| committer | 2023-06-26 08:54:09 +0200 | |
| commit | b2598ca307cacb17977e2748730a6a6c37687935 (patch) | |
| tree | c0536cdee6b60ecf3817a2ee84fc4bd564a86bf4 /html.c | |
| parent | Increased log level for 'not for us' messages. (diff) | |
| download | snac2-b2598ca307cacb17977e2748730a6a6c37687935.tar.gz snac2-b2598ca307cacb17977e2748730a6a6c37687935.tar.xz snac2-b2598ca307cacb17977e2748730a6a6c37687935.zip | |
If the user style.css does not exist, return the server-wide version.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -225,7 +225,19 @@ d_char *html_user_header(snac *snac, d_char *s, int local) | |||
| 225 | xs *css = NULL; | 225 | xs *css = NULL; |
| 226 | int size; | 226 | int size; |
| 227 | 227 | ||
| 228 | if (valid_status(static_get(snac, "style.css", &css, &size))) { | 228 | /* try to open the user css */ |
| 229 | if (!valid_status(static_get(snac, "style.css", &css, &size))) { | ||
| 230 | /* it's not there; try to open the server-wide css */ | ||
| 231 | FILE *f; | ||
| 232 | xs *g_css_fn = xs_fmt("%s/style.css", srv_basedir); | ||
| 233 | |||
| 234 | if ((f = fopen(g_css_fn, "r")) != NULL) { | ||
| 235 | css = xs_readall(f); | ||
| 236 | fclose(f); | ||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | if (css != NULL) { | ||
| 229 | xs *s1 = xs_fmt("<style>%s</style>\n", css); | 241 | xs *s1 = xs_fmt("<style>%s</style>\n", css); |
| 230 | s = xs_str_cat(s, s1); | 242 | s = xs_str_cat(s, s1); |
| 231 | } | 243 | } |