mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix(api): 🐛 Respond to OPTIONS requests with empty CORS response
This commit is contained in:
parent
e6749d9b72
commit
de4381e151
1 changed files with 5 additions and 1 deletions
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…
Add table
Add a link
Reference in a new issue