use admin routes registering basepath from registration method instead of configuration

Signed-off-by: dswbx <dennis.senn@gmx.ch>
This commit is contained in:
dswbx
2024-12-07 06:34:40 +01:00
parent 067213ff60
commit aa75355a69
2 changed files with 8 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ export type CreateAppConfig = {
}; };
initialConfig?: InitialModuleConfigs; initialConfig?: InitialModuleConfigs;
plugins?: AppPlugin<any>[]; plugins?: AppPlugin<any>[];
options?: ModuleManagerOptions; options?: Omit<ModuleManagerOptions, "initial" | "onUpdated">;
}; };
export type AppConfig = InitialModuleConfigs; export type AppConfig = InitialModuleConfigs;

View File

@@ -10,7 +10,9 @@ import * as SystemPermissions from "modules/permissions";
const htmlBkndContextReplace = "<!-- BKND_CONTEXT -->"; const htmlBkndContextReplace = "<!-- BKND_CONTEXT -->";
// @todo: add migration to remove admin path from config
export type AdminControllerOptions = { export type AdminControllerOptions = {
basepath?: string;
html?: string; html?: string;
forceDev?: boolean; forceDev?: boolean;
}; };
@@ -25,8 +27,12 @@ export class AdminController implements ClassController {
return this.app.modules.ctx(); return this.app.modules.ctx();
} }
get basepath() {
return this.options.basepath ?? "/";
}
private withBasePath(route: string = "") { private withBasePath(route: string = "") {
return (this.app.modules.configs().server.admin.basepath + route).replace(/\/+$/, "/"); return (this.basepath + route).replace(/\/+$/, "/");
} }
getController(): Hono<any> { getController(): Hono<any> {