refactor: 🚚 Organize code into sub-packages, instead of a single large package

This commit is contained in:
Jesse Wierzbinski 2025-06-15 04:38:20 +02:00
parent 79742f47dc
commit a6d3ebbeef
No known key found for this signature in database
366 changed files with 942 additions and 833 deletions

View file

@ -0,0 +1,19 @@
import { config } from "@versia-server/config";
import { createMiddleware } from "hono/factory";
export const urlCheck = createMiddleware(async (context, next) => {
// Check that request URL matches base_url
const baseUrl = config.http.base_url;
if (new URL(context.req.url).origin !== baseUrl.origin) {
return context.json(
{
error: `Request URL ${context.req.url} does not match base URL ${baseUrl.origin}`,
},
400,
);
}
await next();
return;
});