Skip to content

Commit

Permalink
only triggering forum updated messaging if hostname matches, fixes #6333
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Feb 20, 2018
1 parent 9a1f722 commit a4a9616
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion public/src/app.js
Expand Up @@ -75,7 +75,7 @@ app.cacheBuster = null;

socket.removeAllListeners('event:nodebb.ready');
socket.on('event:nodebb.ready', function (data) {
if (!app.cacheBuster || app.cacheBuster !== data['cache-buster']) {
if ((data.hostname === app.upstreamHost) && (!app.cacheBuster || app.cacheBuster !== data['cache-buster'])) {
app.cacheBuster = data['cache-buster'];

app.alert({
Expand Down
4 changes: 4 additions & 0 deletions public/src/sockets.js
Expand Up @@ -34,6 +34,10 @@ app.isConnected = false;
}
});

socket.on('setHostname', function (hostname) {
app.upstreamHost = hostname;
});

socket.on('event:banned', onEventBanned);

socket.on('event:alert', app.alert);
Expand Down
2 changes: 2 additions & 0 deletions src/socket.io/index.js
@@ -1,5 +1,6 @@
'use strict';

var os = require('os');
var async = require('async');
var nconf = require('nconf');
var winston = require('winston');
Expand Down Expand Up @@ -84,6 +85,7 @@ function onConnect(socket) {

socket.join('sess_' + socket.request.signedCookies[nconf.get('sessionKey')]);
io.sockets.sockets[socket.id].emit('checkSession', socket.uid);
io.sockets.sockets[socket.id].emit('setHostname', os.hostname());
}

function onMessage(socket, payload) {
Expand Down
2 changes: 2 additions & 0 deletions src/webserver.js
Expand Up @@ -3,6 +3,7 @@

var fs = require('fs');
var path = require('path');
var os = require('os');
var nconf = require('nconf');
var express = require('express');
var app = express();
Expand Down Expand Up @@ -72,6 +73,7 @@ module.exports.listen = function (callback) {

require('./socket.io').server.emit('event:nodebb.ready', {
'cache-buster': meta.config['cache-buster'],
hostname: os.hostname(),
});

plugins.fireHook('action:nodebb.ready');
Expand Down

0 comments on commit a4a9616

Please sign in to comment.