From a26f1fe9f1663ce73757c49648dd91e364474c60 Mon Sep 17 00:00:00 2001 From: Momentry Studio Date: Sat, 31 Oct 2026 01:41:41 +0800 Subject: [PATCH] fix: add API key to remaining endpoints - Added requiresApiKey: true to get_trace_profile, get_file_profile - Added x-api-key header to loadDefaultFaceFilter fetch call - Fixes 401 errors on admin/config, trace-profile, and file-profile endpoints --- src/api/index.ts | 4 ++-- src/views/PeopleView.vue | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index ba108b2..c188d2c 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -426,7 +426,7 @@ case 'search_keyword': { const tid = a.trace_id ?? a.traceId if (fu) params.set('file_uuid', fu) if (tid != null) params.set('trace_id', String(tid)) - return { url: `/api/v1/trace-profile?${params.toString()}`, method: 'GET' } + return { url: `/api/v1/trace-profile?${params.toString()}`, method: 'GET', requiresApiKey: true } } case 'get_trace_profile_file': { const params = new URLSearchParams() @@ -583,7 +583,7 @@ case 'search_keyword': { return { url: '/api/v1/trace-profile/group', method: 'PUT', body: { file_uuid: a.fileUuid, trace_ids: a.traceIds, name: a.name, key_frame: a.keyFrame, key_face: a.keyFace }, requiresApiKey: true } } case 'get_file_profile': { - return { url: `/api/v1/file-profile?file_uuid=${a.fileUuid}`, method: 'GET' } + return { url: `/api/v1/file-profile?file_uuid=${a.fileUuid}`, method: 'GET', requiresApiKey: true } } case 'update_file_profile': { const body: any = { file_uuid: a.fileUuid, file_path: a.filePath, file_name: a.fileName } diff --git a/src/views/PeopleView.vue b/src/views/PeopleView.vue index e3640b8..af4f632 100644 --- a/src/views/PeopleView.vue +++ b/src/views/PeopleView.vue @@ -1920,7 +1920,10 @@ let adminFaceFilter: any = null async function loadDefaultFaceFilter() { try { const base = getApiBase() - const res = await fetch(`${base}/api/v1/admin/config`) + const apiKey = localStorage.getItem('momentry_api_key') || 'muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69' + const res = await fetch(`${base}/api/v1/admin/config`, { + headers: { 'x-api-key': apiKey } + }) if (!res.ok) throw new Error(`HTTP ${res.status}`) const config: any = await res.json() adminFaceFilter = config?.filter_config?.face || null