From 2ba21dabc267f52a5f8e8496ad271ec6c51f0b00 Mon Sep 17 00:00:00 2001 From: Momentry Studio Date: Sun, 1 Nov 2026 14:40:58 +0800 Subject: [PATCH] Revert "fix: add requiresApiKey to register, unregister, merge_groups, update_trace_profile_group" This reverts commit f23124a157175ee7c52b565f409980716bffb54d. --- src/api/index.ts | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 667f4c1..6bcffe8 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -150,7 +150,7 @@ export class ApiError extends Error { async function httpCall(cmd: string, args: Record, retries = 3): Promise { const base = getApiBase() - const { url, method, body, timeout: requestTimeout, requiresAdminToken, requiresApiKey } = buildHttpRequest(cmd, args) + const { url, method, body, timeout: requestTimeout, requiresAdminToken } = buildHttpRequest(cmd, args) const fullUrl = url.startsWith('http://') || url.startsWith('https://') ? url : `${base}${url}` // Get admin token from localStorage if needed @@ -167,14 +167,6 @@ async function httpCall(cmd: string, args: Record, retries = 3): Pr } } - // Add API key if needed - if (requiresApiKey) { - const apiKey = localStorage.getItem('momentry_api_key') || 'muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69' - if (apiKey) { - headers['x-api-key'] = apiKey - } - } - const controller = new AbortController() const timeout = setTimeout(() => controller.abort(), requestTimeout ?? DEFAULT_TIMEOUT) @@ -260,7 +252,7 @@ async function httpCall(cmd: string, args: Record, retries = 3): Pr } } -function buildHttpRequest(cmd: string, args: Record): { url: string; method: string; body?: any; timeout?: number; requiresAdminToken?: boolean; requiresApiKey?: boolean } { +function buildHttpRequest(cmd: string, args: Record): { url: string; method: string; body?: any; timeout?: number; requiresAdminToken?: boolean } { const a = args switch (cmd) { @@ -467,8 +459,7 @@ case 'search_keyword': { file_uuid: a.fileUuid, source_groups: a.sourceGroups, target_group_name: a.targetGroupName - }, - requiresApiKey: true + } } } case 'bind_face': { @@ -552,7 +543,7 @@ case 'search_keyword': { return { url: '/api/v1/jobs', method: 'POST', body: {} } } case 'register_file': { - return { url: '/api/v1/files/register', method: 'POST', body: { file_path: a.filePath }, requiresApiKey: true } + return { url: '/api/v1/files/register', method: 'POST', body: { file_path: a.filePath } } } case 'get_command_status': { return { url: `/api/v1/command/${a.commandId}`, method: 'GET' } @@ -580,7 +571,7 @@ case 'search_keyword': { return { url: `/api/v1/file/${a.fileUuid}/face-groups/similar?${params.toString()}`, method: 'GET' } } case 'update_trace_profile_group': { - 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 } + 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 } } } case 'get_file_profile': { return { url: `/api/v1/file-profile?file_uuid=${a.fileUuid}`, method: 'GET' } @@ -605,7 +596,7 @@ case 'search_keyword': { case 'unregister_file': { const body: any = { file_uuid: a.fileUuid } if (a.deleteOutputFiles != null) body.delete_output_files = a.deleteOutputFiles - return { url: '/api/v1/unregister', method: 'POST', body, timeout: UNREGISTER_TIMEOUT, requiresApiKey: true } + return { url: '/api/v1/unregister', method: 'POST', body, timeout: UNREGISTER_TIMEOUT } } case 'ingest_file': { return { url: `/api/v1/file/${a.fileUuid}/checkin`, method: 'POST' }