refactor: split static/ into css/ js/ html/; add tests/test_json.c (15/15 pass)

This commit is contained in:
2026-06-09 01:04:50 +02:00
parent 32deda57e0
commit 9fc9494ccd
11 changed files with 91 additions and 17 deletions
+6 -6
View File
@@ -11,9 +11,9 @@ char *g_footer = NULL; int g_footer_len = 0;
char *g_css = NULL; int g_css_len = 0;
StaticJS g_js[] = {
{ "/iptv.js", "iptv.js", NULL, 0 },
{ "/downloads.js", "downloads.js", NULL, 0 },
{ "/series_show.js", "series_show.js", NULL, 0 },
{ "/iptv.js", "js/iptv.js", NULL, 0 },
{ "/downloads.js", "js/downloads.js", NULL, 0 },
{ "/series_show.js", "js/series_show.js", NULL, 0 },
{ NULL, NULL, NULL, 0 }
};
@@ -31,11 +31,11 @@ static int load_file(const char *path, char **out, int *out_len) {
int http_load_templates(void) {
char path[512];
snprintf(path, sizeof(path), "%s/header.html", g_cfg.template_dir);
snprintf(path, sizeof(path), "%s/html/header.html", g_cfg.template_dir);
if (!load_file(path, &g_header, &g_header_len)) return 0;
snprintf(path, sizeof(path), "%s/footer.html", g_cfg.template_dir);
snprintf(path, sizeof(path), "%s/html/footer.html", g_cfg.template_dir);
if (!load_file(path, &g_footer, &g_footer_len)) return 0;
snprintf(path, sizeof(path), "%s/iptv.css", g_cfg.template_dir);
snprintf(path, sizeof(path), "%s/css/iptv.css", g_cfg.template_dir);
if (!load_file(path, &g_css, &g_css_len)) return 0;
for (int i = 0; g_js[i].url_path; i++) {
snprintf(path, sizeof(path), "%s/%s", g_cfg.template_dir, g_js[i].fs_name);