Node.js based forum software built for the modern web
closes #6334
Barış Soner Uşaklı245e1a9159a8
diff --git a/install/package.json b/install/package.jsonindex b719934cc8..d6441ffc07 100644--- a/install/package.json+++ b/install/package.json@@ -73,9 +73,9 @@"nodebb-plugin-spam-be-gone": "0.5.3","nodebb-rewards-essentials": "0.0.11","nodebb-theme-lavender": "5.0.3",- "nodebb-theme-persona": "7.2.25",+ "nodebb-theme-persona": "7.2.26","nodebb-theme-slick": "1.1.4",- "nodebb-theme-vanilla": "8.1.10",+ "nodebb-theme-vanilla": "8.1.11","nodebb-widget-essentials": "4.0.2","nodemailer": "4.4.1","passport": "^0.4.0",diff --git a/public/src/sockets.js b/public/src/sockets.jsindex 1aaf02ca53..0a0c295217 100644--- a/public/src/sockets.js+++ b/public/src/sockets.js@@ -17,30 +17,36 @@ app.isConnected = false;socket = io(config.websocketAddress, ioParams);- socket.on('connect', onConnect);+ if (parseInt(app.user.uid, 10) >= 0) {+ addHandlers();+ }- socket.on('reconnecting', onReconnecting);+ function addHandlers() {+ socket.on('connect', onConnect);- socket.on('disconnect', onDisconnect);+ socket.on('reconnecting', onReconnecting);- socket.on('reconnect_failed', function () {- // Wait ten times the reconnection delay and then start over- setTimeout(socket.connect.bind(socket), parseInt(config.reconnectionDelay, 10) * 10);- });+ socket.on('disconnect', onDisconnect);- socket.on('checkSession', function (uid) {- if (parseInt(uid, 10) !== parseInt(app.user.uid, 10)) {- app.handleInvalidSession();- }- });+ socket.on('reconnect_failed', function () {+ // Wait ten times the reconnection delay and then start over+ setTimeout(socket.connect.bind(socket), parseInt(config.reconnectionDelay, 10) * 10);+ });- socket.on('setHostname', function (hostname) {- app.upstreamHost = hostname;- });+ socket.on('checkSession', function (uid) {+ if (parseInt(uid, 10) !== parseInt(app.user.uid, 10)) {+ app.handleInvalidSession();+ }+ });- socket.on('event:banned', onEventBanned);+ socket.on('setHostname', function (hostname) {+ app.upstreamHost = hostname;+ });++ socket.on('event:banned', onEventBanned);- socket.on('event:alert', app.alert);+ socket.on('event:alert', app.alert);+ }function onConnect() {app.isConnected = true;diff --git a/src/middleware/header.js b/src/middleware/header.jsindex c769991753..00f01b1aba 100644--- a/src/middleware/header.js+++ b/src/middleware/header.js@@ -251,7 +251,7 @@ module.exports = function (middleware) {data.templateValues.useCustomJS = parseInt(meta.config.useCustomJS, 10) === 1;data.templateValues.customJS = data.templateValues.useCustomJS ? meta.config.customJS : '';-+ data.templateValues.isSpider = req.isSpider();req.app.render('footer', data.templateValues, next);},], callback);