From f4633b9356ff26deb12587bf922db9b82c0e0bda Mon Sep 17 00:00:00 2001 From: default Date: Fri, 24 Nov 2023 00:05:45 +0100 Subject: Use xs_html in the static greeting page. --- Makefile | 4 ++-- httpd.c | 32 +++++++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 9374792..2612b7d 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,8 @@ html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \ http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \ snac.h httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_httpd.h xs_mime.h \ - xs_time.h xs_openssl.h xs_fcgi.h snac.h -main.o: main.c xs.h xs_io.h xs_json.h snac.h + xs_time.h xs_openssl.h xs_fcgi.h xs_html.h snac.h +main.o: main.c xs.h xs_io.h xs_json.h snac.h xs_html.h mastoapi.o: mastoapi.c xs.h xs_hex.h xs_openssl.h xs_json.h xs_io.h \ xs_time.h xs_glob.h xs_set.h xs_random.h xs_url.h xs_mime.h xs_match.h \ snac.h diff --git a/httpd.c b/httpd.c index c398c05..3f4e9f0 100644 --- a/httpd.c +++ b/httpd.c @@ -10,6 +10,7 @@ #include "xs_time.h" #include "xs_openssl.h" #include "xs_fcgi.h" +#include "xs_html.h" #include "snac.h" @@ -98,32 +99,37 @@ static xs_str *greeting_html(void) /* does it have a %userlist% mark? */ if (xs_str_in(s, "%userlist%") != -1) { - const char *host = xs_dict_get(srv_config, "host"); + char *host = xs_dict_get(srv_config, "host"); xs *list = user_list(); - xs_list *p; + xs_list *p = list; xs_str *uid; - xs *ul = xs_str_new("\n"); - - s = xs_replace_i(s, "%userlist%", ul); + xs *s1 = xs_html_render(ul); + s = xs_replace_i(s, "%userlist%", s1); } } -- cgit v1.2.3