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 = {}
|
let _viewIncludes = {}
|
||||||
|
|
||||||
function loadModules() {
|
function loadModules() {
|
||||||
for (const moduleName of fs.readdirSync(MODULE_BASE_PATH)) {
|
const settingsCheckModule = Path.join(
|
||||||
if (fs.existsSync(Path.join(MODULE_BASE_PATH, moduleName, 'index.js'))) {
|
MODULE_BASE_PATH,
|
||||||
const loadedModule = require(Path.join(
|
'settings-check',
|
||||||
MODULE_BASE_PATH,
|
'index.js'
|
||||||
moduleName,
|
)
|
||||||
'index'
|
if (fs.existsSync(settingsCheckModule)) {
|
||||||
))
|
require(settingsCheckModule)
|
||||||
loadedModule.name = moduleName
|
}
|
||||||
_modules.push(loadedModule)
|
|
||||||
}
|
for (const moduleName of Settings.moduleImportSequence) {
|
||||||
|
const loadedModule = require(Path.join(
|
||||||
|
MODULE_BASE_PATH,
|
||||||
|
moduleName,
|
||||||
|
'index.js'
|
||||||
|
))
|
||||||
|
loadedModule.name = moduleName
|
||||||
|
_modules.push(loadedModule)
|
||||||
}
|
}
|
||||||
attachHooks()
|
attachHooks()
|
||||||
}
|
}
|
||||||
|
|
|
@ -567,10 +567,6 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadModuleViewsOnEachRequest: process.env.NODE_ENV === 'development',
|
reloadModuleViewsOnEachRequest: process.env.NODE_ENV === 'development',
|
||||||
disableModule: {
|
|
||||||
'user-activate': process.env.DISABLE_MODULE_USER_ACTIVATE === 'true',
|
|
||||||
launchpad: process.env.DISABLE_MODULE_LAUNCHPAD === 'true',
|
|
||||||
},
|
|
||||||
|
|
||||||
rateLimit: {
|
rateLimit: {
|
||||||
autoCompile: {
|
autoCompile: {
|
||||||
|
@ -706,6 +702,8 @@ module.exports = {
|
||||||
tprLinkedFileRefreshError: [],
|
tprLinkedFileRefreshError: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
moduleImportSequence: ['launchpad', 'user-activate'],
|
||||||
|
|
||||||
csp: {
|
csp: {
|
||||||
percentage: parseFloat(process.env.CSP_PERCENTAGE) || 0,
|
percentage: parseFloat(process.env.CSP_PERCENTAGE) || 0,
|
||||||
enabled: process.env.CSP_ENABLED === 'true',
|
enabled: process.env.CSP_ENABLED === 'true',
|
||||||
|
|
|
@ -10,17 +10,12 @@
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||||
*/
|
*/
|
||||||
const logger = require('logger-sharelatex')
|
const logger = require('logger-sharelatex')
|
||||||
const Settings = require('@overleaf/settings')
|
|
||||||
const LaunchpadController = require('./LaunchpadController')
|
const LaunchpadController = require('./LaunchpadController')
|
||||||
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
|
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
|
||||||
const AuthorizationMiddleware = require('../../../../app/src/Features/Authorization/AuthorizationMiddleware')
|
const AuthorizationMiddleware = require('../../../../app/src/Features/Authorization/AuthorizationMiddleware')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
apply(webRouter, apiRouter) {
|
apply(webRouter, apiRouter) {
|
||||||
if (Settings.disableModule.launchpad) {
|
|
||||||
logger.log({}, 'Skipping Init launchpad router')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
logger.log({}, 'Init launchpad router')
|
logger.log({}, 'Init launchpad router')
|
||||||
|
|
||||||
webRouter.get('/launchpad', LaunchpadController.launchpadPage)
|
webRouter.get('/launchpad', LaunchpadController.launchpadPage)
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
const logger = require('logger-sharelatex')
|
const logger = require('logger-sharelatex')
|
||||||
const Settings = require('@overleaf/settings')
|
|
||||||
const UserActivateController = require('./UserActivateController')
|
const UserActivateController = require('./UserActivateController')
|
||||||
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
|
const AuthenticationController = require('../../../../app/src/Features/Authentication/AuthenticationController')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
apply(webRouter) {
|
apply(webRouter) {
|
||||||
if (Settings.disableModule['user-activate']) {
|
|
||||||
logger.log({}, 'Skipping Init UserActivate router')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
logger.log({}, 'Init UserActivate router')
|
logger.log({}, 'Init UserActivate router')
|
||||||
|
|
||||||
webRouter.get('/user/activate', UserActivateController.activateAccountPage)
|
webRouter.get('/user/activate', UserActivateController.activateAccountPage)
|
||||||
|
|
Loading…
Reference in a new issue