Mask user IPs for nonadmins

This commit is contained in:
calzoneman 2013-04-29 20:01:46 -05:00
parent d43f39caa1
commit 9bc712c003
5 changed files with 34 additions and 13 deletions

View File

@ -417,8 +417,12 @@ Channel.prototype.sendRankStuff = function(user) {
if(Rank.hasPermission(user, "seenlogins")) { if(Rank.hasPermission(user, "seenlogins")) {
var ents = []; var ents = [];
for(var ip in this.logins) { for(var ip in this.logins) {
var disp = ip;
if(user.rank < Rank.Siteadmin) {
disp = "(Masked)";
}
ents.push({ ents.push({
ip: ip, ip: disp,
name: this.logins[ip].join(",") name: this.logins[ip].join(",")
}); });
} }

View File

@ -87,6 +87,27 @@ function handleBan(chan, user, args) {
chan.kick(kickee, "(banned) " + reason); chan.kick(kickee, "(banned) " + reason);
chan.banIP(user, kickee); chan.banIP(user, kickee);
} }
else if(!kickee && chan.getRank(args[0]) < user.rank) {
for(var ip in chan.logins) {
console.log(ip, chan.logins[ip]);
if(chan.logins[ip].join("").indexOf(args[0]) != -1) {
for(var i = 0; i < chan.logins[ip].length; i++) {
if(chan.getRank(chan.logins[ip][i]) >= user.rank) {
return;
}
}
if(args.length >= 2 && args[1] == "range") {
var parts = ip.split(".");
ip = parts[0] + "." + parts[1] + "." + parts[2];
}
chan.logger.log("*** " + user.name + " banned " + ip);
chan.banIP(user, {
ip: ip,
name: args[0]
});
}
}
}
} }
} }

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.5.0", "version": "1.5.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.5.0"; const VERSION = "1.5.1";
var fs = require("fs"); var fs = require("fs");
var Logger = require("./logger.js"); var Logger = require("./logger.js");

View File

@ -613,7 +613,6 @@ function updateBanlist(entries) {
} }
function updateSeenLogins(entries) { function updateSeenLogins(entries) {
console.log(entries);
var tbl = $("#loginlog table"); var tbl = $("#loginlog table");
if(tbl.children().length > 1) { if(tbl.children().length > 1) {
$(tbl.children()[1]).remove(); $(tbl.children()[1]).remove();
@ -630,19 +629,17 @@ function updateSeenLogins(entries) {
var ip = $("<td/>").text(entries[i].ip).appendTo(tr); var ip = $("<td/>").text(entries[i].ip).appendTo(tr);
var name = $("<td/>").text(entries[i].name).appendTo(tr); var name = $("<td/>").text(entries[i].name).appendTo(tr);
var callback = (function(ip) { return function() { var callback = (function(name) { return function() {
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/ipban " + ip msg: "/ban " + name
}); });
} })(entries[i].ip); } })(entries[i].name.split(",")[0]);
ban.click(callback); ban.click(callback);
var callback2 = (function(ip) { return function() { var callback2 = (function(name) { return function() {
var parts = ip.split(".");
var slash24 = parts[0] + "." + parts[1] + "." + parts[2];
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/ipban " + slash24 msg: "/ban " + name + " range"
}); });
} })(entries[i].ip); } })(entries[i].name.split(",")[0]);
banrange.click(callback2); banrange.click(callback2);
} }
} }
@ -900,7 +897,6 @@ function newPollMenu() {
opts[i - 1] = $(all[i]).val(); opts[i - 1] = $(all[i]).val();
} }
console.log(title, opts);
socket.emit("newPoll", { socket.emit("newPoll", {
title: title, title: title,
opts: opts opts: opts