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

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