Add permission option for livestreams

This commit is contained in:
Calvin Montgomery 2013-06-04 22:51:41 -04:00
parent 8c6d2ccfb2
commit 33f4ffcec2
3 changed files with 12 additions and 3 deletions

View File

@ -55,7 +55,7 @@ var Channel = function(name) {
playlistdelete: 2,
playlistjump: 1.5,
playlistaddlist: 1.5,
playlistadd: 1.5,
playlistaddlive: 1.5,
addnontemp: 2,
settemp: 2,
playlistgeturl: 1.5,
@ -985,6 +985,11 @@ Channel.prototype.autoTemp = function(media, user) {
Channel.prototype.enqueue = function(data, user) {
var idx = data.pos == "next" ? this.position + 1 : this.queue.length;
if(isLive(data.type) && !this.hasPermission(user, "playlistaddlive")) {
user.socket.emit("queueFail", "You don't have permission to queue livestreams");
return;
}
// Prefer cache over looking up new data
if(data.id in this.library) {
var media = this.library[data.id].dup();

View File

@ -581,8 +581,11 @@ Callbacks = {
$(li).show("blind");
},
queueFail: function() {
makeAlert("Error", "Queue failed. Check your link to make sure it is valid.", "alert-error")
queueFail: function(data) {
if(!data) {
data = "Queue failed. Check your link to make sure it is valid.";
}
makeAlert("Error", data, "alert-error")
.insertAfter($("#playlist_controls"));
},

View File

@ -1314,6 +1314,7 @@ function genPermissionsEditor() {
makeOption("Delete playlist items", "playlistdelete", standard, CHANPERMS.playlistdelete+"");
makeOption("Jump to video", "playlistjump", standard, CHANPERMS.playlistjump+"");
makeOption("Queue playlist", "playlistaddlist", standard, CHANPERMS.playlistaddlist+"");
makeOption("Queue livestream", "playlistaddlive", standard, CHANPERMS.playlistaddlive+"");
makeOption("Add nontemporary media", "addnontemp", standard, CHANPERMS.addnontemp+"");
makeOption("Temp/untemp playlist item", "settemp", standard, CHANPERMS.settemp+"");
makeOption("Retrieve playlist URLs", "playlistgeturl", standard, CHANPERMS.playlistgeturl+"");