exposed bknd middlewares to be used for custom routes

This commit is contained in:
dswbx
2025-01-11 15:45:32 +01:00
parent bd4bc14282
commit d8671355a6
11 changed files with 20 additions and 32 deletions

View File

@@ -1,11 +1,6 @@
import { auth, permission } from "auth/middlewares";
import { Hono } from "hono";
import type { ServerEnv } from "modules/Module";
const middlewares = {
auth,
permission
} as const;
import * as middlewares from "modules/middlewares";
export class Controller {
protected middlewares = middlewares;

View File

@@ -9,13 +9,13 @@ import type { Hono } from "hono";
export type ServerEnv = {
Variables: {
app: App;
app?: App;
// to prevent resolving auth multiple times
auth_resolved: boolean;
auth_resolved?: boolean;
// to only register once
auth_registered: boolean;
auth_registered?: boolean;
// whether or not to bypass auth
auth_skip: boolean;
auth_skip?: boolean;
html?: string;
};
};

View File

@@ -11,7 +11,7 @@ export {
MODULE_NAMES,
type ModuleKey
} from "./ModuleManager";
export { /*Module,*/ type ModuleBuildContext } from "./Module";
export type { ModuleBuildContext } from "./Module";
export {
type PrimaryFieldType,

View File

@@ -0,0 +1 @@
export { auth, permission } from "auth/middlewares";

View File

@@ -292,7 +292,7 @@ export class SystemController extends Controller {
return c.json({
version: this.app.version(),
test: 2,
app: c.get("app").version()
app: c.get("app")?.version()
});
});