mirror of https://github.com/calzoneman/sync.git
Fix setOptions for playlist_max_duration_per_user
This commit is contained in:
parent
02587dbb5c
commit
55b03d51d7
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.36.1",
|
"version": "3.36.2",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -173,26 +173,14 @@ OptionsModule.prototype.handleSetOptions = function (user, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("playlist_max_duration_per_user" in data) {
|
if ("playlist_max_duration_per_user" in data) {
|
||||||
const rawMax = data.playlist_max_duration_per_user;
|
const max = data.playlist_max_duration_per_user;
|
||||||
if (typeof rawMax !== "string" || !rawMax.match(/^(\d+:)*\d+$/)) {
|
if (typeof max !== "number" || isNaN(max) || max < 0) {
|
||||||
user.socket.emit("validationError", {
|
user.socket.emit("errorMsg", {
|
||||||
target: "#cs-playlist_max_duration_per_user",
|
msg: `Expected number for playlist_max_duration_per_user, not "${max}"`
|
||||||
message: `Input must be a time in the format HH:MM:SS, not "${rawMax}"`
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const max = Utilities.parseTime(rawMax);
|
|
||||||
if (isNaN(max) || max < 0) {
|
|
||||||
user.socket.emit("validationError", {
|
|
||||||
target: "#cs-playlist_max_duration_per_user",
|
|
||||||
message: `Input must be a time greater than 0 in the format HH:MM:SS, not "${rawMax}"`
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.opts.playlist_max_duration_per_user = max;
|
this.opts.playlist_max_duration_per_user = max;
|
||||||
sendUpdate = true;
|
sendUpdate = true;
|
||||||
user.socket.emit("validationPassed", {
|
|
||||||
target: "#cs-playlist_max_duration_per_user"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue