summaryrefslogtreecommitdiff
path: root/lib/web
diff options
context:
space:
mode:
Diffstat (limited to 'lib/web')
-rw-r--r--lib/web/auth/dropbox/index.js2
-rw-r--r--lib/web/auth/email/index.js4
-rw-r--r--lib/web/auth/facebook/index.js2
-rw-r--r--lib/web/auth/github/index.js2
-rw-r--r--lib/web/auth/gitlab/index.js2
-rw-r--r--lib/web/auth/google/index.js6
-rw-r--r--lib/web/auth/ldap/index.js4
-rw-r--r--lib/web/auth/mattermost/index.js14
-rw-r--r--lib/web/auth/oauth2/index.js2
-rw-r--r--lib/web/auth/openid/index.js4
-rw-r--r--lib/web/auth/saml/index.js2
-rw-r--r--lib/web/auth/twitter/index.js2
-rw-r--r--lib/web/historyRouter.js2
-rw-r--r--lib/web/imageRouter/imgur.js16
-rw-r--r--lib/web/imageRouter/minio.js2
-rw-r--r--lib/web/imageRouter/s3.js2
-rw-r--r--lib/web/middleware/tooBusy.js1
-rw-r--r--lib/web/noteRouter.js2
-rw-r--r--lib/web/statusRouter.js2
-rw-r--r--lib/web/userRouter.js2
20 files changed, 37 insertions, 38 deletions
diff --git a/lib/web/auth/dropbox/index.js b/lib/web/auth/dropbox/index.js
index c44607da..1cfabd29 100644
--- a/lib/web/auth/dropbox/index.js
+++ b/lib/web/auth/dropbox/index.js
@@ -4,7 +4,7 @@ const Router = require('express').Router
const passport = require('passport')
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
const config = require('../../../config')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let dropboxAuth = module.exports = Router()
diff --git a/lib/web/auth/email/index.js b/lib/web/auth/email/index.js
index daa4a8c5..32e21428 100644
--- a/lib/web/auth/email/index.js
+++ b/lib/web/auth/email/index.js
@@ -7,8 +7,8 @@ const LocalStrategy = require('passport-local').Strategy
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
-const {setReturnToFromReferer} = require('../utils')
-const {urlencodedParser} = require('../../utils')
+const { setReturnToFromReferer } = require('../utils')
+const { urlencodedParser } = require('../../utils')
const response = require('../../../response')
let emailAuth = module.exports = Router()
diff --git a/lib/web/auth/facebook/index.js b/lib/web/auth/facebook/index.js
index b2364989..418ddeee 100644
--- a/lib/web/auth/facebook/index.js
+++ b/lib/web/auth/facebook/index.js
@@ -5,7 +5,7 @@ const passport = require('passport')
const FacebookStrategy = require('passport-facebook').Strategy
const config = require('../../../config')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let facebookAuth = module.exports = Router()
diff --git a/lib/web/auth/github/index.js b/lib/web/auth/github/index.js
index ece634ba..afa5fa31 100644
--- a/lib/web/auth/github/index.js
+++ b/lib/web/auth/github/index.js
@@ -5,7 +5,7 @@ const passport = require('passport')
const GithubStrategy = require('passport-github').Strategy
const config = require('../../../config')
const response = require('../../../response')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let githubAuth = module.exports = Router()
diff --git a/lib/web/auth/gitlab/index.js b/lib/web/auth/gitlab/index.js
index 38436024..4cebbc10 100644
--- a/lib/web/auth/gitlab/index.js
+++ b/lib/web/auth/gitlab/index.js
@@ -5,7 +5,7 @@ const passport = require('passport')
const GitlabStrategy = require('passport-gitlab2').Strategy
const config = require('../../../config')
const response = require('../../../response')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let gitlabAuth = module.exports = Router()
diff --git a/lib/web/auth/google/index.js b/lib/web/auth/google/index.js
index 0a4fd55e..ad9bcd7a 100644
--- a/lib/web/auth/google/index.js
+++ b/lib/web/auth/google/index.js
@@ -4,7 +4,7 @@ const Router = require('express').Router
const passport = require('passport')
var GoogleStrategy = require('passport-google-oauth20').Strategy
const config = require('../../../config')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let googleAuth = module.exports = Router()
@@ -12,14 +12,14 @@ passport.use(new GoogleStrategy({
clientID: config.google.clientID,
clientSecret: config.google.clientSecret,
callbackURL: config.serverURL + '/auth/google/callback',
- userProfileURL: "https://www.googleapis.com/oauth2/v3/userinfo"
+ userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo'
}, passportGeneralCallback))
googleAuth.get('/auth/google', function (req, res, next) {
setReturnToFromReferer(req)
passport.authenticate('google', { scope: ['profile'] })(req, res, next)
})
- // google auth callback
+// google auth callback
googleAuth.get('/auth/google/callback',
passport.authenticate('google', {
successReturnToOrRedirect: config.serverURL + '/',
diff --git a/lib/web/auth/ldap/index.js b/lib/web/auth/ldap/index.js
index 8d71c18e..77790db3 100644
--- a/lib/web/auth/ldap/index.js
+++ b/lib/web/auth/ldap/index.js
@@ -6,8 +6,8 @@ const LDAPStrategy = require('passport-ldapauth')
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
-const {setReturnToFromReferer} = require('../utils')
-const {urlencodedParser} = require('../../utils')
+const { setReturnToFromReferer } = require('../utils')
+const { urlencodedParser } = require('../../utils')
const response = require('../../../response')
let ldapAuth = module.exports = Router()
diff --git a/lib/web/auth/mattermost/index.js b/lib/web/auth/mattermost/index.js
index 63a4886f..48d6d297 100644
--- a/lib/web/auth/mattermost/index.js
+++ b/lib/web/auth/mattermost/index.js
@@ -5,7 +5,7 @@ const passport = require('passport')
const Mattermost = require('mattermost')
const OAuthStrategy = require('passport-oauth2').Strategy
const config = require('../../../config')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
const mattermost = new Mattermost.Client()
@@ -24,12 +24,12 @@ mattermostStrategy.userProfile = (accessToken, done) => {
mattermost.token = accessToken
mattermost.useHeaderToken()
mattermost.getMe(
- (data) => {
- done(null, data)
- },
- (err) => {
- done(err)
- }
+ (data) => {
+ done(null, data)
+ },
+ (err) => {
+ done(err)
+ }
)
}
diff --git a/lib/web/auth/oauth2/index.js b/lib/web/auth/oauth2/index.js
index 57ab9b9a..78434271 100644
--- a/lib/web/auth/oauth2/index.js
+++ b/lib/web/auth/oauth2/index.js
@@ -4,7 +4,7 @@ const Router = require('express').Router
const passport = require('passport')
const { Strategy, InternalOAuthError } = require('passport-oauth2')
const config = require('../../../config')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let oauth2Auth = module.exports = Router()
diff --git a/lib/web/auth/openid/index.js b/lib/web/auth/openid/index.js
index c45c6d71..8d271a7a 100644
--- a/lib/web/auth/openid/index.js
+++ b/lib/web/auth/openid/index.js
@@ -6,8 +6,8 @@ const OpenIDStrategy = require('@passport-next/passport-openid').Strategy
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
-const {urlencodedParser} = require('../../utils')
-const {setReturnToFromReferer} = require('../utils')
+const { urlencodedParser } = require('../../utils')
+const { setReturnToFromReferer } = require('../utils')
let openIDAuth = module.exports = Router()
diff --git a/lib/web/auth/saml/index.js b/lib/web/auth/saml/index.js
index 3cdb7fe2..2289b010 100644
--- a/lib/web/auth/saml/index.js
+++ b/lib/web/auth/saml/index.js
@@ -6,7 +6,7 @@ const SamlStrategy = require('passport-saml').Strategy
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
-const {urlencodedParser} = require('../../utils')
+const { urlencodedParser } = require('../../utils')
const fs = require('fs')
const intersection = function (array1, array2) { return array1.filter((n) => array2.includes(n)) }
diff --git a/lib/web/auth/twitter/index.js b/lib/web/auth/twitter/index.js
index c1860d93..5aba20ff 100644
--- a/lib/web/auth/twitter/index.js
+++ b/lib/web/auth/twitter/index.js
@@ -5,7 +5,7 @@ const passport = require('passport')
const TwitterStrategy = require('passport-twitter').Strategy
const config = require('../../../config')
-const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
+const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
let twitterAuth = module.exports = Router()
diff --git a/lib/web/historyRouter.js b/lib/web/historyRouter.js
index 1b22c232..fa426bbb 100644
--- a/lib/web/historyRouter.js
+++ b/lib/web/historyRouter.js
@@ -2,7 +2,7 @@
const Router = require('express').Router
-const {urlencodedParser} = require('./utils')
+const { urlencodedParser } = require('./utils')
const history = require('../history')
const historyRouter = module.exports = Router()
diff --git a/lib/web/imageRouter/imgur.js b/lib/web/imageRouter/imgur.js
index 2a20002c..eee349f9 100644
--- a/lib/web/imageRouter/imgur.js
+++ b/lib/web/imageRouter/imgur.js
@@ -17,12 +17,12 @@ exports.uploadImage = function (imagePath, callback) {
imgur.setClientId(config.imgur.clientID)
imgur.uploadFile(imagePath)
- .then(function (json) {
- if (config.debug) {
- logger.info('SERVER uploadimage success: ' + JSON.stringify(json))
- }
- callback(null, json.data.link.replace(/^http:\/\//i, 'https://'))
- }).catch(function (err) {
- callback(new Error(err), null)
- })
+ .then(function (json) {
+ if (config.debug) {
+ logger.info('SERVER uploadimage success: ' + JSON.stringify(json))
+ }
+ callback(null, json.data.link.replace(/^http:\/\//i, 'https://'))
+ }).catch(function (err) {
+ callback(new Error(err), null)
+ })
}
diff --git a/lib/web/imageRouter/minio.js b/lib/web/imageRouter/minio.js
index 1d993a45..fe43f76f 100644
--- a/lib/web/imageRouter/minio.js
+++ b/lib/web/imageRouter/minio.js
@@ -3,7 +3,7 @@ const fs = require('fs')
const path = require('path')
const config = require('../../config')
-const {getImageMimeType} = require('../../utils')
+const { getImageMimeType } = require('../../utils')
const logger = require('../../logger')
const Minio = require('minio')
diff --git a/lib/web/imageRouter/s3.js b/lib/web/imageRouter/s3.js
index 626fe148..b0eca7b5 100644
--- a/lib/web/imageRouter/s3.js
+++ b/lib/web/imageRouter/s3.js
@@ -3,7 +3,7 @@ const fs = require('fs')
const path = require('path')
const config = require('../../config')
-const {getImageMimeType} = require('../../utils')
+const { getImageMimeType } = require('../../utils')
const logger = require('../../logger')
const AWS = require('aws-sdk')
diff --git a/lib/web/middleware/tooBusy.js b/lib/web/middleware/tooBusy.js
index 128a5679..49efbe37 100644
--- a/lib/web/middleware/tooBusy.js
+++ b/lib/web/middleware/tooBusy.js
@@ -2,7 +2,6 @@
const toobusy = require('toobusy-js')
-
const response = require('../../response')
const config = require('../../config')
diff --git a/lib/web/noteRouter.js b/lib/web/noteRouter.js
index 41bf5f73..bac2cf88 100644
--- a/lib/web/noteRouter.js
+++ b/lib/web/noteRouter.js
@@ -4,7 +4,7 @@ const Router = require('express').Router
const response = require('../response')
-const {markdownParser} = require('./utils')
+const { markdownParser } = require('./utils')
const noteRouter = module.exports = Router()
diff --git a/lib/web/statusRouter.js b/lib/web/statusRouter.js
index 2b9cb65f..6f797f84 100644
--- a/lib/web/statusRouter.js
+++ b/lib/web/statusRouter.js
@@ -8,7 +8,7 @@ const config = require('../config')
const models = require('../models')
const logger = require('../logger')
-const {urlencodedParser} = require('./utils')
+const { urlencodedParser } = require('./utils')
const statusRouter = module.exports = Router()
diff --git a/lib/web/userRouter.js b/lib/web/userRouter.js
index ca364422..73b519ec 100644
--- a/lib/web/userRouter.js
+++ b/lib/web/userRouter.js
@@ -8,7 +8,7 @@ const response = require('../response')
const config = require('../config')
const models = require('../models')
const logger = require('../logger')
-const {generateAvatar} = require('../letter-avatars')
+const { generateAvatar } = require('../letter-avatars')
const UserRouter = module.exports = Router()