diff --git a/lib/channel.js b/lib/channel.js index 4f0db6ee..8b6d2124 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -46,6 +46,7 @@ function Channel(name) { self.poll = null; self.voteskip = null; self.permissions = { + seeplaylist: -1, // See the playlist playlistadd: 1.5, // Add video to the playlist playlistnext: 1.5, playlistmove: 1.5, // Move a video on the playlist @@ -1062,10 +1063,12 @@ Channel.prototype.sendPlaylist = function (users) { } users.forEach(function (u) { - u.socket.emit("playlist", pl); - u.socket.emit("setPlaylistMeta", self.plmeta); - if (current !== null) { - u.socket.emit("setCurrent", current); + if (self.hasPermission(u, "seeplaylist")) { + u.socket.emit("playlist", pl); + u.socket.emit("setPlaylistMeta", self.plmeta); + if (current !== null) { + u.socket.emit("setCurrent", current); + } } }); }; @@ -1096,7 +1099,9 @@ Channel.prototype.updatePlaylistMeta = function () { Channel.prototype.sendPlaylistMeta = function (users) { var self = this; users.forEach(function (u) { - u.socket.emit("setPlaylistMeta", self.plmeta); + if (self.hasPermission(u, "seeplaylist")) { + u.socket.emit("setPlaylistMeta", self.plmeta); + } }); }; @@ -2619,6 +2624,10 @@ Channel.prototype.handleSetPermissions = function (user, perms) { } } + if ("seeplaylist" in perms) { + this.sendPlaylist(this.users); + } + this.logger.log("[mod] " + user.name + " updated permissions"); this.sendAll("setPermissions", this.permissions); }; diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index a7af70f6..f834fee6 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -790,6 +790,10 @@ Callbacks = { }, changeMedia: function(data) { + if ($("body").hasClass("chatOnly")) { + return; + } + if (PLAYER && typeof PLAYER.getVolume === "function") { PLAYER.getVolume(function (v) { if (typeof v === "number") { @@ -848,6 +852,10 @@ Callbacks = { }, mediaUpdate: function(data) { + if ($("body").hasClass("chatOnly")) { + return; + } + handleMediaUpdate(data); }, diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 83027039..d93f9d9d 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -888,6 +888,9 @@ function handlePermissionChange() { setVisible("#adminflair", CLIENT.rank >= 255); setVisible("#guestlogin", CLIENT.rank < 0); setVisible("#chatline", CLIENT.rank >= 0); + setVisible("#queue", hasPermission("seeplaylist")); + setVisible("#plmeta", hasPermission("seeplaylist")); + $("#getplaylist").attr("disabled", !hasPermission("seeplaylist")); setVisible("#showmediaurl", hasPermission("playlistadd")); setVisible("#showcustomembed", hasPermission("playlistaddcustom")); @@ -1617,6 +1620,7 @@ function genPermissionsEditor() { makeOption("Queue playlist", "oplaylistaddlist", standard, CHANNEL.perms.oplaylistaddlist+""); addDivider("General playlist permissions"); + makeOption("View the playlist", "seeplaylist", standard, CHANNEL.perms.seeplaylist+""); makeOption("Add to playlist", "playlistadd", standard, CHANNEL.perms.playlistadd+""); makeOption("Add/move to next", "playlistnext", standard, CHANNEL.perms.playlistnext+""); makeOption("Move playlist items", "playlistmove", standard, CHANNEL.perms.playlistmove+""); diff --git a/www/css/cytube.css b/www/css/cytube.css index 0fb06991..9f7e733a 100644 --- a/www/css/cytube.css +++ b/www/css/cytube.css @@ -505,6 +505,13 @@ li.ui-sortable-helper, li.ui-sortable-placeholder + li.queue_entry { position: fixed; bottom: 0; z-index: 10000; + min-width: 100%; +} + +body.chatOnly .pm-panel, body.chatOnly .pm-panel-placeholder { + margin-left: 0; + margin-right: 5px; + float: right; } .pm-panel, .pm-panel-placeholder {