summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2025-01-02 07:27:48 +0100
committerGravatar default2025-01-02 07:27:48 +0100
commit7f2be13079c33db115ccd71cfc363fee9ef127ed (patch)
tree86634950c65f43ecef480886980af1e7695c87cb
parentMinor tweak to the /share webpoint. (diff)
downloadsnac2-7f2be13079c33db115ccd71cfc363fee9ef127ed.tar.gz
snac2-7f2be13079c33db115ccd71cfc363fee9ef127ed.tar.xz
snac2-7f2be13079c33db115ccd71cfc363fee9ef127ed.zip
Serve BASE_URL/style.css.
I thought I was already doing this 🤦(not that it really matters much).
-rw-r--r--httpd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/httpd.c b/httpd.c
index d796f25..60f451a 100644
--- a/httpd.c
+++ b/httpd.c
@@ -275,6 +275,19 @@ int server_get_handler(xs_dict *req, const char *q_path,
275 "Disallow: /\n"); 275 "Disallow: /\n");
276 } 276 }
277 else 277 else
278 if (strcmp(q_path, "/style.css") == 0) {
279 FILE *f;
280 xs *css_fn = xs_fmt("%s/style.css", srv_basedir);
281
282 if ((f = fopen(css_fn, "r")) != NULL) {
283 *body = xs_readall(f);
284 fclose(f);
285
286 status = HTTP_STATUS_OK;
287 *ctype = "text/css";
288 }
289 }
290 else
278 if (strcmp(q_path, "/share") == 0) { 291 if (strcmp(q_path, "/share") == 0) {
279 const xs_dict *q_vars = xs_dict_get(req, "q_vars"); 292 const xs_dict *q_vars = xs_dict_get(req, "q_vars");
280 const char *url = xs_dict_get(q_vars, "url"); 293 const char *url = xs_dict_get(q_vars, "url");