Revert "fix: add requiresApiKey to register, unregister, merge_groups, update_trace_profile_group"
This reverts commit f23124a157.
This commit is contained in:
@@ -150,7 +150,7 @@ export class ApiError extends Error {
|
||||
|
||||
async function httpCall(cmd: string, args: Record<string, any>, retries = 3): Promise<any> {
|
||||
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<string, any>, 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<string, any>, retries = 3): Pr
|
||||
}
|
||||
}
|
||||
|
||||
function buildHttpRequest(cmd: string, args: Record<string, any>): { url: string; method: string; body?: any; timeout?: number; requiresAdminToken?: boolean; requiresApiKey?: boolean } {
|
||||
function buildHttpRequest(cmd: string, args: Record<string, any>): { 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' }
|
||||
|
||||
Reference in New Issue
Block a user