MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / serve_embedded

Function serve_embedded

src/ui/http_server.c:204–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202 "worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'\r\n"
203
204static bool serve_embedded(cbm_http_conn_t *c, const char *path) {
205 const cbm_embedded_file_t *f = cbm_embedded_lookup(path);
206 if (!f)
207 return false;
208
209 /* Build headers with correct Content-Type for this asset */
210 char hdrs[1024];
211 snprintf(hdrs, sizeof(hdrs),
212 "%sContent-Type: %s\r\n"
213 "Cache-Control: public, max-age=31536000, immutable\r\n"
214 "X-Content-Type-Options: nosniff\r\n" CBM_UI_CSP,
215 g_cors, f->content_type);
216
217 cbm_http_reply_buf(c, 200, hdrs, f->data, (size_t)f->size);
218 return true;
219}
220
221/* Build DB path for a project: <cache_dir>/<project>.db */
222static void db_path_for_project(const char *project, char *buf, size_t bufsz) {

Callers 1

dispatch_requestFunction · 0.85

Calls 2

cbm_embedded_lookupFunction · 0.85
cbm_http_reply_bufFunction · 0.85

Tested by

no test coverage detected