Added a way of ensuring correct versions between server and client

This commit is contained in:
Kasper Rynning-Tønnesen
2017-09-11 08:57:31 +02:00
parent 7ccb9298c0
commit 2afacf6408
8 changed files with 87 additions and 11 deletions

View File

@@ -67,6 +67,7 @@ app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
}));
app.use(cookieParser());
var VERSION = 2;
var io = require('socket.io')(server, {'pingTimeout': 25000}); //, "origins": ("https://zoff.me:443*,https://zoff.me:8080*,zoff.me:8080*,https://remote.zoff.me:443*,https://remote.zoff.me:8080*,https://fb.zoff.me:443*,https://fb.zoff.me:8080*,https://admin.zoff.me:443*,https://admin.zoff.me:8080*" + add)});
var request = require('request');
var mongojs = require('mongojs');
@@ -356,9 +357,13 @@ io.on('connection', function(socket){
}
});
socket.on('frontpage_lists', function()
socket.on('frontpage_lists', function(msg)
{
if(msg.version != VERSION || msg.version == undefined) {
socket.emit("update_required");
}
var playlists_to_send = [];
var i = 0;
var viewers;
@@ -418,6 +423,10 @@ io.on('connection', function(socket){
if(typeof(msg) === 'object' && msg !== undefined && msg !== null && msg.hasOwnProperty("channel") && msg.hasOwnProperty('pass'))
{
if(msg.version != VERSION || msg.version == undefined) {
socket.emit("update_required");
}
try {
var list = msg.channel;
if(list.length == 0) return;