mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Forgot that we use HTTPS now
This commit is contained in:
@@ -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,15 +657,9 @@ 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("coll: " + coll);
|
request('http://img.youtube.com/vi/'+now_playing_doc[0].id+'/mqdefault.jpg', function (err, response, body) {
|
||||||
console.log("err: " + err);
|
|
||||||
console.log("error: " + error);
|
|
||||||
console.log("now_playing_doc: " + now_playing_doc);
|
|
||||||
console.log("request: " + request);
|
|
||||||
request.get('http://img.youtube.com/vi/'+now_playing_doc[0].id+'/mqdefault.jpg')
|
|
||||||
.on('response', function (response) {
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
if (response.statusCode == 404) {
|
if (err || response.statusCode == 404) {
|
||||||
db.collection(coll).remove({now_playing:true}, function(err, docs){
|
db.collection(coll).remove({now_playing:true}, function(err, docs){
|
||||||
change_song_post(coll);
|
change_song_post(coll);
|
||||||
io.to(coll).emit("channel", ["deleted", now_playing_doc[0].id]);
|
io.to(coll).emit("channel", ["deleted", now_playing_doc[0].id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user