diff --git a/channel.js b/channel.js index edbf163e..11e69f95 100644 --- a/channel.js +++ b/channel.js @@ -1161,6 +1161,7 @@ Channel.prototype.addMedia = function(data, user) { return; } data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp"); + data.queueby = user ? user.name : ""; data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength; var chan = this; if(data.id in this.library) { @@ -1195,9 +1196,6 @@ Channel.prototype.addMedia = function(data, user) { return; } - data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp"); - data.queueby = user ? user.name : ""; - this.playlist.addMedia(data, function(err, item) { if(err) { if(err === true) @@ -1213,7 +1211,8 @@ Channel.prototype.addMedia = function(data, user) { after: item.prev ? item.prev.uid : "prepend" }); chan.broadcastPlaylistMeta(); - chan.cacheMedia(item.media); + if(!item.temp) + chan.cacheMedia(item.media); } }); } @@ -1237,7 +1236,8 @@ Channel.prototype.addMediaList = function(data, user) { after: item.prev ? item.prev.uid : "prepend" }); chan.broadcastPlaylistMeta(); - chan.cacheMedia(item.media); + if(!item.temp) + chan.cacheMedia(item.media); } }); } diff --git a/package.json b/package.json index de6aca5a..42902bea 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "2.3.0", + "version": "2.3.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/server.js b/server.js index 3972d3dd..fa744a35 100644 --- a/server.js +++ b/server.js @@ -6,7 +6,7 @@ var Logger = require("./logger"); var Channel = require("./channel"); var User = require("./user"); -const VERSION = "2.3.0"; +const VERSION = "2.3.1"; function getIP(req) { var raw = req.connection.remoteAddress; diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 75559384..b303fd59 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -1,4 +1,5 @@ /* +return null; The MIT License (MIT) Copyright (c) 2013 Calvin Montgomery @@ -485,7 +486,7 @@ Callbacks = { setChannelRank: function(data) { var ents = $("#channelranks").data("entries"); - if(typeof ents === undefined) + if(typeof ents === "undefined") return; for(var i = 0; i < ents.length; i++) { if(ents[i].name == data.user) { @@ -621,7 +622,7 @@ Callbacks = { addUser: function(data) { var div = $("
") - .addClass("userlist_item userlist-" + data.name); + .addClass("userlist_item"); var flair = $("").appendTo(div); var nametag = $("").text(data.name).appendTo(div); formatUserlistItem(div, data); @@ -658,15 +659,19 @@ Callbacks = { } } - var user = $(".userlist-" + data.name); - formatUserlistItem(user, data); - addUserDropdown(user, data); - if(USEROPTS.sort_rank) - sortUserlist(); + var user = findUserlistItem(data.name); + if(user !== null) { + formatUserlistItem(user, data); + addUserDropdown(user, data); + if(USEROPTS.sort_rank) + sortUserlist(); + } }, setAFK: function (data) { - var user = $(".userlist-" + data.name); + var user = findUserlistItem(data.name); + if(user === null) + return; user.find(".icon-time").remove(); $(user[0].children[1]).css("font-style", ""); if(data.afk) { @@ -679,7 +684,9 @@ Callbacks = { }, userLeave: function(data) { - $(".userlist-" + data.name).remove(); + var user = findUserlistItem(data.name); + if(user !== null) + user.remove(); }, drinkCount: function(count) { diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index 614aad51..399a8c6f 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -346,7 +346,7 @@ $("#customembed_btn").click(function () { $("#getplaylist").click(function() { var callback = function(data) { - PLAYER.hide(); + hidePlayer(); socket.listeners("playlist").splice( socket.listeners("playlist").indexOf(callback) ); @@ -374,7 +374,7 @@ $("#getplaylist").click(function() { $("").addClass("modal-footer").appendTo(modal); modal.on("hidden", function() { modal.remove(); - PLAYER.unhide(); + unhidePlayer(); }); modal.modal(); } diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 91a70f55..f1d0fa36 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -58,6 +58,16 @@ function formatURL(data) { } } +function findUserlistItem(name) { + var children = $("#userlist .userlist_item"); + for(var i in children) { + var child = children[i]; + if(child.children[1].innerHTML === name) + return $(child); + } + return null; +} + function formatUserlistItem(div, data) { var name = $(div.children()[1]); name.removeClass(); @@ -152,7 +162,7 @@ function addUserDropdown(entry, data) { .appendTo(sel); } } - sel.click(function () { + sel.change(function () { socket.emit("setChannelRank", { user: name, rank: parseInt(sel.val())