diff --git a/channel.js b/channel.js index 6741b536..a2c6fe16 100644 --- a/channel.js +++ b/channel.js @@ -367,7 +367,7 @@ Channel.prototype.tryNameBan = function(actor, name) { break; } } - this.broadcastBanlist(); + //this.broadcastBanlist(); this.logger.log(name + " was banned by " + actor.name); if(!this.registered) { return false; @@ -383,7 +383,7 @@ Channel.prototype.unbanName = function(actor, name) { this.namebans[name] = null; delete this.namebans[name]; - this.broadcastBanlist(); + //this.broadcastBanlist(); this.logger.log(name + " was unbanned by " + actor.name); return Database.channelUnbanName(this.name, name); @@ -414,7 +414,7 @@ Channel.prototype.tryIPBan = function(actor, name, range) { } } chan.ipbans[ip] = [name, actor.name]; - chan.broadcastBanlist(); + //chan.broadcastBanlist(); chan.logger.log(ip + " (" + name + ") was banned by " + actor.name); for(var i = 0; i < chan.users.length; i++) { @@ -443,7 +443,7 @@ Channel.prototype.banIP = function(actor, receiver) { catch(e) { // Socket already disconnected } - this.broadcastBanlist(); + //this.broadcastBanlist(); this.logger.log(receiver.ip + " (" + receiver.name + ") was banned by " + actor.name); if(!this.registered) @@ -462,7 +462,7 @@ Channel.prototype.unbanIP = function(actor, ip) { if(!this.registered) return false; - this.broadcastBanlist(); + //this.broadcastBanlist(); // Update database ban table return Database.channelUnbanIP(this.name, ip); } @@ -637,7 +637,7 @@ Channel.prototype.sendLoginHistory = function(user) { user.socket.emit("recentLogins", this.login_hist); } -Channel.prototype.sendRankStuff = function(user) { +Channel.prototype.sendBanlist = function(user) { if(this.hasPermission(user, "ban")) { var ents = []; for(var ip in this.ipbans) { @@ -670,26 +670,10 @@ Channel.prototype.sendRankStuff = function(user) { } user.socket.emit("banlist", ents); } - // TODO get rid of this - if(Rank.hasPermission(user, "seenlogins")) { - var ents = []; - for(var ip in this.ip_alias) { - var disp = ip; - if(user.rank < Rank.Siteadmin) { - disp = "(Hidden)"; - } - var banned = (ip in this.ipbans && this.ipbans[ip] != null); - var range = ip.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, "$1.$2.$3"); - banned = banned || (range in this.ipbans && this.ipbans[range] != null); - ents.push({ - ip: disp, - id: this.hideIP(ip), - names: this.ip_alias[ip], - banned: banned - }); - } - user.socket.emit("seenlogins", {entries: ents}); - } +} + +Channel.prototype.sendRankStuff = function(user) { + this.sendBanlist(user); if(this.hasPermission(user, "filteredit")) { var filts = new Array(this.filters.length); for(var i = 0; i < this.filters.length; i++) { @@ -806,10 +790,24 @@ Channel.prototype.broadcastNewUser = function(user) { meta: user.meta, profile: user.profile }); - this.sendRankStuff(user); + //this.sendRankStuff(user); if(user.rank > Rank.Guest) { this.saveRank(user); } + + var msg = user.name + " joined (aliases: "; + msg += this.ip_alias[user.ip].join(", ") + ")"; + var pkt = { + username: "[server]", + msg: msg, + msgclass: "server-whisper", + time: Date.now() + }; + this.users.forEach(function(u) { + if(u.rank >= 2) { + u.socket.emit("chatMsg", pkt); + } + }); } Channel.prototype.broadcastUserUpdate = function(user) { diff --git a/user.js b/user.js index 22372bf9..3eeda81c 100644 --- a/user.js +++ b/user.js @@ -385,6 +385,12 @@ User.prototype.initCallbacks = function() { } }.bind(this)); + this.socket.on("requestBanlist", function() { + if(this.channel != null) { + this.channel.sendBanlist(this); + } + }.bind(this)); + this.socket.on("requestAcl", function() { if(this.channel != null) { this.channel.sendACL(this); diff --git a/www/assets/css/ytsync.css b/www/assets/css/ytsync.css index 22252ebe..beb002b6 100644 --- a/www/assets/css/ytsync.css +++ b/www/assets/css/ytsync.css @@ -185,6 +185,12 @@ html, body { color: #888888; } +.server-whisper { + font-style: italic; + color: #888888; + font-size: 8pt; +} + .spoiler { color: #000000; background-color: #000000; diff --git a/www/assets/js/channelsettings.js b/www/assets/js/channelsettings.js index 7c0f507c..77927d05 100644 --- a/www/assets/js/channelsettings.js +++ b/www/assets/js/channelsettings.js @@ -21,6 +21,9 @@ clickHandler("#show_cssedit", "#cssedit"); clickHandler("#show_jsedit", "#jsedit"); clickHandler("#show_banlist", "#banlist"); + $("#show_banlist").click(function() { + socket.emit("requestBanlist"); + }); clickHandler("#show_loginhistory", "#loginhistory"); $("#show_loginhistory").click(function() { socket.emit("requestLoginHistory"); diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 66bbda4a..3192b993 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -647,6 +647,7 @@ function handlePermissionChange() { } if(CLIENT.rank >= 2) { + $("#channelsettingswrap3").show(); if($("#channelsettingswrap").html() == "") $("#channelsettingswrap").load("channeloptions.html"); /* update channel controls */ @@ -661,11 +662,12 @@ function handlePermissionChange() { } else { $("#channelsettingswrap").html(""); + $("#channelsettingswrap3").hide(); } - setVisible("#userpltoggle", CLIENT.rank >= 1); + setVisible("#userpltogglewrap", CLIENT.rank >= 1); - setVisible("#playlisttoggle", hasPermission("playlistadd")); + setVisible("#playlisttogglewrap", hasPermission("playlistadd")); $("#queue_next").attr("disabled", !hasPermission("playlistnext")); setVisible("#qlockbtn", CLIENT.rank >= 2); @@ -937,6 +939,9 @@ function formatChatMessage(data) { if(data.msgclass == "drink" || data.msgclass == "shout") { skip = false; } + if(data.msgclass == "server-whisper") { + skip = true; + } LASTCHATNAME = data.username; LASTCHATTIME = data.time; var div = $("
"); @@ -944,6 +949,8 @@ function formatChatMessage(data) { var time = $("").addClass("timestamp").appendTo(div); var timestamp = new Date(data.time).toTimeString().split(" ")[0]; time.text("["+timestamp+"] "); + if(data.msgclass != "greentext" && data.msgclass != "drink") + time.addClass(data.msgclass); } var name = $(""); if(!skip) { diff --git a/www/channel.html b/www/channel.html index ec4d2849..a9509272 100644 --- a/www/channel.html +++ b/www/channel.html @@ -115,7 +115,7 @@
-
+

Show Playlist Manager

@@ -141,7 +141,7 @@
-
+

Show Playlist Controls