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

Function handle_ui_config

src/ui/http_server.c:143–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static void handle_ui_config(cbm_http_conn_t *c, const cbm_http_req_t *req) {
144 const char *lang = NULL;
145 char cache_dir[1024];
146 snprintf(cache_dir, sizeof(cache_dir), "%s", cbm_resolve_cache_dir());
147 cbm_config_t *cfg = cbm_config_open(cache_dir);
148 if (cfg) {
149 const char *pinned = cbm_config_get(cfg, CBM_CONFIG_UI_LANG, "auto");
150 if (strcmp(pinned, "zh") == 0 || strcmp(pinned, "en") == 0) {
151 lang = pinned;
152 }
153 }
154
155 char lang_buf[8];
156 snprintf(lang_buf, sizeof(lang_buf), "%s", lang ? lang : detect_ui_lang(req->accept_language));
157 if (cfg) {
158 cbm_config_close(cfg);
159 }
160 /* upstream_issues_url: where the missed-coverage callout (#963) sends
161 * edge-case reports. Served from the backend on purpose — the UI security
162 * audit forbids hardcoded external URLs in graph-ui source (external
163 * targets must come from an auditable backend response, same pattern as
164 * the /api/repo-info deep-links). */
165 cbm_http_replyf(c, 200, g_cors_json,
166 "{\"lang\":\"%s\",\"version\":\"%s\",\"upstream_issues_url\":\"%s\"}", lang_buf,
167 CBM_VERSION, "https://github.com/DeusData/codebase-memory-mcp/issues/new");
168}
169
170/* ── Server state ─────────────────────────────────────────────── */
171

Callers 1

dispatch_requestFunction · 0.85

Calls 6

cbm_resolve_cache_dirFunction · 0.85
cbm_config_openFunction · 0.85
cbm_config_getFunction · 0.85
detect_ui_langFunction · 0.85
cbm_config_closeFunction · 0.85
cbm_http_replyfFunction · 0.85

Tested by

no test coverage detected