fix(routes): restore ctx access in 15 route files broken by Phase 2.1 refactor
The modular refactor changed function signatures to destructured deps but left internal ctx.* references intact, causing "ctx is not defined" errors on /api/config, /api/logo, and many other endpoints. Also implements loadTotpConfig and saveTotpConfig which were left as stubs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,13 +36,14 @@ module.exports = function(ctx) {
|
||||
};
|
||||
|
||||
// Initialize helpers with dependencies
|
||||
const helpers = initHelpers(deps);
|
||||
const helpers = initHelpers(ctx);
|
||||
|
||||
// Mount sub-routes with explicit dependencies
|
||||
router.use(initDeploy({ ...deps, helpers }));
|
||||
router.use(initRemoval({ ...deps, helpers }));
|
||||
router.use(initTemplates({ ...deps, helpers }));
|
||||
router.use(initRestore({ ...deps, helpers }));
|
||||
// Mount sub-routes — pass full ctx so sub-routes can reference ctx.* properties
|
||||
const subCtx = Object.assign({}, ctx, { helpers });
|
||||
router.use(initDeploy(subCtx));
|
||||
router.use(initRemoval(subCtx));
|
||||
router.use(initTemplates(subCtx));
|
||||
router.use(initRestore(subCtx));
|
||||
|
||||
return router;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user