diff options
author | David Mehren | 2021-02-16 20:15:15 +0100 |
---|---|---|
committer | GitHub | 2021-02-16 20:15:15 +0100 |
commit | 59819be34c2428450528362a5bbb74b6424d15d2 (patch) | |
tree | ad80595f5dd94a7ac63bc1481943ae7b356ddb17 /app.js | |
parent | 6b8fa94402539168a5bd574ddcc17eeae4910bd0 (diff) | |
parent | 136d895d155f28c2e75b3af206549acaa2a354ed (diff) |
Merge pull request #872 from hedgedoc/renovate/master-major-linters
Diffstat (limited to '')
-rw-r--r-- | app.js | 76 |
1 files changed, 38 insertions, 38 deletions
@@ -1,44 +1,44 @@ 'use strict' // app // external modules -var express = require('express') - -var ejs = require('ejs') -var passport = require('passport') -var methodOverride = require('method-override') -var cookieParser = require('cookie-parser') -var compression = require('compression') -var session = require('express-session') -var SequelizeStore = require('connect-session-sequelize')(session.Store) -var fs = require('fs') -var path = require('path') - -var morgan = require('morgan') -var passportSocketIo = require('passport.socketio') -var helmet = require('helmet') -var i18n = require('i18n') -var flash = require('connect-flash') +const express = require('express') + +const ejs = require('ejs') +const passport = require('passport') +const methodOverride = require('method-override') +const cookieParser = require('cookie-parser') +const compression = require('compression') +const session = require('express-session') +const SequelizeStore = require('connect-session-sequelize')(session.Store) +const fs = require('fs') +const path = require('path') + +const morgan = require('morgan') +const passportSocketIo = require('passport.socketio') +const helmet = require('helmet') +const i18n = require('i18n') +const flash = require('connect-flash') // core -var config = require('./lib/config') -var logger = require('./lib/logger') -var errors = require('./lib/errors') -var models = require('./lib/models') -var csp = require('./lib/csp') +const config = require('./lib/config') +const logger = require('./lib/logger') +const errors = require('./lib/errors') +const models = require('./lib/models') +const csp = require('./lib/csp') // server setup -var app = express() -var server = null +const app = express() +let server = null if (config.useSSL) { - var ca = (function () { - var i, len, results - results = [] + const ca = (function () { + let i, len + const results = [] for (i = 0, len = config.sslCAPath.length; i < len; i++) { results.push(fs.readFileSync(config.sslCAPath[i], 'utf8')) } return results })() - var options = { + const options = { key: fs.readFileSync(config.sslKeyPath, 'utf8'), cert: fs.readFileSync(config.sslCertPath, 'utf8'), ca: ca, @@ -60,18 +60,18 @@ if (!config.useSSL && config.protocolUseSSL) { // logger app.use(morgan('combined', { - 'stream': logger.stream + stream: logger.stream })) // socket io -var io = require('socket.io')(server, { cookie: false }) +const io = require('socket.io')(server, { cookie: false }) io.engine.ws = new (require('ws').Server)({ noServer: true, perMessageDeflate: false }) // others -var realtime = require('./lib/realtime.js') +const realtime = require('./lib/realtime.js') // assign socket io to realtime realtime.io = io @@ -80,7 +80,7 @@ realtime.io = io app.use(methodOverride('_method')) // session store -var sessionStore = new SequelizeStore({ +const sessionStore = new SequelizeStore({ db: models.sequelize }) @@ -154,7 +154,7 @@ app.use(session({ })) // session resumption -var tlsSessionStore = {} +const tlsSessionStore = {} server.on('newSession', function (id, data, cb) { tlsSessionStore[id.toString('hex')] = data cb() @@ -246,9 +246,9 @@ io.sockets.on('connection', realtime.connection) // listen function startListen () { - var address - var listenCallback = function () { - var schema = config.useSSL ? 'HTTPS' : 'HTTP' + let address + const listenCallback = function () { + const schema = config.useSSL ? 'HTTPS' : 'HTTP' logger.info('%s Server listening at %s', schema, address) realtime.maintenance = false } @@ -290,7 +290,7 @@ function handleTermSignals () { realtime.maintenance = true // disconnect all socket.io clients Object.keys(io.sockets.sockets).forEach(function (key) { - var socket = io.sockets.sockets[key] + const socket = io.sockets.sockets[key] // notify client server going into maintenance status socket.emit('maintenance') setTimeout(function () { @@ -300,7 +300,7 @@ function handleTermSignals () { if (config.path) { fs.unlink(config.path) } - var checkCleanTimer = setInterval(function () { + const checkCleanTimer = setInterval(function () { if (realtime.isReady()) { models.Revision.checkAllNotesRevision(function (err, notes) { if (err) return logger.error(err) |