Redo channel logs
This commit is contained in:
parent
87b40b679a
commit
3bebc34e21
|
@ -63,7 +63,6 @@ function Channel(name) {
|
||||||
exceedmaxlength: 2, // Add a video longer than the maximum length set
|
exceedmaxlength: 2, // Add a video longer than the maximum length set
|
||||||
addnontemp: 2, // Add a permanent video to the playlist
|
addnontemp: 2, // Add a permanent video to the playlist
|
||||||
settemp: 2, // Toggle temporary status of a playlist item
|
settemp: 2, // Toggle temporary status of a playlist item
|
||||||
playlistgeturl: 1.5, // TODO is this even used?
|
|
||||||
playlistshuffle: 2, // Shuffle the playlist
|
playlistshuffle: 2, // Shuffle the playlist
|
||||||
playlistclear: 2, // Clear the playlist
|
playlistclear: 2, // Clear the playlist
|
||||||
pollctl: 1.5, // Open/close polls
|
pollctl: 1.5, // Open/close polls
|
||||||
|
@ -224,7 +223,7 @@ Channel.prototype.loadState = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
self.logger.log("*** Loading channel state");
|
self.logger.log("[init] Loading channel state from disk");
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|
||||||
// Load the playlist
|
// Load the playlist
|
||||||
|
@ -305,6 +304,8 @@ Channel.prototype.saveState = function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.logger.log("[init] Saving channel state to disk");
|
||||||
|
|
||||||
var filters = self.filters.map(function (f) {
|
var filters = self.filters.map(function (f) {
|
||||||
return f.pack();
|
return f.pack();
|
||||||
});
|
});
|
||||||
|
@ -562,7 +563,7 @@ Channel.prototype.join = function (user) {
|
||||||
self.sendMotd([user]);
|
self.sendMotd([user]);
|
||||||
self.sendDrinkCount([user]);
|
self.sendDrinkCount([user]);
|
||||||
|
|
||||||
self.logger.log("+++ " + user.ip + " joined");
|
self.logger.log("[login] " + user.ip + " joined");
|
||||||
Logger.syslog.log(user.ip + " joined channel " + self.name);
|
Logger.syslog.log(user.ip + " joined channel " + self.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -620,7 +621,7 @@ Channel.prototype.part = function (user) {
|
||||||
self.sendUserLeave(self.users, user);
|
self.sendUserLeave(self.users, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.logger.log("--- " + user.ip + " (" + user.name + ") left");
|
self.logger.log("[login] " + user.ip + " (" + user.name + ") left");
|
||||||
if (self.users.length === 0) {
|
if (self.users.length === 0) {
|
||||||
self.emit("empty");
|
self.emit("empty");
|
||||||
return;
|
return;
|
||||||
|
@ -733,7 +734,7 @@ Channel.prototype.handleNameBan = function (actor, name, reason) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.logger.log("*** " + actor.name + " namebanned " + name);
|
self.logger.log("[mod] " + actor.name + " namebanned " + name);
|
||||||
self.sendModMessage(actor.name + " banned " + name, self.permissions.ban);
|
self.sendModMessage(actor.name + " banned " + name, self.permissions.ban);
|
||||||
|
|
||||||
db.channels.isNameBanned(self.name, name, function (err, banned) {
|
db.channels.isNameBanned(self.name, name, function (err, banned) {
|
||||||
|
@ -799,7 +800,7 @@ Channel.prototype.sendUnban = function (users, data) {
|
||||||
u.socket.emit("banlistRemove", data);
|
u.socket.emit("banlistRemove", data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.logger.log("*** " + data.actor + " unbanned " + data.name);
|
self.logger.log("[mod] " + data.actor + " unbanned " + data.name);
|
||||||
self.sendModMessage(data.actor + " unbanned " + data.name, self.permissions.ban);
|
self.sendModMessage(data.actor + " unbanned " + data.name, self.permissions.ban);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -882,7 +883,7 @@ Channel.prototype.banIP = function (actor, ip, name, reason, range) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.logger.log("*** " + actor.name + " banned " + ip + " (" + name + ")");
|
self.logger.log("[mod] " + actor.name + " banned " + ip + " (" + name + ")");
|
||||||
self.sendModMessage(actor.name + " banned " + ip + " (" + name + ")", self.permissions.ban);
|
self.sendModMessage(actor.name + " banned " + ip + " (" + name + ")", self.permissions.ban);
|
||||||
// If in the channel already, kick the banned user
|
// If in the channel already, kick the banned user
|
||||||
for (var i = 0; i < self.users.length; i++) {
|
for (var i = 0; i < self.users.length; i++) {
|
||||||
|
@ -1602,7 +1603,8 @@ Channel.prototype.addMedia = function (data, callback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.logger.log("### " + data.queueby + " queued " + media.title);
|
self.logger.log("[playlist] " + data.queueby + " queued " + media.title + " (" +
|
||||||
|
media.type + ":" + media.id + ")");
|
||||||
|
|
||||||
var item = res.item;
|
var item = res.item;
|
||||||
var packet = {
|
var packet = {
|
||||||
|
@ -1772,6 +1774,7 @@ Channel.prototype.handleQueuePlaylist = function (user, data) {
|
||||||
for (var i = 0; i < pl.length; i++) {
|
for (var i = 0; i < pl.length; i++) {
|
||||||
pl[i].pos = pos;
|
pl[i].pos = pos;
|
||||||
pl[i].temp = temp;
|
pl[i].temp = temp;
|
||||||
|
pl[i].queueby = user.name;
|
||||||
self.addMedia(pl[i], function (err, media) {
|
self.addMedia(pl[i], function (err, media) {
|
||||||
if (err) {
|
if (err) {
|
||||||
user.socket.emit("queueFail", {
|
user.socket.emit("queueFail", {
|
||||||
|
@ -1811,7 +1814,7 @@ Channel.prototype.handleDelete = function (user, data) {
|
||||||
|
|
||||||
self.deleteMedia(data, function (err) {
|
self.deleteMedia(data, function (err) {
|
||||||
if (!err && plitem && plitem.media) {
|
if (!err && plitem && plitem.media) {
|
||||||
self.logger.log("### " + user.name + " deleted " + plitem.media.title);
|
self.logger.log("[playlist] " + user.name + " deleted " + plitem.media.title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1929,7 +1932,7 @@ Channel.prototype.handleMove = function (user, data) {
|
||||||
var afterit = self.playlist.items.find(data.after);
|
var afterit = self.playlist.items.find(data.after);
|
||||||
var aftertitle = (afterit && afterit.media) ? afterit.media.title : "";
|
var aftertitle = (afterit && afterit.media) ? afterit.media.title : "";
|
||||||
if (fromit) {
|
if (fromit) {
|
||||||
self.logger.log("### " + user.name + " moved " + fromit.media.title +
|
self.logger.log("[playlist] " + user.name + " moved " + fromit.media.title +
|
||||||
(aftertitle ? " after " + aftertitle : ""));
|
(aftertitle ? " after " + aftertitle : ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1962,7 +1965,7 @@ Channel.prototype.handleUncache = function (user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.logger.log("*** " + user.name + " deleted " + data.id + " from library");
|
self.logger.log("[library] " + user.name + " deleted " + data.id + " from library");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1974,7 +1977,11 @@ Channel.prototype.handlePlayNext = function (user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("### " + user.name + " skipped the video");
|
var title = "";
|
||||||
|
if (this.playlist.current && this.playlist.current.title) {
|
||||||
|
title = " " + this.playlist.current.title;
|
||||||
|
}
|
||||||
|
this.logger.log("[playlist] " + user.name + " skipped" + title);
|
||||||
this.playlist.next();
|
this.playlist.next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1990,7 +1997,12 @@ Channel.prototype.handleJumpTo = function (user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("### " + user.name + " skipped the video");
|
var to = this.playlist.items.find(data);
|
||||||
|
var title = "";
|
||||||
|
if (to != null) {
|
||||||
|
title = " to " + to.media.title;
|
||||||
|
}
|
||||||
|
this.logger.log("[playlist] " + user.name + " skipped" + title);
|
||||||
this.playlist.jump(data);
|
this.playlist.jump(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2012,7 +2024,7 @@ Channel.prototype.handleClear = function (user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("### " + user.name + " cleared the playlist");
|
this.logger.log("[playlist] " + user.name + " cleared the playlist");
|
||||||
this.clear();
|
this.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2045,7 +2057,7 @@ Channel.prototype.handleShuffle = function (user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("### " + user.name + " shuffle the playlist");
|
this.logger.log("[playlist] " + user.name + " shuffle the playlist");
|
||||||
this.shuffle();
|
this.shuffle();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2102,7 +2114,7 @@ Channel.prototype.handleOpenPoll = function (user, data) {
|
||||||
var poll = new Poll(user.name, title, opts, obscured);
|
var poll = new Poll(user.name, title, opts, obscured);
|
||||||
this.poll = poll;
|
this.poll = poll;
|
||||||
this.sendPoll(this.users, true);
|
this.sendPoll(this.users, true);
|
||||||
this.logger.log("*** " + user.name + " Opened Poll: '" + poll.title + "'");
|
this.logger.log("[poll] " + user.name + " Opened Poll: '" + poll.title + "'");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2119,7 +2131,7 @@ Channel.prototype.handleClosePoll = function (user) {
|
||||||
this.sendPollUpdate(this.users);
|
this.sendPollUpdate(this.users);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("*** " + user.name + " closed the active poll");
|
this.logger.log("[poll] " + user.name + " closed the active poll");
|
||||||
this.poll = false;
|
this.poll = false;
|
||||||
this.sendAll("closePoll");
|
this.sendAll("closePoll");
|
||||||
}
|
}
|
||||||
|
@ -2161,7 +2173,14 @@ Channel.prototype.handleVoteskip = function (user) {
|
||||||
this.voteskip = new Poll("voteskip", "voteskip", ["yes"]);
|
this.voteskip = new Poll("voteskip", "voteskip", ["yes"]);
|
||||||
}
|
}
|
||||||
this.voteskip.vote(user.ip, 0);
|
this.voteskip.vote(user.ip, 0);
|
||||||
this.logger.log("### " + (user.name ? user.name : "anonymous") + " voteskipped");
|
|
||||||
|
var title = "";
|
||||||
|
if (this.playlist.current && this.playlist.current.title) {
|
||||||
|
title = " " + this.playlist.current.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.log("[playlist] " + (user.name ? user.name : "anonymous") +
|
||||||
|
" voteskipped" + title);
|
||||||
this.checkVoteskipPass();
|
this.checkVoteskipPass();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2184,7 +2203,12 @@ Channel.prototype.checkVoteskipPass = function () {
|
||||||
var max = this.calcVoteskipMax();
|
var max = this.calcVoteskipMax();
|
||||||
var need = Math.ceil(max * this.opts.voteskip_ratio);
|
var need = Math.ceil(max * this.opts.voteskip_ratio);
|
||||||
if (this.voteskip.counts[0] >= need) {
|
if (this.voteskip.counts[0] >= need) {
|
||||||
this.logger.log("### Voteskip passed, skipping to next video");
|
var title = "";
|
||||||
|
if (this.playlist.current && this.playlist.current.title) {
|
||||||
|
title = " " + this.playlist.current.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.log("[playlist] Voteskip passed, skipping" + title);
|
||||||
this.playlist.next();
|
this.playlist.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2210,7 +2234,7 @@ Channel.prototype.handleSetLock = function (user, data) {
|
||||||
|
|
||||||
|
|
||||||
data.locked = Boolean(data.locked);
|
data.locked = Boolean(data.locked);
|
||||||
this.logger.log("*** " + user.name + " set playlist lock to " + data.locked);
|
this.logger.log("[playlist] " + user.name + " set playlist lock to " + data.locked);
|
||||||
this.setLock(data.locked);
|
this.setLock(data.locked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2320,7 +2344,9 @@ Channel.prototype.handleUpdateFilter = function (user, f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("%%% " + user.name + " updated filter: " + f.name);
|
this.logger.log("[mod] " + user.name + " updated filter: " + f.name + " -> " +
|
||||||
|
"s/" + f.source + "/" + f.replace + "/" + f.flags + " active: " +
|
||||||
|
f.active);
|
||||||
this.updateFilter(filter);
|
this.updateFilter(filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2356,7 +2382,7 @@ Channel.prototype.handleRemoveFilter = function (user, f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("%%% " + user.name + " removed filter: " + f.name);
|
this.logger.log("[mod] " + user.name + " removed filter: " + f.name);
|
||||||
this.removeFilter(f);
|
this.removeFilter(f);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2408,7 +2434,7 @@ Channel.prototype.handleSetPermissions = function (user, perms) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("%%% " + user.name + " updated permissions");
|
this.logger.log("[mod] " + user.name + " updated permissions");
|
||||||
this.sendAll("setPermissions", this.permissions);
|
this.sendAll("setPermissions", this.permissions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2520,7 +2546,7 @@ Channel.prototype.handleUpdateOptions = function (user, data) {
|
||||||
this.opts.password = pw;
|
this.opts.password = pw;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.log("%%% " + user.name + " updated channel options");
|
this.logger.log("[mod] " + user.name + " updated channel options");
|
||||||
this.sendOpts(this.users);
|
this.sendOpts(this.users);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2541,7 +2567,7 @@ Channel.prototype.handleSetCSS = function (user, data) {
|
||||||
this.css = css;
|
this.css = css;
|
||||||
this.sendCSSJS(this.users);
|
this.sendCSSJS(this.users);
|
||||||
|
|
||||||
this.logger.log("%%% " + user.name + " updated the channel CSS");
|
this.logger.log("[mod] " + user.name + " updated the channel CSS");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2561,7 +2587,7 @@ Channel.prototype.handleSetJS = function (user, data) {
|
||||||
this.js = js;
|
this.js = js;
|
||||||
this.sendCSSJS(this.users);
|
this.sendCSSJS(this.users);
|
||||||
|
|
||||||
this.logger.log("%%% " + user.name + " updated the channel JS");
|
this.logger.log("[mod] " + user.name + " updated the channel JS");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2592,7 +2618,7 @@ Channel.prototype.handleSetMotd = function (user, data) {
|
||||||
var motd = data.motd.substring(0, 20000);
|
var motd = data.motd.substring(0, 20000);
|
||||||
|
|
||||||
this.setMotd(motd);
|
this.setMotd(motd);
|
||||||
this.logger.log("%%% " + user.name + " updated the MOTD");
|
this.logger.log("[mod] " + user.name + " updated the MOTD");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2785,7 +2811,7 @@ Channel.prototype.handleSetRank = function (user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.logger.log("*** " + user.name + " set " + name + "'s rank to " + rank);
|
self.logger.log("[mod] " + user.name + " set " + name + "'s rank to " + rank);
|
||||||
self.sendAll("setUserRank", {
|
self.sendAll("setUserRank", {
|
||||||
name: name,
|
name: name,
|
||||||
rank: rank
|
rank: rank
|
||||||
|
@ -2826,7 +2852,7 @@ Channel.prototype.changeLeader = function (name) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
this.sendAll("setLeader", "");
|
this.sendAll("setLeader", "");
|
||||||
this.logger.log("*** Resuming autolead");
|
this.logger.log("[playlist] Resuming autolead");
|
||||||
this.playlist.lead(true);
|
this.playlist.lead(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2834,7 +2860,7 @@ Channel.prototype.changeLeader = function (name) {
|
||||||
for (var i = 0; i < this.users.length; i++) {
|
for (var i = 0; i < this.users.length; i++) {
|
||||||
if (this.users[i].name === name) {
|
if (this.users[i].name === name) {
|
||||||
this.sendAll("setLeader", name);
|
this.sendAll("setLeader", name);
|
||||||
this.logger.log("*** Assigned leader: " + name);
|
this.logger.log("[playlist] Assigned leader: " + name);
|
||||||
this.playlist.lead(false);
|
this.playlist.lead(false);
|
||||||
this.leader = this.users[i];
|
this.leader = this.users[i];
|
||||||
if (this.users[i].rank < 1.5) {
|
if (this.users[i].rank < 1.5) {
|
||||||
|
@ -2865,7 +2891,7 @@ Channel.prototype.handleChangeLeader = function (user, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.changeLeader(data.name);
|
this.changeLeader(data.name);
|
||||||
this.logger.log("### " + user.name + " assigned leader to " + data.name);
|
this.logger.log("[mod] " + user.name + " assigned leader to " + data.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -201,7 +201,7 @@ function handleShadowMute(chan, user, args) {
|
||||||
person.meta.smuted = person.meta.muted = true;
|
person.meta.smuted = person.meta.muted = true;
|
||||||
chan.sendUserMeta(chan.users, person, 2);
|
chan.sendUserMeta(chan.users, person, 2);
|
||||||
chan.mutedUsers.add("[shadow]" + person.name.toLowerCase());
|
chan.mutedUsers.add("[shadow]" + person.name.toLowerCase());
|
||||||
chan.logger.log("*** " + user.name + " shadow muted " + args[0]);
|
chan.logger.log("[mod] " + user.name + " shadow muted " + args[0]);
|
||||||
chan.sendModMessage(user.name + " shadow muted " + args[0], 2);
|
chan.sendModMessage(user.name + " shadow muted " + args[0], 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ function handleMute(chan, user, args) {
|
||||||
person.meta.muted = true;
|
person.meta.muted = true;
|
||||||
chan.sendUserMeta(chan.users, person);
|
chan.sendUserMeta(chan.users, person);
|
||||||
chan.mutedUsers.add(person.name.toLowerCase());
|
chan.mutedUsers.add(person.name.toLowerCase());
|
||||||
chan.logger.log("*** " + user.name + " muted " + args[0]);
|
chan.logger.log("[mod] " + user.name + " muted " + args[0]);
|
||||||
chan.sendModMessage(user.name + " muted " + args[0], 2);
|
chan.sendModMessage(user.name + " muted " + args[0], 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ function handleUnmute(chan, user, args) {
|
||||||
chan.sendUserMeta(chan.users, person, wasSmuted ? 2 : false);
|
chan.sendUserMeta(chan.users, person, wasSmuted ? 2 : false);
|
||||||
chan.mutedUsers.remove(person.name.toLowerCase());
|
chan.mutedUsers.remove(person.name.toLowerCase());
|
||||||
chan.mutedUsers.remove("[shadow]" + person.name.toLowerCase());
|
chan.mutedUsers.remove("[shadow]" + person.name.toLowerCase());
|
||||||
chan.logger.log("*** " + user.name + " unmuted " + args[0]);
|
chan.logger.log("[mod] " + user.name + " unmuted " + args[0]);
|
||||||
chan.sendModMessage(user.name + " unmuted " + args[0], 2);
|
chan.sendModMessage(user.name + " unmuted " + args[0], 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ function handleKick(chan, user, args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (kickee) {
|
if (kickee) {
|
||||||
chan.logger.log("*** " + user.name + " kicked " + args[0]);
|
chan.logger.log("[mod] " + user.name + " kicked " + args[0]);
|
||||||
args[0] = "";
|
args[0] = "";
|
||||||
var reason = args.join(" ");
|
var reason = args.join(" ");
|
||||||
kickee.kick(reason);
|
kickee.kick(reason);
|
||||||
|
@ -319,7 +319,7 @@ function handleBan(chan, user, args) {
|
||||||
|
|
||||||
function handleUnban(chan, user, args) {
|
function handleUnban(chan, user, args) {
|
||||||
if (chan.hasPermission(user, "ban") && args.length > 0) {
|
if (chan.hasPermission(user, "ban") && args.length > 0) {
|
||||||
chan.logger.log("*** " + user.name + " unbanned " + args[0]);
|
chan.logger.log("[mod] " + user.name + " unbanned " + args[0]);
|
||||||
if (args[0].match(/(\d+)\.(\d+)\.(\d+)\.(\d+)/)) {
|
if (args[0].match(/(\d+)\.(\d+)\.(\d+)\.(\d+)/)) {
|
||||||
chan.unbanIP(user, args[0]);
|
chan.unbanIP(user, args[0]);
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ function handlePoll(chan, user, msg, hidden) {
|
||||||
var poll = new Poll(user.name, title, args, hidden === true);
|
var poll = new Poll(user.name, title, args, hidden === true);
|
||||||
chan.poll = poll;
|
chan.poll = poll;
|
||||||
chan.sendPoll(chan.users);
|
chan.sendPoll(chan.users);
|
||||||
chan.logger.log("*** " + user.name + " Opened Poll: '" + poll.title + "'");
|
chan.logger.log("[poll] " + user.name + " Opened Poll: '" + poll.title + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ module.exports = {
|
||||||
chan.name = res[0].name;
|
chan.name = res[0].name;
|
||||||
chan.canonical_name = chan.name.toLowerCase();
|
chan.canonical_name = chan.name.toLowerCase();
|
||||||
chan.registered = true;
|
chan.registered = true;
|
||||||
chan.logger.log("*** Loaded channel from database");
|
chan.logger.log("[init] Loaded channel from database");
|
||||||
callback(null, true);
|
callback(null, true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -75,6 +75,8 @@ function Playlist(chan) {
|
||||||
chan.resetVideo();
|
chan.resetVideo();
|
||||||
chan.sendAll("setCurrent", pl.current.uid);
|
chan.sendAll("setCurrent", pl.current.uid);
|
||||||
chan.sendAll("changeMedia", m.fullupdate());
|
chan.sendAll("changeMedia", m.fullupdate());
|
||||||
|
chan.logger.log("[playlist] Now playing: " + m.title + " (" + m.type + ":" + m.id +
|
||||||
|
")");
|
||||||
});
|
});
|
||||||
this.on("remove", function(item) {
|
this.on("remove", function(item) {
|
||||||
if (chan.dead) {
|
if (chan.dead) {
|
||||||
|
|
|
@ -138,30 +138,9 @@ mixin chanlog
|
||||||
#cs-chanlog.tab-pane
|
#cs-chanlog.tab-pane
|
||||||
h4 Channel Log
|
h4 Channel Log
|
||||||
strong Filter Log:
|
strong Filter Log:
|
||||||
form(role="form", action="javscript:void(0)")
|
select#cs-chanlog-filter.form-control(multiple="multiple")
|
||||||
.checkbox
|
pre#cs-chanlog-text
|
||||||
label Everything
|
button.btn.btn-default#cs-chanlog-refresh Refresh
|
||||||
input#filter_all(type="checkbox", checked="checked")
|
|
||||||
.checkbox
|
|
||||||
label Chat
|
|
||||||
input#filter_chat(type="checkbox")
|
|
||||||
.checkbox
|
|
||||||
label Polls
|
|
||||||
input#filter_polls(type="checkbox")
|
|
||||||
.checkbox
|
|
||||||
label Playlist actions
|
|
||||||
input#filter_queue(type="checkbox")
|
|
||||||
.checkbox
|
|
||||||
label Bans
|
|
||||||
input#filter_bans(type="checkbox")
|
|
||||||
.checkbox
|
|
||||||
label Channel settings
|
|
||||||
input#filter_channelsettings(type="checkbox")
|
|
||||||
.checkbox
|
|
||||||
label Join/Quit messages
|
|
||||||
input#filter_joinquit(type="checkbox")
|
|
||||||
pre#chanlog_contents(style="max-height: 400px; overflow-y: scroll")
|
|
||||||
button.btn.btn-default#chanlog_refresh Refresh
|
|
||||||
|
|
||||||
mixin permeditor
|
mixin permeditor
|
||||||
#cs-permedit.tab-pane
|
#cs-permedit.tab-pane
|
||||||
|
|
|
@ -364,18 +364,16 @@ Callbacks = {
|
||||||
},
|
},
|
||||||
|
|
||||||
readChanLog: function (data) {
|
readChanLog: function (data) {
|
||||||
var log = $("#chanlog_contents");
|
var log = $("#cs-chanlog-text");
|
||||||
if (log.length == 0)
|
if (log.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
log.data("log", data.data);
|
setupChanlogFilter(data.data);
|
||||||
log.text(data.data);
|
|
||||||
filterChannelLog();
|
filterChannelLog();
|
||||||
} else {
|
} else {
|
||||||
log.text("Error reading channel log");
|
$("#cs-chanlog-text").text("Error reading channel log");
|
||||||
}
|
}
|
||||||
log.scrollTop(log.prop("scrollHeight"));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
voteskip: function(data) {
|
voteskip: function(data) {
|
||||||
|
|
|
@ -530,18 +530,11 @@ $(".cs-textbox").keyup(function () {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#chanlog_refresh").click(function () {
|
$("#cs-chanlog-refresh").click(function () {
|
||||||
socket.emit("readChanLog");
|
socket.emit("readChanLog");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#cs-chanlog input[type='checkbox']").change(function () {
|
$("#cs-chanlog-filter").change(filterChannelLog);
|
||||||
var id = $(this).attr("id");
|
|
||||||
if (id !== "filter_all" && $(this).prop("checked")) {
|
|
||||||
$("#filter_all").prop("checked", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
filterChannelLog();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#cs-motdsubmit").click(function () {
|
$("#cs-motdsubmit").click(function () {
|
||||||
socket.emit("setMotd", {
|
socket.emit("setMotd", {
|
||||||
|
|
|
@ -1755,87 +1755,63 @@ function queueMessage(data, type) {
|
||||||
.appendTo($("#queuefail"));
|
.appendTo($("#queuefail"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupChanlogFilter(data) {
|
||||||
|
var getKey = function (ln) {
|
||||||
|
var left = ln.indexOf("[", 1);
|
||||||
|
var right = ln.indexOf("]", left);
|
||||||
|
if (left === -1 || right === -1) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
return ln.substring(left+1, right);
|
||||||
|
};
|
||||||
|
|
||||||
|
data = data.split("\n").filter(function (ln) {
|
||||||
|
return ln.indexOf("[") === 0 && ln.indexOf("]") > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
var log = $("#cs-chanlog-text");
|
||||||
|
var select = $("#cs-chanlog-filter");
|
||||||
|
select.html("");
|
||||||
|
log.data("lines", data);
|
||||||
|
|
||||||
|
var keys = {};
|
||||||
|
data.forEach(function (ln) {
|
||||||
|
keys[getKey(ln)] = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.keys(keys).forEach(function (key) {
|
||||||
|
$("<option/>").attr("value", key).text(key).appendTo(select);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function filterChannelLog() {
|
function filterChannelLog() {
|
||||||
var cc = $("#chanlog_contents");
|
var log = $("#cs-chanlog-text");
|
||||||
if (!cc.data("log")) {
|
var filter = $("#cs-chanlog-filter").val();
|
||||||
cc.data("log", cc.text());
|
var getKey = function (ln) {
|
||||||
}
|
var left = ln.indexOf("[", 1);
|
||||||
var all = $("#filter_all").prop("checked");
|
var right = ln.indexOf("]", left);
|
||||||
var chat = $("#filter_chat").prop("checked");
|
return ln.substring(left+1, right);
|
||||||
var polls = $("#filter_polls").prop("checked");
|
};
|
||||||
var queue = $("#filter_queue").prop("checked");
|
|
||||||
var bans = $("#filter_bans").prop("checked");
|
|
||||||
var channelsettings = $("#filter_channelsettings").prop("checked");
|
|
||||||
var joinquit = $("#filter_joinquit").prop("checked");
|
|
||||||
|
|
||||||
var lines = cc.data("log").split("\n");
|
var getTimestamp = function (ln) {
|
||||||
var include = [];
|
var right = ln.indexOf("]");
|
||||||
lines.forEach(function (line) {
|
return ln.substring(1, right);
|
||||||
if (line.trim() === "") {
|
};
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (all) {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pre = line.split(" ")[5];
|
var getMessage = function (ln) {
|
||||||
if (pre === undefined) {
|
var right = ln.indexOf("]");
|
||||||
return;
|
return ln.substring(right + 2);
|
||||||
}
|
};
|
||||||
|
|
||||||
if (chat && pre.match(/<[\w-]+(\.\w*)?>/)) {
|
var show = [];
|
||||||
include.push(line);
|
(log.data("lines")||[]).forEach(function (ln) {
|
||||||
return;
|
if (!filter || filter.indexOf(getKey(ln)) >= 0) {
|
||||||
}
|
show.push(ln);
|
||||||
|
|
||||||
if (polls && pre === "***" && (line.indexOf("Opened Poll") >= 0 ||
|
|
||||||
line.indexOf("closed the active poll") >= 0)) {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queue && pre === "###") {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channelsettings && pre === "%%%") {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (joinquit) {
|
|
||||||
if (pre === "+++" || pre === "---") {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pre.match(/(\d{1,3}\.){3}\d{1,3}/) &&
|
|
||||||
line.indexOf("logged in as") >= 0) {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bans && pre === "***" && line.indexOf("banned") >= 0) {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channelsettings && pre === "***") {
|
|
||||||
if (line.indexOf("Loading") >= 0 ||
|
|
||||||
line.indexOf("Loaded") >= 0 ||
|
|
||||||
line.indexOf("unloading") >= 0 ||
|
|
||||||
line.indexOf("rank") >= 0) {
|
|
||||||
include.push(line);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#chanlog_contents").text(include.join("\n"));
|
log.text(show.join("\n"));
|
||||||
|
log.scrollTop(log.prop("scrollHeight"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeModal() {
|
function makeModal() {
|
||||||
|
|
|
@ -469,3 +469,17 @@ li.ui-sortable-helper, li.ui-sortable-placeholder + li.queue_entry {
|
||||||
.pagination {
|
.pagination {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#cs-chanlog-filter {
|
||||||
|
border-bottom: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cs-chanlog-text {
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
font-size: 8pt;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue