diff --git a/routes/api/status.ts b/routes/api/status.ts index 82da8cc..91eed8f 100644 --- a/routes/api/status.ts +++ b/routes/api/status.ts @@ -5,20 +5,23 @@ import { return_data } from "../../server/utils.ts"; import { check_ffmpeg_binary } from "../../thumbnail/ffmpeg_binary.ts"; export const handler: Handlers = { - async GET(_req, _ctx) { + async GET(_req, ctx) { const m = get_task_manager(); + const is_authed = ctx.state.user !== undefined || + m.db.get_user_count() === 0; const ffmpeg_binary_enabled = await check_ffmpeg_binary( m.cfg.ffmpeg_path, ); const meilisearch_enabled = m.meilisearch !== undefined; - const meilisearch = meilisearch_enabled && m.cfg.meili_host && + const meilisearch = + is_authed && meilisearch_enabled && m.cfg.meili_host && m.cfg.meili_update_api_key - ? { - host: m.cfg.meili_host, - key: m.cfg.meili_search_api_key || - m.cfg.meili_update_api_key, - } - : undefined; + ? { + host: m.cfg.meili_host, + key: m.cfg.meili_search_api_key || + m.cfg.meili_update_api_key, + } + : undefined; const no_user = m.db.get_user_count() === 0; return return_data({ ffmpeg_binary_enabled,