summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSheogorath2019-06-04 16:09:46 +0200
committerGitHub2019-06-04 16:09:46 +0200
commit6462968e84e8d92292dd23764a9e558d7800147d (patch)
tree03ab6b40402c79c766ffa05a0a09118c6987d540 /lib
parentae32a129303fd14b3b2bd2f5b7bb0b0c0c8a7f81 (diff)
parent4da68597f701376307fe8849ed57edd3a80833ed (diff)
Merge pull request #97 from SISheogorath/fix/linting
Fix eslint warnings
Diffstat (limited to 'lib')
-rw-r--r--lib/config/environment.js2
-rw-r--r--lib/config/hackmdEnvironment.js2
-rw-r--r--lib/config/index.js12
-rw-r--r--lib/config/oldEnvironment.js2
-rw-r--r--lib/letter-avatars.js4
-rw-r--r--lib/logger.js2
-rw-r--r--lib/migrations/20150702001020-update-to-0_3_1.js1
-rw-r--r--lib/migrations/20160112220142-note-add-lastchange.js7
-rw-r--r--lib/migrations/20160420180355-note-add-alias.js1
-rw-r--r--lib/migrations/20160515114000-user-add-tokens.js1
-rw-r--r--lib/migrations/20160607060246-support-revision.js1
-rw-r--r--lib/migrations/20160703062241-support-authorship.js1
-rw-r--r--lib/migrations/20161009040430-support-delete-note.js1
-rw-r--r--lib/migrations/20161201050312-support-email-signin.js2
-rw-r--r--lib/migrations/20171009121200-longtext-for-mysql.js16
-rw-r--r--lib/migrations/20180209120907-longtext-of-authorship.js8
-rw-r--r--lib/migrations/20180306150303-fix-enum.js4
-rw-r--r--lib/models/index.js16
-rw-r--r--lib/response.js22
-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
39 files changed, 94 insertions, 86 deletions
diff --git a/lib/config/environment.js b/lib/config/environment.js
index 0a709745..d2350e72 100644
--- a/lib/config/environment.js
+++ b/lib/config/environment.js
@@ -1,6 +1,6 @@
'use strict'
-const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
+const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')
module.exports = {
sourceURL: process.env.CMD_SOURCE_URL,
diff --git a/lib/config/hackmdEnvironment.js b/lib/config/hackmdEnvironment.js
index e5ffeb8a..dcfda0bc 100644
--- a/lib/config/hackmdEnvironment.js
+++ b/lib/config/hackmdEnvironment.js
@@ -1,6 +1,6 @@
'use strict'
-const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
+const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')
module.exports = {
domain: process.env.HMD_DOMAIN,
diff --git a/lib/config/index.js b/lib/config/index.js
index e102dce9..b6001aa0 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -4,11 +4,11 @@
const crypto = require('crypto')
const fs = require('fs')
const path = require('path')
-const {merge} = require('lodash')
+const { merge } = require('lodash')
const deepFreeze = require('deep-freeze')
-const {Environment, Permission} = require('./enum')
+const { Environment, Permission } = require('./enum')
const logger = require('../logger')
-const {getGitCommit, getGitHubURL} = require('./utils')
+const { getGitCommit, getGitHubURL } = require('./utils')
const appRootPath = path.resolve(__dirname, '../../')
const env = process.env.NODE_ENV || Environment.development
@@ -17,7 +17,7 @@ const debugConfig = {
}
// Get version string from package.json
-const {version, repository} = require(path.join(appRootPath, 'package.json'))
+const { version, repository } = require(path.join(appRootPath, 'package.json'))
const commitID = getGitCommit(appRootPath)
const sourceURL = getGitHubURL(repository.url, commitID || version)
@@ -159,8 +159,8 @@ if (Object.keys(process.env).toString().indexOf('HMD_') !== -1) {
if (config.sessionSecret === 'secret') {
logger.warn('Session secret not set. Using random generated one. Please set `sessionSecret` in your config.js file. All users will be logged out.')
config.sessionSecret = crypto.randomBytes(Math.ceil(config.sessionSecretLen / 2)) // generate crypto graphic random number
- .toString('hex') // convert to hexadecimal format
- .slice(0, config.sessionSecretLen) // return required number of characters
+ .toString('hex') // convert to hexadecimal format
+ .slice(0, config.sessionSecretLen) // return required number of characters
}
// Validate upload upload providers
diff --git a/lib/config/oldEnvironment.js b/lib/config/oldEnvironment.js
index a3b13cb9..06047553 100644
--- a/lib/config/oldEnvironment.js
+++ b/lib/config/oldEnvironment.js
@@ -1,6 +1,6 @@
'use strict'
-const {toBooleanConfig} = require('./utils')
+const { toBooleanConfig } = require('./utils')
module.exports = {
debug: toBooleanConfig(process.env.DEBUG),
diff --git a/lib/letter-avatars.js b/lib/letter-avatars.js
index 935cc1bb..6fb1888a 100644
--- a/lib/letter-avatars.js
+++ b/lib/letter-avatars.js
@@ -30,14 +30,14 @@ exports.generateAvatarURL = function (name, email = '', big = true) {
if (typeof email !== 'string') {
email = '' + name + '@example.com'
}
- name=encodeURIComponent(name)
+ name = encodeURIComponent(name)
let hash = crypto.createHash('md5')
hash.update(email.toLowerCase())
let hexDigest = hash.digest('hex')
if (email !== '' && config.allowGravatar) {
- photo = 'https://cdn.libravatar.org/avatar/' + hexDigest;
+ photo = 'https://cdn.libravatar.org/avatar/' + hexDigest
if (big) {
photo += '?s=400'
} else {
diff --git a/lib/logger.js b/lib/logger.js
index 5ef1860a..6d4bf69a 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -1,5 +1,5 @@
'use strict'
-const {createLogger, format, transports} = require('winston')
+const { createLogger, format, transports } = require('winston')
const logger = createLogger({
level: 'debug',
diff --git a/lib/migrations/20150702001020-update-to-0_3_1.js b/lib/migrations/20150702001020-update-to-0_3_1.js
index e1a88661..b941048e 100644
--- a/lib/migrations/20150702001020-update-to-0_3_1.js
+++ b/lib/migrations/20150702001020-update-to-0_3_1.js
@@ -22,6 +22,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: shortid' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'shortid'" || error.message === 'column "shortid" of relation "Notes" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20160112220142-note-add-lastchange.js b/lib/migrations/20160112220142-note-add-lastchange.js
index 87e3ff19..69781cef 100644
--- a/lib/migrations/20160112220142-note-add-lastchange.js
+++ b/lib/migrations/20160112220142-note-add-lastchange.js
@@ -9,6 +9,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: lastchangeuserId' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'lastchangeuserId'" || error.message === 'column "lastchangeuserId" of relation "Notes" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
@@ -18,8 +19,8 @@ module.exports = {
down: function (queryInterface, Sequelize) {
return queryInterface.removeColumn('Notes', 'lastchangeAt')
- .then(function () {
- return queryInterface.removeColumn('Notes', 'lastchangeuserId')
- })
+ .then(function () {
+ return queryInterface.removeColumn('Notes', 'lastchangeuserId')
+ })
}
}
diff --git a/lib/migrations/20160420180355-note-add-alias.js b/lib/migrations/20160420180355-note-add-alias.js
index 45d53e69..82941a91 100644
--- a/lib/migrations/20160420180355-note-add-alias.js
+++ b/lib/migrations/20160420180355-note-add-alias.js
@@ -9,6 +9,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: alias' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'alias'" || error.message === 'column "alias" of relation "Notes" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20160515114000-user-add-tokens.js b/lib/migrations/20160515114000-user-add-tokens.js
index 435ae9cb..e47ef5a4 100644
--- a/lib/migrations/20160515114000-user-add-tokens.js
+++ b/lib/migrations/20160515114000-user-add-tokens.js
@@ -5,6 +5,7 @@ module.exports = {
return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: accessToken' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'accessToken'" || error.message === 'column "accessToken" of relation "Users" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20160607060246-support-revision.js b/lib/migrations/20160607060246-support-revision.js
index 547f89b8..b318ea44 100644
--- a/lib/migrations/20160607060246-support-revision.js
+++ b/lib/migrations/20160607060246-support-revision.js
@@ -17,6 +17,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: savedAt' | error.message === "ER_DUP_FIELDNAME: Duplicate column name 'savedAt'" || error.message === 'column "savedAt" of relation "Notes" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20160703062241-support-authorship.js b/lib/migrations/20160703062241-support-authorship.js
index f452b1a7..86054f1c 100644
--- a/lib/migrations/20160703062241-support-authorship.js
+++ b/lib/migrations/20160703062241-support-authorship.js
@@ -18,6 +18,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: authorship' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'authorship'" || error.message === 'column "authorship" of relation "Notes" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20161009040430-support-delete-note.js b/lib/migrations/20161009040430-support-delete-note.js
index 56a336ac..b7ee72c3 100644
--- a/lib/migrations/20161009040430-support-delete-note.js
+++ b/lib/migrations/20161009040430-support-delete-note.js
@@ -3,6 +3,7 @@ module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: deletedAt' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'deletedAt'" || error.message === 'column "deletedAt" of relation "Notes" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20161201050312-support-email-signin.js b/lib/migrations/20161201050312-support-email-signin.js
index 26bc09ea..5c9fbf85 100644
--- a/lib/migrations/20161201050312-support-email-signin.js
+++ b/lib/migrations/20161201050312-support-email-signin.js
@@ -4,6 +4,7 @@ module.exports = {
return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () {
return queryInterface.addColumn('Users', 'password', Sequelize.TEXT).catch(function (error) {
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'password'" || error.message === 'column "password" of relation "Users" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
@@ -11,6 +12,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: email' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'email'" || error.message === 'column "email" of relation "Users" already exists') {
+ // eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
diff --git a/lib/migrations/20171009121200-longtext-for-mysql.js b/lib/migrations/20171009121200-longtext-for-mysql.js
index 2a7d0d3a..cb9fc8a5 100644
--- a/lib/migrations/20171009121200-longtext-for-mysql.js
+++ b/lib/migrations/20171009121200-longtext-for-mysql.js
@@ -1,16 +1,16 @@
'use strict'
module.exports = {
up: function (queryInterface, Sequelize) {
- queryInterface.changeColumn('Notes', 'content', {type: Sequelize.TEXT('long')})
- queryInterface.changeColumn('Revisions', 'patch', {type: Sequelize.TEXT('long')})
- queryInterface.changeColumn('Revisions', 'content', {type: Sequelize.TEXT('long')})
- queryInterface.changeColumn('Revisions', 'lastContent', {type: Sequelize.TEXT('long')})
+ queryInterface.changeColumn('Notes', 'content', { type: Sequelize.TEXT('long') })
+ queryInterface.changeColumn('Revisions', 'patch', { type: Sequelize.TEXT('long') })
+ queryInterface.changeColumn('Revisions', 'content', { type: Sequelize.TEXT('long') })
+ queryInterface.changeColumn('Revisions', 'lastContent', { type: Sequelize.TEXT('long') })
},
down: function (queryInterface, Sequelize) {
- queryInterface.changeColumn('Notes', 'content', {type: Sequelize.TEXT})
- queryInterface.changeColumn('Revisions', 'patch', {type: Sequelize.TEXT})
- queryInterface.changeColumn('Revisions', 'content', {type: Sequelize.TEXT})
- queryInterface.changeColumn('Revisions', 'lastContent', {type: Sequelize.TEXT})
+ queryInterface.changeColumn('Notes', 'content', { type: Sequelize.TEXT })
+ queryInterface.changeColumn('Revisions', 'patch', { type: Sequelize.TEXT })
+ queryInterface.changeColumn('Revisions', 'content', { type: Sequelize.TEXT })
+ queryInterface.changeColumn('Revisions', 'lastContent', { type: Sequelize.TEXT })
}
}
diff --git a/lib/migrations/20180209120907-longtext-of-authorship.js b/lib/migrations/20180209120907-longtext-of-authorship.js
index 4cca5444..c5d8a1ef 100644
--- a/lib/migrations/20180209120907-longtext-of-authorship.js
+++ b/lib/migrations/20180209120907-longtext-of-authorship.js
@@ -2,12 +2,12 @@
module.exports = {
up: function (queryInterface, Sequelize) {
- queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT('long')})
- queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT('long')})
+ queryInterface.changeColumn('Notes', 'authorship', { type: Sequelize.TEXT('long') })
+ queryInterface.changeColumn('Revisions', 'authorship', { type: Sequelize.TEXT('long') })
},
down: function (queryInterface, Sequelize) {
- queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT})
- queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT})
+ queryInterface.changeColumn('Notes', 'authorship', { type: Sequelize.TEXT })
+ queryInterface.changeColumn('Revisions', 'authorship', { type: Sequelize.TEXT })
}
}
diff --git a/lib/migrations/20180306150303-fix-enum.js b/lib/migrations/20180306150303-fix-enum.js
index 0ee58a94..433a9749 100644
--- a/lib/migrations/20180306150303-fix-enum.js
+++ b/lib/migrations/20180306150303-fix-enum.js
@@ -2,10 +2,10 @@
module.exports = {
up: function (queryInterface, Sequelize) {
- queryInterface.changeColumn('Notes', 'permission', {type: Sequelize.ENUM('freely', 'editable', 'limited', 'locked', 'protected', 'private')})
+ queryInterface.changeColumn('Notes', 'permission', { type: Sequelize.ENUM('freely', 'editable', 'limited', 'locked', 'protected', 'private') })
},
down: function (queryInterface, Sequelize) {
- queryInterface.changeColumn('Notes', 'permission', {type: Sequelize.ENUM('freely', 'editable', 'locked', 'private')})
+ queryInterface.changeColumn('Notes', 'permission', { type: Sequelize.ENUM('freely', 'editable', 'locked', 'private') })
}
}
diff --git a/lib/models/index.js b/lib/models/index.js
index ef70475e..0f27f57d 100644
--- a/lib/models/index.js
+++ b/lib/models/index.js
@@ -3,7 +3,7 @@
var fs = require('fs')
var path = require('path')
var Sequelize = require('sequelize')
-const {cloneDeep} = require('lodash')
+const { cloneDeep } = require('lodash')
// core
var config = require('../config')
@@ -39,13 +39,13 @@ sequelize.processData = processData
var db = {}
fs.readdirSync(__dirname)
- .filter(function (file) {
- return (file.indexOf('.') !== 0) && (file !== 'index.js')
- })
- .forEach(function (file) {
- var model = sequelize.import(path.join(__dirname, file))
- db[model.name] = model
- })
+ .filter(function (file) {
+ return (file.indexOf('.') !== 0) && (file !== 'index.js')
+ })
+ .forEach(function (file) {
+ var model = sequelize.import(path.join(__dirname, file))
+ db[model.name] = model
+ })
Object.keys(db).forEach(function (modelName) {
if ('associate' in db[modelName]) {
diff --git a/lib/response.js b/lib/response.js
index 9fc9258c..dd33e42b 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -18,7 +18,7 @@ var utils = require('./utils')
// public
var response = {
errorForbidden: function (res) {
- const {req} = res
+ const { req } = res
if (req.user) {
responseError(res, '403', 'Forbidden', 'oh no.')
} else {
@@ -549,16 +549,16 @@ function gitlabActionProjects (req, res, note) {
ret.accesstoken = user.accessToken
ret.profileid = user.profileid
request(
- config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?membership=yes&per_page=100&access_token=' + user.accessToken,
- function (error, httpResponse, body) {
- if (!error && httpResponse.statusCode === 200) {
- ret.projects = JSON.parse(body)
- return res.send(ret)
- } else {
- return res.send(ret)
- }
- }
- )
+ config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?membership=yes&per_page=100&access_token=' + user.accessToken,
+ function (error, httpResponse, body) {
+ if (!error && httpResponse.statusCode === 200) {
+ ret.projects = JSON.parse(body)
+ return res.send(ret)
+ } else {
+ return res.send(ret)
+ }
+ }
+ )
}).catch(function (err) {
logger.error('gitlab action projects failed: ' + err)
return response.errorInternalError(res)
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()