mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed list issues, and some rewrite errors in htaccess
This commit is contained in:
18
.htaccess
18
.htaccess
@@ -4,6 +4,15 @@ RewriteBase /
|
|||||||
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
|
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
|
||||||
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
|
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?id=$1 [L]
|
||||||
RewriteRule ^remote php/controller.php [L]
|
RewriteRule ^remote php/controller.php [L]
|
||||||
|
|
||||||
@@ -14,13 +23,4 @@ RewriteCond %{REQUEST_FILENAME} !-f
|
|||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule /(.*)$ /$1 [L]
|
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
|
Options -Indexes
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
<img id="code-qr" alt="QR code for control" title="Link to control this Zöff player">
|
<img id="code-qr" alt="QR code for control" title="Link to control this Zöff player">
|
||||||
<h4 id="code-text">ABBADUR</h4>
|
<h4 id="code-text">ABBADUR</h4>
|
||||||
</a>
|
</a>
|
||||||
<a>You can control this Zöff instance from another device by going to <b>http://zoff.no/remote</b><a>
|
<a>You can control this Zöff instance from another device by going to <b>https://zoff.no/remote</b><a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,17 +1,30 @@
|
|||||||
var fs = require('fs');
|
var server;
|
||||||
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 credentials = {key: privateKey, cert: certificate};
|
This if for the localhost running
|
||||||
|
|
||||||
|
******/
|
||||||
|
localhost = false;
|
||||||
|
|
||||||
//https server
|
//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 express = require('express');
|
||||||
var app = express();
|
var app = express();
|
||||||
//var server = require('http').createServer(app);
|
//var server = require('http').createServer(app);
|
||||||
var io = require('socket.io')(httpsServer);
|
var io = require('socket.io')(server);
|
||||||
|
|
||||||
//db
|
//db
|
||||||
var mongojs = require('mongojs');
|
var mongojs = require('mongojs');
|
||||||
@@ -23,7 +36,7 @@ var crypto = require('crypto');
|
|||||||
var port = 3000;
|
var port = 3000;
|
||||||
var lists = [];
|
var lists = [];
|
||||||
|
|
||||||
httpsServer.listen(port, function () {
|
server.listen(port, function () {
|
||||||
console.log('Server listening at port %d', port);
|
console.log('Server listening at port %d', port);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -268,6 +281,12 @@ io.on('connection', function(socket){
|
|||||||
np = false;
|
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){
|
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}]);
|
||||||
|
//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);
|
//sort_list(coll, undefined, np, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ function populate_list(msg)
|
|||||||
|
|
||||||
var video_title=decodeURIComponent(listeID.title);
|
var video_title=decodeURIComponent(listeID.title);
|
||||||
var video_id = listeID.id;
|
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 delsong = ""; if(pass_corr=="correct");
|
||||||
var video_votes = listeID.votes;
|
var video_votes = listeID.votes;
|
||||||
$("#wrapper").append(list_html);
|
$("#wrapper").append(list_html);
|
||||||
@@ -285,7 +285,7 @@ function generateSong(song_info, transition)
|
|||||||
var video_id = song_info.id;
|
var video_id = song_info.id;
|
||||||
var video_title = song_info.title;
|
var video_title = song_info.title;
|
||||||
var video_votes = song_info.votes;
|
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 = $("<div>"+list_html+"</div>");
|
var song = $("<div>"+list_html+"</div>");
|
||||||
if(transition) song.find("#list-song").css("height", 0);
|
if(transition) song.find("#list-song").css("height", 0);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ $(document).ready(function (){
|
|||||||
list_html = $("#channels").html();
|
list_html = $("#channels").html();
|
||||||
$("#channels").empty();
|
$("#channels").empty();
|
||||||
|
|
||||||
var socket = io.connect('https://'+window.location.hostname+':3000');
|
var socket = io.connect('//'+window.location.hostname+':3000');
|
||||||
var playlists = [];
|
var playlists = [];
|
||||||
socket.emit('frontpage_lists');
|
socket.emit('frontpage_lists');
|
||||||
socket.on('playlists', function(msg){
|
socket.on('playlists', function(msg){
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ function setup_youtube_listener(channel)
|
|||||||
{
|
{
|
||||||
socket.on(channel.toLowerCase()+",np", function(obj)
|
socket.on(channel.toLowerCase()+",np", function(obj)
|
||||||
{
|
{
|
||||||
//console.log(obj);
|
console.log(obj);
|
||||||
if(obj[0].length == 0){
|
if(obj[0].length == 0){
|
||||||
console.log("Empty list");
|
console.log("Empty list");
|
||||||
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||||
$("#player_overlay").height($("#player").height());
|
$("#player_overlay").height($("#player").height());
|
||||||
if(!window.mobilecheck())
|
if(!window.mobilecheck())
|
||||||
$("#player_overlay").toggleClass("hide");
|
$("#player_overlay").toggleClass("hide");
|
||||||
importOldList(channel.toLowerCasettings-barse());
|
importOldList(channel.toLowerCase());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//console.log("gotten new song");
|
//console.log("gotten new song");
|
||||||
@@ -267,6 +267,8 @@ function readyLooks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setBGimage(id){
|
function setBGimage(id){
|
||||||
|
if(id !== undefined)
|
||||||
|
{
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.onload = function () {
|
img.onload = function () {
|
||||||
var colorThief = new ColorThief();
|
var colorThief = new ColorThief();
|
||||||
@@ -277,6 +279,7 @@ function setBGimage(id){
|
|||||||
};
|
};
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
img.src = 'https://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
img.src = 'https://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyUser(id, title) {
|
function notifyUser(id, title) {
|
||||||
|
|||||||
Reference in New Issue
Block a user