mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed some skipping bugs
This commit is contained in:
@@ -309,11 +309,19 @@ io.on('connection', function(socket){
|
|||||||
io.sockets.emit(coll+",viewers", lists[coll].length);
|
io.sockets.emit(coll+",viewers", lists[coll].length);
|
||||||
}
|
}
|
||||||
|
|
||||||
adminpass = list[2];
|
adminpass = "";
|
||||||
|
|
||||||
|
var error = false;
|
||||||
|
if(list != "5" && list != "100" && list != "101" && list != "150" && list !== undefined)
|
||||||
|
{
|
||||||
|
adminpass = list[2];
|
||||||
|
}else if(list == "5" || list == "100" || list == "101" || list == "150"){
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(adminpass);
|
console.log(adminpass);
|
||||||
|
|
||||||
if(adminpass !== undefined && adminpass !== null)
|
if(adminpass !== undefined && adminpass !== null && adminpass != "")
|
||||||
var hash = hash_pass(adminpass);
|
var hash = hash_pass(adminpass);
|
||||||
else
|
else
|
||||||
var hash = "";
|
var hash = "";
|
||||||
@@ -321,14 +329,15 @@ io.on('connection', function(socket){
|
|||||||
db.collection(coll).find({views: {$exists:true}}, function(err, docs){
|
db.collection(coll).find({views: {$exists:true}}, function(err, docs){
|
||||||
console.log(adminpass);
|
console.log(adminpass);
|
||||||
console.log(docs[0]["adminpass"]);
|
console.log(docs[0]["adminpass"]);
|
||||||
if(!docs[0]["skip"] || (docs[0]["adminpass"] == hash && docs[0]["adminpass"] != ""))
|
console.log(error);
|
||||||
|
if(!docs[0]["skip"] || (docs[0]["adminpass"] == hash && docs[0]["adminpass"] != "") || error)
|
||||||
{
|
{
|
||||||
if((lists[coll].length/2 <= docs[0]["skips"].length+1 && !contains(docs[0]["skips"], guid) && (get_time() - docs[0]["startTime"] >= 10
|
if((lists[coll].length/2 <= docs[0]["skips"].length+1 && !contains(docs[0]["skips"], guid) && (get_time() - docs[0]["startTime"] >= 10
|
||||||
|| lists[coll].length != 2)) || (docs[0]["adminpass"] == adminpass && docs[0]["adminpass"] != ""))
|
|| lists[coll].length != 2)) || (docs[0]["adminpass"] == adminpass && docs[0]["adminpass"] != ""))
|
||||||
{
|
{
|
||||||
change_song(coll);
|
change_song(coll);
|
||||||
socket.emit("toast", "skip");
|
socket.emit("toast", "skip");
|
||||||
}else if(get_time() - docs[0]["startTime"] < 10 && lists[coll].length == 2)
|
}else if(get_time() - docs[0]["startTime"] < 10 && lists[coll].length == 2 && !error)
|
||||||
{
|
{
|
||||||
socket.emit("toast", "notyetskip");
|
socket.emit("toast", "notyetskip");
|
||||||
}else if(!contains(docs[0]["skips"], guid) && get_time() - docs[0]["startTime"] >= 30){
|
}else if(!contains(docs[0]["skips"], guid) && get_time() - docs[0]["startTime"] >= 30){
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ function errorHandler(newState)
|
|||||||
var failsafe = ytplayer.getVideoUrl().split("https://www.youtube.com/watch");
|
var failsafe = ytplayer.getVideoUrl().split("https://www.youtube.com/watch");
|
||||||
if(newState.data == 5 || newState.data == 100 || newState.data == 101 || newState.data == 150)
|
if(newState.data == 5 || newState.data == 100 || newState.data == 101 || newState.data == 150)
|
||||||
{
|
{
|
||||||
socket.emit("skip");
|
socket.emit("skip", newState.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user