From 55b03d51d70dd44bd756b67c516ee6d0f8431977 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sat, 20 May 2017 16:31:52 -0700 Subject: [PATCH] Fix setOptions for playlist_max_duration_per_user --- package.json | 2 +- src/channel/opts.js | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 2fc60f11..bf2453cc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.36.1", + "version": "3.36.2", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/channel/opts.js b/src/channel/opts.js index 70c459da..182e64bb 100644 --- a/src/channel/opts.js +++ b/src/channel/opts.js @@ -173,26 +173,14 @@ OptionsModule.prototype.handleSetOptions = function (user, data) { } if ("playlist_max_duration_per_user" in data) { - const rawMax = data.playlist_max_duration_per_user; - if (typeof rawMax !== "string" || !rawMax.match(/^(\d+:)*\d+$/)) { - user.socket.emit("validationError", { - target: "#cs-playlist_max_duration_per_user", - message: `Input must be a time in the format HH:MM:SS, not "${rawMax}"` + const max = data.playlist_max_duration_per_user; + if (typeof max !== "number" || isNaN(max) || max < 0) { + user.socket.emit("errorMsg", { + msg: `Expected number for playlist_max_duration_per_user, not "${max}"` }); } 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 { - this.opts.playlist_max_duration_per_user = max; - sendUpdate = true; - user.socket.emit("validationPassed", { - target: "#cs-playlist_max_duration_per_user" - }); - } + this.opts.playlist_max_duration_per_user = max; + sendUpdate = true; } }