mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 09:50:24 +00:00
Merge branch 'master' into feature/tags
This commit is contained in:
@@ -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))))
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user