mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
Refactor module middleware initialization logic.
Replaced `getMiddleware` with `onServerInit` for streamlined middleware registration. Updated `AppAuth` to automatically register its authentication middleware. Added a test case to verify middleware registration. Removed redundant cookie renewal logic from `AdminController` and made related adjustments across modules.
This commit is contained in:
@@ -10,6 +10,7 @@ export type ServerEnv = {
|
||||
Variables: {
|
||||
app: App;
|
||||
auth_resolved: boolean;
|
||||
auth_registered: boolean;
|
||||
html?: string;
|
||||
};
|
||||
};
|
||||
@@ -87,9 +88,9 @@ export abstract class Module<Schema extends TSchema = TSchema, ConfigSchema = St
|
||||
return this._schema;
|
||||
}
|
||||
|
||||
getMiddleware() {
|
||||
return undefined;
|
||||
}
|
||||
// action performed when server has been initialized
|
||||
// can be used to assign global middlewares
|
||||
onServerInit(hono: Hono<ServerEnv>) {}
|
||||
|
||||
get ctx() {
|
||||
if (!this._ctx) {
|
||||
|
||||
Reference in New Issue
Block a user