mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4312 from overleaf/jpa-module-import-sequence-from-config
[Modules] source list of modules and their import sequence from config GitOrigin-RevId: 73a552e03f8e9ec6ae8fce3a664625095dc095fc
This commit is contained in:
parent
cebad4a774
commit
947eda54e7
4 changed files with 19 additions and 24 deletions
|
@ -12,16 +12,23 @@ const _hooks = {}
|
|||
let _viewIncludes = {}
|
||||
|
||||
function loadModules() {
|
||||
for (const moduleName of fs.readdirSync(MODULE_BASE_PATH)) {
|
||||
if (fs.existsSync(Path.join(MODULE_BASE_PATH, moduleName, 'index.js'))) {
|
||||
const loadedModule = require(Path.join(
|
||||
MODULE_BASE_PATH,
|
||||
moduleName,
|
||||
'index'
|
||||
))
|
||||
loadedModule.name = moduleName
|
||||
_modules.push(loadedModule)
|
||||
}
|
||||
const settingsCheckModule = Path.join(
|
||||
MODULE_BASE_PATH,
|
||||
'settings-check',
|
||||
'index.js'
|
||||
)
|
||||
if (fs.existsSync(settingsCheckModule)) {
|
||||
require(settingsCheckModule)
|
||||
}
|
||||
|
||||
for (const moduleName of Settings.moduleImportSequence) {
|
||||
const loadedModule = require(Path.join(
|
||||
MODULE_BASE_PATH,
|
||||
moduleName,
|
||||
'index.js'
|
||||
))
|
||||
loadedModule.name = moduleName
|
||||
_modules.push(loadedModule)
|
||||
}
|
||||
attachHooks()
|
||||
}
|
||||
|
|
|
@ -567,10 +567,6 @@ module.exports = {
|
|||
},
|
||||
|
||||
reloadModuleViewsOnEachRequest: process.env.NODE_ENV === 'development',
|
||||
disableModule: {
|
||||
'user-activate': process.env.DISABLE_MODULE_USER_ACTIVATE === 'true',
|
||||
launchpad: process.env.DISABLE_MODULE_LAUNCHPAD === 'true',
|
||||
},
|
||||
|
||||
rateLimit: {
|
||||
autoCompile: {
|
||||
|
@ -706,6 +702,8 @@ module.exports = {
|
|||
tprLinkedFileRefreshError: [],
|
||||
},
|
||||
|
||||
moduleImportSequence: ['launchpad', 'user-activate'],
|
||||
|
||||
csp: {
|
||||
percentage: parseFloat(process.env.CSP_PERCENTAGE) || 0,
|
||||
enabled: process.env.CSP_ENABLED === 'true',
|
||||
|
|
|
@ -10,17 +10,12 @@
|
|||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const logger = require('logger-sharelatex')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const LaunchpadController = require('./LaunchpadController')
|
||||
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
|
||||
const AuthorizationMiddleware = require('../../../../app/src/Features/Authorization/AuthorizationMiddleware')
|
||||
|
||||
module.exports = {
|
||||
apply(webRouter, apiRouter) {
|
||||
if (Settings.disableModule.launchpad) {
|
||||
logger.log({}, 'Skipping Init launchpad router')
|
||||
return
|
||||
}
|
||||
logger.log({}, 'Init launchpad router')
|
||||
|
||||
webRouter.get('/launchpad', LaunchpadController.launchpadPage)
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
const logger = require('logger-sharelatex')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const UserActivateController = require('./UserActivateController')
|
||||
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
|
||||
|
||||
module.exports = {
|
||||
apply(webRouter) {
|
||||
if (Settings.disableModule['user-activate']) {
|
||||
logger.log({}, 'Skipping Init UserActivate router')
|
||||
return
|
||||
}
|
||||
logger.log({}, 'Init UserActivate router')
|
||||
|
||||
webRouter.get('/user/activate', UserActivateController.activateAccountPage)
|
||||
|
|
Loading…
Reference in a new issue