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 1bd1676f82
commit 0a73c922c3
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)

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;
} }