This commit is contained in:
calzoneman 2013-05-19 12:56:13 -04:00
parent 3e2683642e
commit 01fc746334
7 changed files with 82 additions and 52 deletions

View file

@ -42,6 +42,8 @@ var Channel = function(name) {
this.poll = false; this.poll = false;
this.voteskip = false; this.voteskip = false;
this.opts = { this.opts = {
qopen_allow_anon: false,
qopen_allow_guest: true,
qopen_allow_qnext: false, qopen_allow_qnext: false,
qopen_allow_move: false, qopen_allow_move: false,
qopen_allow_playnext: false, qopen_allow_playnext: false,
@ -793,9 +795,14 @@ Channel.prototype.enqueue = function(data, user) {
} }
Channel.prototype.tryQueue = function(user, data) { Channel.prototype.tryQueue = function(user, data) {
if(!Rank.hasPermission(user, "queue") && var anon = (user.name == "");
this.leader != user && var guest = (user.name != "" && !user.loggedIn);
!this.openqueue) { var canqueue = (anon && this.opts.qopen_allow_anon) ||
(guest && this.opts.qopen_allow_guest) ||
(!anon && !guest);
canqueue = canqueue && this.openqueue;
canqueue = canqueue || this.leader == user || Rank.hasPermission(user, "queue");
if(!canqueue) {
return; return;
} }
if(data.pos == undefined || data.id == undefined) { if(data.pos == undefined || data.id == undefined) {

View file

@ -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": "1.8.0", "version": "1.8.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View file

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
const VERSION = "1.8.0"; const VERSION = "1.8.1";
var fs = require("fs"); var fs = require("fs");
var Logger = require("./logger.js"); var Logger = require("./logger.js");

View file

@ -182,6 +182,8 @@ Callbacks = {
}, },
channelOpts: function(opts) { channelOpts: function(opts) {
$("#opt_qopen_allow_anon").prop("checked", opts.qopen_allow_anon);
$("#opt_qopen_allow_guest").prop("checked", opts.qopen_allow_guest);
$("#opt_qopen_allow_qnext").prop("checked", opts.qopen_allow_qnext); $("#opt_qopen_allow_qnext").prop("checked", opts.qopen_allow_qnext);
$("#opt_qopen_allow_move").prop("checked", opts.qopen_allow_move); $("#opt_qopen_allow_move").prop("checked", opts.qopen_allow_move);
$("#opt_qopen_allow_delete").prop("checked", opts.qopen_allow_delete); $("#opt_qopen_allow_delete").prop("checked", opts.qopen_allow_delete);
@ -226,7 +228,7 @@ Callbacks = {
$("#voteskip").attr("disabled", false); $("#voteskip").attr("disabled", false);
else else
$("#voteskip").attr("disabled", true); $("#voteskip").attr("disabled", true);
rebuildPlaylist(); handleRankChange();
}, },
channelCSSJS: function(data) { channelCSSJS: function(data) {

View file

@ -346,6 +346,8 @@ $("#opt_submit").click(function() {
var css = $("#opt_customcss").val(); var css = $("#opt_customcss").val();
var ratio = +$("#opt_voteskip_ratio").val() || 0.5; var ratio = +$("#opt_voteskip_ratio").val() || 0.5;
opts = { opts = {
qopen_allow_anon: $("#opt_qopen_allow_anon").prop("checked"),
qopen_allow_guest: $("#opt_qopen_allow_guest").prop("checked"),
qopen_allow_qnext: $("#opt_qopen_allow_qnext").prop("checked"), qopen_allow_qnext: $("#opt_qopen_allow_qnext").prop("checked"),
qopen_allow_move: $("#opt_qopen_allow_move").prop("checked"), qopen_allow_move: $("#opt_qopen_allow_move").prop("checked"),
qopen_allow_delete: $("#opt_qopen_allow_delete").prop("checked"), qopen_allow_delete: $("#opt_qopen_allow_delete").prop("checked"),

View file

@ -387,7 +387,7 @@ function addQueueButtons(li) {
function rebuildPlaylist() { function rebuildPlaylist() {
$("#queue li").each(function() { $("#queue li").each(function() {
$(this).find(".btn-group").remove(); $(this).find(".btn-group").remove();
if(RANK >= Rank.Moderator || LEADER || OPENQUEUE) if(RANK >= Rank.Moderator || LEADER || canQueue())
addQueueButtons(this); addQueueButtons(this);
}); });
} }
@ -599,24 +599,28 @@ function closePoll() {
} }
} }
function canQueue() {
var anon = !uname;
var guest = (uname && !session);
var canqueue = (!guest && !anon) ||
(guest && CHANNELOPTS.qopen_allow_guest) ||
(anon && CHANNELOPTS.qopen_allow_anon);
canqueue = canqueue && OPENQUEUE;
return canqueue;
}
function handleRankChange() { function handleRankChange() {
rebuildPlaylist(); rebuildPlaylist();
if(RANK >= Rank.Moderator || LEADER) { if(RANK >= 10) {
$("#playlist_controls").css("display", "block"); $("#drop_channel").parent().css("display", "");
$("#playlist_controls button").each(function() {
$(this).attr("disabled", false);
});
$("#pollcontainer .active").each(function() {
var btns = $(this).find(".btn-danger");
if(btns.length == 0) {
$("<button/>").addClass("btn btn-danger pull-right")
.text("End Poll")
.insertAfter($(this).find(".close"))
.click(function() {
socket.emit("closePoll")
});
} }
}); if(RANK >= Rank.Owner) {
$("#show_jseditor").parent().css("display", "");
$("#show_csseditor").parent().css("display", "");
}
else {
$("#show_jseditor").parent().css("display", "none");
$("#show_csseditor").parent().css("display", "none");
} }
if(RANK >= Rank.Moderator) { if(RANK >= Rank.Moderator) {
$("#qlockbtn").css("display", "block"); $("#qlockbtn").css("display", "block");
@ -640,8 +644,10 @@ function handleRankChange() {
$("#show_filtereditor").attr("disabled", val); $("#show_filtereditor").attr("disabled", val);
$("#show_acl").attr("disabled", val); $("#show_acl").attr("disabled", val);
} }
else if(!LEADER) { else {
if(OPENQUEUE) { if(!LEADER) {
if(canQueue()) {
$("#playlist_controls").css("display", "");
if(CHANNELOPTS.qopen_allow_qnext) if(CHANNELOPTS.qopen_allow_qnext)
$("#queue_next").attr("disabled", false); $("#queue_next").attr("disabled", false);
else else
@ -659,21 +665,26 @@ function handleRankChange() {
$(this).find(".btn-danger").remove(); $(this).find(".btn-danger").remove();
}); });
} }
if(RANK < Rank.Moderator) {
$("#getplaylist").css("width", "100%"); $("#getplaylist").css("width", "100%");
$("#clearplaylist").css("display", "none"); $("#clearplaylist").css("display", "none");
$("#shuffleplaylist").css("display", "none"); $("#shuffleplaylist").css("display", "none");
} }
if(RANK >= Rank.Owner) { if(RANK >= Rank.Moderator || LEADER) {
$("#show_jseditor").parent().css("display", ""); $("#playlist_controls").css("display", "block");
$("#show_csseditor").parent().css("display", ""); $("#playlist_controls button").each(function() {
$(this).attr("disabled", false);
});
$("#pollcontainer .active").each(function() {
var btns = $(this).find(".btn-danger");
if(btns.length == 0) {
$("<button/>").addClass("btn btn-danger pull-right")
.text("End Poll")
.insertAfter($(this).find(".close"))
.click(function() {
socket.emit("closePoll")
});
} }
else { });
$("#show_jseditor").parent().css("display", "none");
$("#show_csseditor").parent().css("display", "none");
}
if(RANK >= 10) {
$("#drop_channel").parent().css("display", "");
} }
} }

View file

@ -160,6 +160,14 @@
<fieldset> <fieldset>
<div class="span5"> <div class="span5">
<label>When the queue is open:</label> <label>When the queue is open:</label>
<label class="checkbox">
<input type="checkbox" id="opt_qopen_allow_anon">
Allow anonymous users to add videos
</label>
<label class="checkbox">
<input type="checkbox" id="opt_qopen_allow_guest">
Allow guest users to add videos
</label>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" id="opt_qopen_allow_qnext"> <input type="checkbox" id="opt_qopen_allow_qnext">
Allow anyone to Queue Next Allow anyone to Queue Next