diff --git a/.htaccess b/.htaccess
index c093fa93..aaedb777 100755
--- a/.htaccess
+++ b/.htaccess
@@ -4,6 +4,15 @@ RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
+RewriteCond %{HTTPS} !=on
+# This checks to make sure the connection is not already HTTPS
+
+RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+# This rule will redirect users from their original location, to the same location but using HTTPS.
+# i.e. http://www.example.com/foo/ to https://www.example.com/foo/
+# The leading slash is made optional so that this will work either in httpd.conf
+# or .htaccess context
+
RewriteRule ^remote/(.*) php/controller.php?id=$1 [L]
RewriteRule ^remote php/controller.php [L]
@@ -14,13 +23,4 @@ RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /(.*)$ /$1 [L]
-RewriteCond %{HTTPS} !=on
-# This checks to make sure the connection is not already HTTPS
-
-RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
-# This rule will redirect users from their original location, to the same location but using HTTPS.
-# i.e. http://www.example.com/foo/ to https://www.example.com/foo/
-# The leading slash is made optional so that this will work either in httpd.conf
-# or .htaccess context
-
Options -Indexes
diff --git a/php/panel.php b/php/panel.php
index f94b5b1c..81f8fa7c 100755
--- a/php/panel.php
+++ b/php/panel.php
@@ -103,8 +103,8 @@
ABBADUR
-
- You can control this Zöff instance from another device by going to http://zoff.no/remote
+
+ You can control this Zöff instance from another device by going to https://zoff.no/remote
diff --git a/server/server.js b/server/server.js
index a028346e..ed71b18b 100755
--- a/server/server.js
+++ b/server/server.js
@@ -1,17 +1,30 @@
-var fs = require('fs');
-var https = require('https');
-var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8');
-var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8');
+var server;
+/******
-var credentials = {key: privateKey, cert: certificate};
+This if for the localhost running
+
+******/
+localhost = false;
//https server
-var httpsServer = https.createServer(credentials, app);
+if(localhost)
+{
+ var http = require('http');
+ server = http.createServer(app);
+}else
+{
+ var fs = require('fs');
+ var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8');
+ var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8');
+ var credentials = {key: privateKey, cert: certificate};
+ var https = require('https');
+ server = https.createServer(credentials, app);
+}
var express = require('express');
var app = express();
//var server = require('http').createServer(app);
-var io = require('socket.io')(httpsServer);
+var io = require('socket.io')(server);
//db
var mongojs = require('mongojs');
@@ -23,7 +36,7 @@ var crypto = require('crypto');
var port = 3000;
var lists = [];
-httpsServer.listen(port, function () {
+server.listen(port, function () {
console.log('Server listening at port %d', port);
});
@@ -268,6 +281,12 @@ io.on('connection', function(socket){
np = false;
db.collection(coll).insert({"added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}, function(err, docs){
io.sockets.emit(coll, ["added", {"_id": "asd", "added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}]);
+ //io.sockets.emit(coll, ["added", {"_id": "asd", "added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}]);
+ if(np)
+ {
+ send_play(coll, undefined);
+ io.sockets.emit(coll, ["song_change", get_time()]);
+ }
//sort_list(coll, undefined, np, true);
});
});
diff --git a/static/js/list.js b/static/js/list.js
index 8bc4ab03..18baa50b 100755
--- a/static/js/list.js
+++ b/static/js/list.js
@@ -119,7 +119,7 @@ function populate_list(msg)
var video_title=decodeURIComponent(listeID.title);
var video_id = listeID.id;
- var video_thumb = "background-image:url('https://img.youtube.com/vi/"+video_id+"/mqdefault.jpg');";
+ var video_thumb = "background-image:url('//img.youtube.com/vi/"+video_id+"/mqdefault.jpg');";
//var delsong = ""; if(pass_corr=="correct");
var video_votes = listeID.votes;
$("#wrapper").append(list_html);
@@ -285,7 +285,7 @@ function generateSong(song_info, transition)
var video_id = song_info.id;
var video_title = song_info.title;
var video_votes = song_info.votes;
- var video_thumb = "background-image:url('https://img.youtube.com/vi/"+video_id+"/mqdefault.jpg');";
+ var video_thumb = "background-image:url('//img.youtube.com/vi/"+video_id+"/mqdefault.jpg');";
var song = $(""+list_html+"
");
if(transition) song.find("#list-song").css("height", 0);
diff --git a/static/js/nochan.js b/static/js/nochan.js
index 06750ede..b703bae5 100755
--- a/static/js/nochan.js
+++ b/static/js/nochan.js
@@ -82,7 +82,7 @@ $(document).ready(function (){
list_html = $("#channels").html();
$("#channels").empty();
- var socket = io.connect('https://'+window.location.hostname+':3000');
+ var socket = io.connect('//'+window.location.hostname+':3000');
var playlists = [];
socket.emit('frontpage_lists');
socket.on('playlists', function(msg){
diff --git a/static/js/youtube.js b/static/js/youtube.js
index 68f8d723..9540db2f 100755
--- a/static/js/youtube.js
+++ b/static/js/youtube.js
@@ -27,14 +27,14 @@ function setup_youtube_listener(channel)
{
socket.on(channel.toLowerCase()+",np", function(obj)
{
- //console.log(obj);
+ console.log(obj);
if(obj[0].length == 0){
console.log("Empty list");
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
$("#player_overlay").height($("#player").height());
if(!window.mobilecheck())
$("#player_overlay").toggleClass("hide");
- importOldList(channel.toLowerCasettings-barse());
+ importOldList(channel.toLowerCase());
}
else{
//console.log("gotten new song");
@@ -267,16 +267,19 @@ function readyLooks()
}
function setBGimage(id){
- var img = new Image();
- img.onload = function () {
- var colorThief = new ColorThief();
- //console.log(rgbToHsl(colorThief.getColor(img)));
- document.getElementsByTagName("body")[0].style.backgroundColor = rgbToHsl(colorThief.getColor(img))
- //$("body").css("background-color", rgbToHsl(colorThief.getColor(img)));
- //$("body").css("background-color", colorThief.getColor(img));
- };
- img.crossOrigin = 'Anonymous';
- img.src = 'https://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
+ if(id !== undefined)
+ {
+ var img = new Image();
+ img.onload = function () {
+ var colorThief = new ColorThief();
+ //console.log(rgbToHsl(colorThief.getColor(img)));
+ document.getElementsByTagName("body")[0].style.backgroundColor = rgbToHsl(colorThief.getColor(img))
+ //$("body").css("background-color", rgbToHsl(colorThief.getColor(img)));
+ //$("body").css("background-color", colorThief.getColor(img));
+ };
+ img.crossOrigin = 'Anonymous';
+ img.src = 'https://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
+ }
}
function notifyUser(id, title) {