mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
fix(api): 🐛 Respond to OPTIONS requests with empty CORS response
This commit is contained in:
parent
e6749d9b72
commit
de4381e151
6
index.ts
6
index.ts
|
|
@ -1,6 +1,6 @@
|
||||||
import { dualLogger } from "@loggers";
|
import { dualLogger } from "@loggers";
|
||||||
import { connectMeili } from "@meilisearch";
|
import { connectMeili } from "@meilisearch";
|
||||||
import { errorResponse } from "@response";
|
import { errorResponse, response } from "@response";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import { Hono } from "hono";
|
import { Hono } from "hono";
|
||||||
import { LogLevel, LogManager, type MultiLogManager } from "log-manager";
|
import { LogLevel, LogManager, type MultiLogManager } from "log-manager";
|
||||||
|
|
@ -124,6 +124,10 @@ for (const [route, path] of Object.entries(routes)) {
|
||||||
route.default(app);
|
route.default(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.options("*", async () => {
|
||||||
|
return response(null);
|
||||||
|
});
|
||||||
|
|
||||||
app.all("*", async (context) => {
|
app.all("*", async (context) => {
|
||||||
if (config.frontend.glitch.enabled) {
|
if (config.frontend.glitch.enabled) {
|
||||||
const glitch = await handleGlitchRequest(context.req.raw, dualLogger);
|
const glitch = await handleGlitchRequest(context.req.raw, dualLogger);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue