- routes/apps/deploy.js: Add ctx shim with APP_TEMPLATES, siteConfig, buildDomain, buildServiceUrl, addServiceToConfig, dns, notification, safeErrorMessage - routes/apps/index.js: Extract additional ctx properties for sub-routes - routes/arr/config.js: Add ctx shim with notification, safeErrorMessage + logError import - routes/arr/index.js: Extract notification, safeErrorMessage for sub-routes Result: Fixed ~30 no-undef errors (deploy.js 0 errors, arr/config.js 0 errors)
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const express = require('express');
|
|
|
|
/**
|
|
* Arr routes aggregator
|
|
* Assembles all arr sub-routes with their dependencies
|
|
* @param {Object} ctx - Application context (for backward compatibility)
|
|
* @returns {express.Router}
|
|
*/
|
|
module.exports = function(ctx) {
|
|
const router = express.Router();
|
|
|
|
// Extract dependencies from context
|
|
const deps = {
|
|
docker: ctx.docker,
|
|
credentialManager: ctx.credentialManager,
|
|
servicesStateManager: ctx.servicesStateManager,
|
|
fetchT: ctx.fetchT,
|
|
asyncHandler: ctx.asyncHandler,
|
|
errorResponse: ctx.errorResponse,
|
|
log: ctx.log,
|
|
// Additional context properties needed by arr routes
|
|
notification: ctx.notification,
|
|
safeErrorMessage: ctx.safeErrorMessage
|
|
};
|
|
|
|
// Initialize helpers with dependencies
|
|
const helpers = require('./helpers')(deps);
|
|
|
|
// Mount sub-routes with explicit dependencies
|
|
router.use(require('./detect')({ ...deps, helpers }));
|
|
router.use(require('./credentials')({ ...deps, helpers }));
|
|
router.use(require('./config')({ ...deps, helpers }));
|
|
router.use(require('./smart-connect')({ ...deps, helpers }));
|
|
router.use(require('./plex')({ ...deps, helpers }));
|
|
|
|
return router;
|
|
};
|