| 162 | "worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'\r\n" |
| 163 | |
| 164 | static bool serve_embedded(cbm_http_conn_t *c, const char *path) { |
| 165 | const cbm_embedded_file_t *f = cbm_embedded_lookup(path); |
| 166 | if (!f) |
| 167 | return false; |
| 168 | |
| 169 | /* Build headers with correct Content-Type for this asset */ |
| 170 | char hdrs[1024]; |
| 171 | snprintf(hdrs, sizeof(hdrs), |
| 172 | "%sContent-Type: %s\r\n" |
| 173 | "Cache-Control: public, max-age=31536000, immutable\r\n" CBM_UI_CSP, |
| 174 | g_cors, f->content_type); |
| 175 | |
| 176 | cbm_http_reply_buf(c, 200, hdrs, f->data, (size_t)f->size); |
| 177 | return true; |
| 178 | } |
| 179 | |
| 180 | /* Build DB path for a project: <cache_dir>/<project>.db */ |
| 181 | static void db_path_for_project(const char *project, char *buf, size_t bufsz) { |
no test coverage detected