Merge remote-tracking branch 'origin/refactor/admin-basepath' into release/0.2.3

This commit is contained in:
dswbx
2024-12-07 09:30:32 +01:00
2 changed files with 8 additions and 2 deletions

View File

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