| 141 | } |
| 142 | |
| 143 | static 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 |
no test coverage detected