mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +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"){
|
}else if(err == "5" || err == "100" || err == "101" || err == "150"){
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash = adminpass;
|
hash = adminpass;
|
||||||
//db.collection(coll + "_settings").find(function(err, docs){
|
//db.collection(coll + "_settings").find(function(err, docs){
|
||||||
var strictSkip = false;
|
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[0].strictSkipNumber) strictSkipNumber = docs[0].strictSkipNumber;
|
||||||
if(docs !== null && docs.length !== 0)
|
if(docs !== null && docs.length !== 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!docs[0].skip || (docs[0].adminpass == hash && docs[0].adminpass !== "") || error)
|
if(!docs[0].skip || (docs[0].adminpass == hash && docs[0].adminpass !== "") || error)
|
||||||
{
|
{
|
||||||
|
|
||||||
db.collection("frontpage_lists").find({"_id": coll}, function(err, frontpage_viewers){
|
db.collection("frontpage_lists").find({"_id": coll}, function(err, frontpage_viewers){
|
||||||
if(
|
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) ||
|
(!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)) ||
|
(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))))
|
(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;
|
var socketid = socket.zoff_id;
|
||||||
if(typeof(arr) === 'object' && arr !== undefined && arr !== null && arr !== "" && !isNaN(parseInt(arr.duration)))
|
if(typeof(arr) === 'object' && arr !== undefined && arr !== null && arr !== "" && !isNaN(parseInt(arr.duration)))
|
||||||
{
|
{
|
||||||
if(coll == "" || coll == undefined || coll == null ||
|
if(coll == "" || coll == undefined || coll == null || !arr.hasOwnProperty("duration")) {
|
||||||
!arr.hasOwnProperty("start") || !arr.hasOwnProperty("end")) {
|
|
||||||
var result = {
|
var result = {
|
||||||
start: {
|
start: {
|
||||||
expected: "number or string that can be cast to int",
|
expected: "number or string that can be cast to int",
|
||||||
@@ -339,6 +338,8 @@ function add_function(arr, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if(arr.start == undefined) arr.start = 0;
|
||||||
|
if(arr.end == undefined) arr.end = parseInt(arr.duration);
|
||||||
var start = parseInt(arr.start);
|
var start = parseInt(arr.start);
|
||||||
var end = parseInt(arr.end);
|
var end = parseInt(arr.end);
|
||||||
if(start < 0) {
|
if(start < 0) {
|
||||||
@@ -357,11 +358,13 @@ function add_function(arr, coll, guid, offline, socket) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!arr.hasOwnProperty("source")) {
|
||||||
|
arr.source = "youtube";
|
||||||
|
}
|
||||||
|
|
||||||
if(typeof(arr.id) != "string" || typeof(arr.start) != "number" ||
|
if(typeof(arr.id) != "string" || typeof(arr.start) != "number" ||
|
||||||
typeof(arr.end) != "number" || typeof(arr.title) != "string" ||
|
typeof(arr.end) != "number" || typeof(arr.title) != "string" ||
|
||||||
typeof(arr.list) != "string" || typeof(arr.duration) != "number" ||
|
typeof(arr.list) != "string" || typeof(arr.duration) != "number" ||
|
||||||
typeof(arr.source) != "string" ||
|
|
||||||
(arr.source == "soundcloud" && (!arr.hasOwnProperty("thumbnail") || !Functions.isUrl(arr.thumbnail)))) {
|
(arr.source == "soundcloud" && (!arr.hasOwnProperty("thumbnail") || !Functions.isUrl(arr.thumbnail)))) {
|
||||||
var result = {
|
var result = {
|
||||||
start: {
|
start: {
|
||||||
|
|||||||
Reference in New Issue
Block a user