Merge branch 'master' of github.com:zoff-music/Zoff

This commit is contained in:
Nicolas Almagro Tonne
2015-11-28 18:25:22 +01:00
4 changed files with 17 additions and 17 deletions

View File

@@ -226,13 +226,13 @@ var getHandler = exports.getHandler = function(options, proxy) {
}; };
return function(req, res) { return function(req, res) {
/*if(req.headers.referer && req.headers.referer.substring(0,14) !== "http://zoff.no") if(req.headers.referer && req.headers.referer.substring(0,15) !== "https://zoff.no")
{ {
res.writeHead(401, "You're accessing the cors-anywhere from wrong domain, only http://zoff.no is allowed"); res.writeHead(401, "You're accessing the cors-anywhere from wrong domain, only http://zoff.no is allowed");
res.end(); res.end();
return; return;
} }
*/
var cors_headers = withCORS({}, req); var cors_headers = withCORS({}, req);
if (req.method == 'OPTIONS') { if (req.method == 'OPTIONS') {
// Pre-flight request. Reply successfully: // Pre-flight request. Reply successfully:

View File

@@ -22,20 +22,21 @@ try{
} }
catch(err){ catch(err){
console.log("Starting without https (probably on localhost)"); console.log("Starting without https (probably on localhost)");
if(err["errno"] != 34)console.log(err); if(err["errno"] != 34)console.log(err);
var cors_proxy = require('cors-anywhere'); var cors_proxy = require('cors-anywhere');
var request = require('request');
cors_proxy.createServer({ cors_proxy.createServer({
requireHeader: ['origin', 'x-requested-with'], requireHeader: ['origin', 'x-requested-with'],
removeHeaders: ['cookie', 'cookie2'], removeHeaders: ['cookie', 'cookie2'],
}).listen(8080, function() { }).listen(8080, function() {
console.log('Running CORS Anywhere on :' + 8080); console.log('Running CORS Anywhere on :' + 8080);
}); });
var http = require('http'); var http = require('http');
server = http.createServer(handler); server = http.createServer(handler);
} }
var request = require('request');
var io = require('socket.io')(server, {'pingTimeout': 25000}); var io = require('socket.io')(server, {'pingTimeout': 25000});
//db //db
@@ -656,7 +657,6 @@ function change_song(coll, error)
{ {
db.collection(coll).find({now_playing:true}, function(err, now_playing_doc){ db.collection(coll).find({now_playing:true}, function(err, now_playing_doc){
if(error){ if(error){
console.log(now_playing_doc);
request('http://img.youtube.com/vi/'+now_playing_doc[0].id+'/mqdefault.jpg', function (err, response, body) { request('http://img.youtube.com/vi/'+now_playing_doc[0].id+'/mqdefault.jpg', function (err, response, body) {
console.log(response); console.log(response);
if (err || response.statusCode == 404) { if (err || response.statusCode == 404) {

File diff suppressed because one or more lines are too long

View File

@@ -158,7 +158,7 @@ var Youtube = {
}; };
img.crossOrigin = 'Anonymous'; img.crossOrigin = 'Anonymous';
img.src = '//zoff.no:8080/http://img.youtube.com/vi/'+id+'/mqdefault.jpg'; img.src = 'https://zoff.no:8080/https://img.youtube.com/vi/'+id+'/mqdefault.jpg';
} }
}, },