mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
/api/status only return meilisearch information when request is authorized
This commit is contained in:
@@ -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<StatusData>({
|
||||
ffmpeg_binary_enabled,
|
||||
|
||||
Reference in New Issue
Block a user