diff options
author | Sheogorath | 2018-03-07 15:17:35 +0100 |
---|---|---|
committer | Sheogorath | 2018-03-25 19:08:14 +0200 |
commit | 2411dffa2ce997370a636ed56cc73bcc4661ec7f (patch) | |
tree | a66922974296879dbf5e7f033decfcc0b21070ec /lib/web | |
parent | fa4a8418afc57a45f71471ca7fd1adcd4d8d4cd4 (diff) |
Change config to camel case with backwards compatibility
This refactors the configs a bit to now use camel case everywhere.
This change should help to clean up the config interface and make it
better understandable.
Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to 'lib/web')
-rw-r--r-- | lib/web/auth/dropbox/index.js | 6 | ||||
-rw-r--r-- | lib/web/auth/email/index.js | 10 | ||||
-rw-r--r-- | lib/web/auth/facebook/index.js | 6 | ||||
-rw-r--r-- | lib/web/auth/github/index.js | 6 | ||||
-rw-r--r-- | lib/web/auth/gitlab/index.js | 6 | ||||
-rw-r--r-- | lib/web/auth/google/index.js | 6 | ||||
-rw-r--r-- | lib/web/auth/index.js | 2 | ||||
-rw-r--r-- | lib/web/auth/ldap/index.js | 4 | ||||
-rw-r--r-- | lib/web/auth/mattermost/index.js | 6 | ||||
-rw-r--r-- | lib/web/auth/saml/index.js | 12 | ||||
-rw-r--r-- | lib/web/auth/twitter/index.js | 6 | ||||
-rw-r--r-- | lib/web/imageRouter/filesystem.js | 2 | ||||
-rw-r--r-- | lib/web/imageRouter/index.js | 4 | ||||
-rw-r--r-- | lib/web/middleware/redirectWithoutTrailingSlashes.js | 6 | ||||
-rw-r--r-- | lib/web/statusRouter.js | 4 |
15 files changed, 43 insertions, 43 deletions
diff --git a/lib/web/auth/dropbox/index.js b/lib/web/auth/dropbox/index.js index c03fbc57..c44607da 100644 --- a/lib/web/auth/dropbox/index.js +++ b/lib/web/auth/dropbox/index.js @@ -12,7 +12,7 @@ passport.use(new DropboxStrategy({ apiVersion: '2', clientID: config.dropbox.clientID, clientSecret: config.dropbox.clientSecret, - callbackURL: config.serverurl + '/auth/dropbox/callback' + callbackURL: config.serverURL + '/auth/dropbox/callback' }, passportGeneralCallback)) dropboxAuth.get('/auth/dropbox', function (req, res, next) { @@ -23,7 +23,7 @@ dropboxAuth.get('/auth/dropbox', function (req, res, next) { // dropbox auth callback dropboxAuth.get('/auth/dropbox/callback', passport.authenticate('dropbox-oauth2', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/email/index.js b/lib/web/auth/email/index.js index 760075f8..f7e58d46 100644 --- a/lib/web/auth/email/index.js +++ b/lib/web/auth/email/index.js @@ -31,7 +31,7 @@ passport.use(new LocalStrategy({ }) })) -if (config.allowemailregister) { +if (config.allowEmailRegister) { emailAuth.post('/register', urlencodedParser, function (req, res, next) { if (!req.body.email || !req.body.password) return response.errorBadRequest(res) if (!validator.isEmail(req.body.email)) return response.errorBadRequest(res) @@ -51,10 +51,10 @@ if (config.allowemailregister) { logger.debug('user found: ' + user.id) req.flash('error', 'This email has been used, please try another one.') } - return res.redirect(config.serverurl + '/') + return res.redirect(config.serverURL + '/') } req.flash('error', 'Failed to register your account, please try again.') - return res.redirect(config.serverurl + '/') + return res.redirect(config.serverURL + '/') }).catch(function (err) { logger.error('auth callback failed: ' + err) return response.errorInternalError(res) @@ -67,8 +67,8 @@ emailAuth.post('/login', urlencodedParser, function (req, res, next) { if (!validator.isEmail(req.body.email)) return response.errorBadRequest(res) setReturnToFromReferer(req) passport.authenticate('local', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/', + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/', failureFlash: 'Invalid email or password.' })(req, res, next) }) diff --git a/lib/web/auth/facebook/index.js b/lib/web/auth/facebook/index.js index 0e5474d8..b2364989 100644 --- a/lib/web/auth/facebook/index.js +++ b/lib/web/auth/facebook/index.js @@ -12,7 +12,7 @@ let facebookAuth = module.exports = Router() passport.use(new FacebookStrategy({ clientID: config.facebook.clientID, clientSecret: config.facebook.clientSecret, - callbackURL: config.serverurl + '/auth/facebook/callback' + callbackURL: config.serverURL + '/auth/facebook/callback' }, passportGeneralCallback)) facebookAuth.get('/auth/facebook', function (req, res, next) { @@ -23,7 +23,7 @@ facebookAuth.get('/auth/facebook', function (req, res, next) { // facebook auth callback facebookAuth.get('/auth/facebook/callback', passport.authenticate('facebook', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/github/index.js b/lib/web/auth/github/index.js index a72ad527..ece634ba 100644 --- a/lib/web/auth/github/index.js +++ b/lib/web/auth/github/index.js @@ -12,7 +12,7 @@ let githubAuth = module.exports = Router() passport.use(new GithubStrategy({ clientID: config.github.clientID, clientSecret: config.github.clientSecret, - callbackURL: config.serverurl + '/auth/github/callback' + callbackURL: config.serverURL + '/auth/github/callback' }, passportGeneralCallback)) githubAuth.get('/auth/github', function (req, res, next) { @@ -23,8 +23,8 @@ githubAuth.get('/auth/github', function (req, res, next) { // github auth callback githubAuth.get('/auth/github/callback', passport.authenticate('github', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/gitlab/index.js b/lib/web/auth/gitlab/index.js index 51de1602..38436024 100644 --- a/lib/web/auth/gitlab/index.js +++ b/lib/web/auth/gitlab/index.js @@ -14,7 +14,7 @@ passport.use(new GitlabStrategy({ clientID: config.gitlab.clientID, clientSecret: config.gitlab.clientSecret, scope: config.gitlab.scope, - callbackURL: config.serverurl + '/auth/gitlab/callback' + callbackURL: config.serverURL + '/auth/gitlab/callback' }, passportGeneralCallback)) gitlabAuth.get('/auth/gitlab', function (req, res, next) { @@ -25,8 +25,8 @@ gitlabAuth.get('/auth/gitlab', function (req, res, next) { // gitlab auth callback gitlabAuth.get('/auth/gitlab/callback', passport.authenticate('gitlab', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/google/index.js b/lib/web/auth/google/index.js index 609c69cf..60282cf5 100644 --- a/lib/web/auth/google/index.js +++ b/lib/web/auth/google/index.js @@ -11,7 +11,7 @@ let googleAuth = module.exports = Router() passport.use(new GoogleStrategy({ clientID: config.google.clientID, clientSecret: config.google.clientSecret, - callbackURL: config.serverurl + '/auth/google/callback' + callbackURL: config.serverURL + '/auth/google/callback' }, passportGeneralCallback)) googleAuth.get('/auth/google', function (req, res, next) { @@ -21,7 +21,7 @@ googleAuth.get('/auth/google', function (req, res, next) { // google auth callback googleAuth.get('/auth/google/callback', passport.authenticate('google', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/index.js b/lib/web/auth/index.js index 9ab62c25..eb42fb36 100644 --- a/lib/web/auth/index.js +++ b/lib/web/auth/index.js @@ -51,5 +51,5 @@ authRouter.get('/logout', function (req, res) { logger.debug('user logout: ' + req.user.id) } req.logout() - res.redirect(config.serverurl + '/') + res.redirect(config.serverURL + '/') }) diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js index 6aa9789f..ab1cb4cd 100644 --- a/lib/web/auth/ldap/index.js +++ b/lib/web/auth/ldap/index.js @@ -84,8 +84,8 @@ ldapAuth.post('/auth/ldap', urlencodedParser, function (req, res, next) { if (!req.body.username || !req.body.password) return response.errorBadRequest(res) setReturnToFromReferer(req) passport.authenticate('ldapauth', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/', + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/', failureFlash: true })(req, res, next) }) diff --git a/lib/web/auth/mattermost/index.js b/lib/web/auth/mattermost/index.js index 9ccf3de5..63a4886f 100644 --- a/lib/web/auth/mattermost/index.js +++ b/lib/web/auth/mattermost/index.js @@ -16,7 +16,7 @@ let mattermostStrategy = new OAuthStrategy({ tokenURL: config.mattermost.baseURL + '/oauth/access_token', clientID: config.mattermost.clientID, clientSecret: config.mattermost.clientSecret, - callbackURL: config.serverurl + '/auth/mattermost/callback' + callbackURL: config.serverURL + '/auth/mattermost/callback' }, passportGeneralCallback) mattermostStrategy.userProfile = (accessToken, done) => { @@ -43,7 +43,7 @@ mattermostAuth.get('/auth/mattermost', function (req, res, next) { // mattermost auth callback mattermostAuth.get('/auth/mattermost/callback', passport.authenticate('oauth2', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/saml/index.js b/lib/web/auth/saml/index.js index 386293ae..3ecbc6f3 100644 --- a/lib/web/auth/saml/index.js +++ b/lib/web/auth/saml/index.js @@ -13,9 +13,9 @@ const intersection = function (array1, array2) { return array1.filter((n) => arr let samlAuth = module.exports = Router() passport.use(new SamlStrategy({ - callbackUrl: config.serverurl + '/auth/saml/callback', + callbackUrl: config.serverURL + '/auth/saml/callback', entryPoint: config.saml.idpSsoUrl, - issuer: config.saml.issuer || config.serverurl, + issuer: config.saml.issuer || config.serverURL, cert: fs.readFileSync(config.saml.idpCert, 'utf-8'), identifierFormat: config.saml.identifierFormat }, function (user, done) { @@ -77,15 +77,15 @@ passport.use(new SamlStrategy({ samlAuth.get('/auth/saml', passport.authenticate('saml', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) samlAuth.post('/auth/saml/callback', urlencodedParser, passport.authenticate('saml', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/auth/twitter/index.js b/lib/web/auth/twitter/index.js index 5429522d..c1860d93 100644 --- a/lib/web/auth/twitter/index.js +++ b/lib/web/auth/twitter/index.js @@ -12,7 +12,7 @@ let twitterAuth = module.exports = Router() passport.use(new TwitterStrategy({ consumerKey: config.twitter.consumerKey, consumerSecret: config.twitter.consumerSecret, - callbackURL: config.serverurl + '/auth/twitter/callback' + callbackURL: config.serverURL + '/auth/twitter/callback' }, passportGeneralCallback)) twitterAuth.get('/auth/twitter', function (req, res, next) { @@ -23,7 +23,7 @@ twitterAuth.get('/auth/twitter', function (req, res, next) { // twitter auth callback twitterAuth.get('/auth/twitter/callback', passport.authenticate('twitter', { - successReturnToOrRedirect: config.serverurl + '/', - failureRedirect: config.serverurl + '/' + successReturnToOrRedirect: config.serverURL + '/', + failureRedirect: config.serverURL + '/' }) ) diff --git a/lib/web/imageRouter/filesystem.js b/lib/web/imageRouter/filesystem.js index 25ec3846..da76ba5e 100644 --- a/lib/web/imageRouter/filesystem.js +++ b/lib/web/imageRouter/filesystem.js @@ -14,5 +14,5 @@ exports.uploadImage = function (imagePath, callback) { return } - callback(null, url.resolve(config.serverurl + '/', imagePath.match(/^public\/(.+$)/)[1])) + callback(null, url.resolve(config.serverURL + '/', imagePath.match(/^public\/(.+$)/)[1])) } diff --git a/lib/web/imageRouter/index.js b/lib/web/imageRouter/index.js index 59f19253..f7e031af 100644 --- a/lib/web/imageRouter/index.js +++ b/lib/web/imageRouter/index.js @@ -15,7 +15,7 @@ imageRouter.post('/uploadimage', function (req, res) { form.keepExtensions = true - if (config.imageuploadtype === 'filesystem') { + if (config.imageUploadType === 'filesystem') { form.uploadDir = 'public/uploads' } @@ -27,7 +27,7 @@ imageRouter.post('/uploadimage', function (req, res) { logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image)) } - const uploadProvider = require('./' + config.imageuploadtype) + const uploadProvider = require('./' + config.imageUploadType) uploadProvider.uploadImage(files.image.path, function (err, url) { if (err !== null) { logger.error(err) diff --git a/lib/web/middleware/redirectWithoutTrailingSlashes.js b/lib/web/middleware/redirectWithoutTrailingSlashes.js index fbaba617..60ca04af 100644 --- a/lib/web/middleware/redirectWithoutTrailingSlashes.js +++ b/lib/web/middleware/redirectWithoutTrailingSlashes.js @@ -6,9 +6,9 @@ module.exports = function (req, res, next) { if (req.method === 'GET' && req.path.substr(-1) === '/' && req.path.length > 1) { const queryString = req.url.slice(req.path.length) const urlPath = req.path.slice(0, -1) - let serverURL = config.serverurl - if (config.urlpath) { - serverURL = serverURL.slice(0, -(config.urlpath.length + 1)) + let serverURL = config.serverURL + if (config.urlPath) { + serverURL = serverURL.slice(0, -(config.urlPath.length + 1)) } res.redirect(301, serverURL + urlPath + queryString) } else { diff --git a/lib/web/statusRouter.js b/lib/web/statusRouter.js index aa3a9b79..d22fac47 100644 --- a/lib/web/statusRouter.js +++ b/lib/web/statusRouter.js @@ -26,7 +26,7 @@ statusRouter.get('/status', function (req, res, next) { // get status statusRouter.get('/temp', function (req, res) { var host = req.get('host') - if (config.alloworigin.indexOf(host) === -1) { + if (config.allowOrigin.indexOf(host) === -1) { response.errorForbidden(res) } else { var tempid = req.query.tempid @@ -61,7 +61,7 @@ statusRouter.get('/temp', function (req, res) { // post status statusRouter.post('/temp', urlencodedParser, function (req, res) { var host = req.get('host') - if (config.alloworigin.indexOf(host) === -1) { + if (config.allowOrigin.indexOf(host) === -1) { response.errorForbidden(res) } else { var data = req.body.data |