mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
feat: Add error when searching without Meilisearch
This commit is contained in:
parent
b5913b163c
commit
34faf28088
|
|
@ -1,4 +1,5 @@
|
|||
import { applyConfig } from "@api";
|
||||
import { getConfig } from "@config";
|
||||
import { MeiliIndexType, meilisearch } from "@meilisearch";
|
||||
import { parseRequest } from "@request";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
|
|
@ -52,6 +53,12 @@ export default async (req: Request): Promise<Response> => {
|
|||
offset?: number;
|
||||
}>(req);
|
||||
|
||||
const config = getConfig();
|
||||
|
||||
if (!config.meilisearch.enabled) {
|
||||
return errorResponse("Meilisearch is not enabled", 501);
|
||||
}
|
||||
|
||||
if (!user && (resolve || offset)) {
|
||||
return errorResponse(
|
||||
"Cannot use resolve or offset without being authenticated",
|
||||
|
|
|
|||
Loading…
Reference in a new issue