feat: begin adding settings menu, move theme to settings

This commit is contained in:
frosty
2026-03-30 10:37:46 +03:00
parent 9e6e763064
commit c3ed901738
18 changed files with 444 additions and 19 deletions
+30
View File
@@ -0,0 +1,30 @@
#include "Settings.h"
#include "../Utility/Utility.h"
#include <stdlib.h>
#include <string.h>
int settings_handler(UrlParams *params) {
const char *query = "";
if (params) {
for (int i = 0; i < params->count; i++) {
if (strcmp(params->params[i].key, "q") == 0) {
query = params->params[i].value;
break;
}
}
}
char *theme = get_theme("system");
TemplateContext ctx = new_context();
context_set(&ctx, "query", query);
context_set(&ctx, "theme", theme);
char *rendered_html = render_template("settings.html", &ctx);
send_response(rendered_html);
free(rendered_html);
free(theme);
free_context(&ctx);
return 0;
}