diff --git a/server/handlers/list.js b/server/handlers/list.js index 9d0f1e9d..5e805d64 100644 --- a/server/handlers/list.js +++ b/server/handlers/list.js @@ -198,7 +198,6 @@ function skip(list, guid, coll, offline, socket, callback) { }else if(err == "5" || err == "100" || err == "101" || err == "150"){ error = true; } - hash = adminpass; //db.collection(coll + "_settings").find(function(err, docs){ var strictSkip = false; @@ -207,11 +206,13 @@ function skip(list, guid, coll, offline, socket, callback) { if(docs[0].strictSkipNumber) strictSkipNumber = docs[0].strictSkipNumber; if(docs !== null && docs.length !== 0) { + if(!docs[0].skip || (docs[0].adminpass == hash && docs[0].adminpass !== "") || error) { + db.collection("frontpage_lists").find({"_id": coll}, function(err, frontpage_viewers){ if( - (strictSkip && ((docs[0].adminpass == hash && docs[0].adminpass !== "") || (docs[0].skips.length+1 >= strictSkipNumber))) || + (strictSkip && (error || (docs[0].adminpass == hash && docs[0].adminpass !== "") || (docs[0].skips.length+1 >= strictSkipNumber))) || (!strictSkip && ((frontpage_viewers[0].viewers/2 <= docs[0].skips.length+1 && !Functions.contains(docs[0].skips, guid) && frontpage_viewers[0].viewers != 2) || (frontpage_viewers[0].viewers == 2 && docs[0].skips.length+1 == 2 && !Functions.contains(docs[0].skips, guid)) || (docs[0].adminpass == hash && docs[0].adminpass !== "" && docs[0].skip)))) diff --git a/server/handlers/list_change.js b/server/handlers/list_change.js index 1c138f3d..83561b32 100644 --- a/server/handlers/list_change.js +++ b/server/handlers/list_change.js @@ -322,8 +322,7 @@ function add_function(arr, coll, guid, offline, socket) { var socketid = socket.zoff_id; if(typeof(arr) === 'object' && arr !== undefined && arr !== null && arr !== "" && !isNaN(parseInt(arr.duration))) { - if(coll == "" || coll == undefined || coll == null || - !arr.hasOwnProperty("start") || !arr.hasOwnProperty("end")) { + if(coll == "" || coll == undefined || coll == null || !arr.hasOwnProperty("duration")) { var result = { start: { expected: "number or string that can be cast to int", @@ -339,6 +338,8 @@ function add_function(arr, coll, guid, offline, socket) { } try { + if(arr.start == undefined) arr.start = 0; + if(arr.end == undefined) arr.end = parseInt(arr.duration); var start = parseInt(arr.start); var end = parseInt(arr.end); if(start < 0) { @@ -357,11 +358,13 @@ function add_function(arr, coll, guid, offline, socket) { return; } + if(!arr.hasOwnProperty("source")) { + arr.source = "youtube"; + } if(typeof(arr.id) != "string" || typeof(arr.start) != "number" || typeof(arr.end) != "number" || typeof(arr.title) != "string" || typeof(arr.list) != "string" || typeof(arr.duration) != "number" || - typeof(arr.source) != "string" || (arr.source == "soundcloud" && (!arr.hasOwnProperty("thumbnail") || !Functions.isUrl(arr.thumbnail)))) { var result = { start: {