Fixed issues with imageblobblur and typo in io.js

This commit is contained in:
Kasper Rynning-Tønnesen
2018-05-12 15:11:35 +02:00
parent f4c9371593
commit b2d0d08cd7
2 changed files with 117 additions and 109 deletions

View File

@@ -434,8 +434,10 @@ module.exports = function() {
if(list.hasOwnProperty("channel") && list.channel.indexOf("?") > -1){ if(list.hasOwnProperty("channel") && list.channel.indexOf("?") > -1){
var _list = list.channel.substring(0, list.channel.indexOf("?")); var _list = list.channel.substring(0, list.channel.indexOf("?"));
list.channel = _list; list.channel = _list;
coll = list.channel;
} }
List.skip(list, guid, coll.replace(/ /g,''), offline, socket); if(coll != undefined) coll.replace(/ /g,'');
List.skip(list, guid, coll, offline, socket);
}); });
socket.on('conf', function(conf) socket.on('conf', function(conf)
@@ -443,8 +445,10 @@ module.exports = function() {
if(conf.hasOwnProperty("channel") && conf.channel.indexOf("?") > -1){ if(conf.hasOwnProperty("channel") && conf.channel.indexOf("?") > -1){
var _list = conf.channel.substring(0, conf.channel.indexOf("?")); var _list = conf.channel.substring(0, conf.channel.indexOf("?"));
conf.channel = _list; conf.channel = _list;
coll = conf.channel;
} }
ListSettings.conf_function(conf, coll.replace(/ /g,''), guid, offline, socket); if(coll != undefined) coll.replace(/ /g,'');
ListSettings.conf_function(conf, coll, guid, offline, socket);
}); });
socket.on('shuffle', function(msg) socket.on('shuffle', function(msg)
@@ -589,12 +593,12 @@ module.exports = function() {
/* /*
function send_ping() { function send_ping() {
db.collection("connected_users").update({users: {$exists: true}}, {$set: {users: []}}, {multi: true}, function(err, docs){ db.collection("connected_users").update({users: {$exists: true}}, {$set: {users: []}}, {multi: true}, function(err, docs){
db.collection("connected_users").update({"_id": "total_users"}, {$add: {total_users: 0}}, {multi: true}, function(err, docs){ db.collection("connected_users").update({"_id": "total_users"}, {$add: {total_users: 0}}, {multi: true}, function(err, docs){
db.collection("frontpage_lists").update({viewers: {$ne: 0}}, {$set: {"viewers": 0}}, {multi: true}, function(err, docs) { db.collection("frontpage_lists").update({viewers: {$ne: 0}}, {$set: {"viewers": 0}}, {multi: true}, function(err, docs) {
io.emit("self_ping"); io.emit("self_ping");
setTimeout(send_ping, 25000); setTimeout(send_ping, 25000);
}); });
}); });
}); });
}*/ }*/

View File

@@ -1125,9 +1125,13 @@ router.route('/api/color').post(function(req, res) {
router.route('/api/imageblob').post(function(req, res) { router.route('/api/imageblob').post(function(req, res) {
var Jimp = require("jimp"); var Jimp = require("jimp");
try {
var origin = req.get("origin").replace("https://", "").replace("http://", ""); var origin = req.get("origin").replace("https://", "").replace("http://", "");
var allowed = ["client.localhost", "localhost", "zoff.me", "client.zoff.me", "zoff.no", "client.zoff.no"]; var allowed = ["client.localhost", "localhost", "zoff.me", "client.zoff.me", "zoff.no", "client.zoff.no"];
if(allowed.indexOf(origin) < 0) { if(allowed.indexOf(origin) < 0) {
throw "Wrong origin";
}
} catch(e) {
res.sendStatus(403); res.sendStatus(403);
return; return;
} }