Merge branch 'master' into apirefactor
This commit is contained in:
commit
66f66505af
10
channel.js
10
channel.js
|
@ -88,7 +88,7 @@ var Channel = function(name, Server) {
|
|||
};
|
||||
this.filters = [
|
||||
new Filter("monospace", "`([^`]+)`", "g", "<code>$1</code>"),
|
||||
new Filter("bold", "(.)\\*([^\\*]+)\\*", "g", "$1<strong>$2</strong>"),
|
||||
new Filter("bold", "(^|\\s)\\*([^\\*]+)\\*", "g", "$1<strong>$2</strong>"),
|
||||
new Filter("italic", "(^| )_([^_]+)_", "g", "$1<em>$2</em>"),
|
||||
new Filter("strikethrough", "~~([^~]+)~~", "g", "<s>$1</s>"),
|
||||
new Filter("inline spoiler", "\\[spoiler\\](.*)\\[\\/spoiler\\]", "ig", "<span class=\"spoiler\">$1</span>"),
|
||||
|
@ -1144,6 +1144,7 @@ Channel.prototype.tryQueue = function(user, data) {
|
|||
}
|
||||
|
||||
data.queueby = user ? user.name : "";
|
||||
data.temp = !this.hasPermission(user, "addnontemp");
|
||||
|
||||
if(data.list)
|
||||
this.addMediaList(data, user);
|
||||
|
@ -1160,7 +1161,7 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
user.socket.emit("queueFail", "You don't have permission to add cusstom embeds");
|
||||
return;
|
||||
}
|
||||
data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp");
|
||||
data.temp = data.temp || isLive(data.type);
|
||||
data.queueby = user ? user.name : "";
|
||||
data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength;
|
||||
var chan = this;
|
||||
|
@ -1516,9 +1517,8 @@ Channel.prototype.tryVoteskip = function(user) {
|
|||
return;
|
||||
}
|
||||
// Voteskip = auto-unafk
|
||||
if(user.meta.afk) {
|
||||
user.setAFK(false);
|
||||
}
|
||||
user.setAFK(false);
|
||||
user.autoAFK();
|
||||
if(!this.voteskip) {
|
||||
this.voteskip = new Poll("voteskip", "voteskip", ["yes"]);
|
||||
}
|
||||
|
|
24
get-info.js
24
get-info.js
|
@ -17,18 +17,22 @@ var CustomEmbedFilter = require("./customembed").filter;
|
|||
|
||||
module.exports = function (Server) {
|
||||
function urlRetrieve(transport, options, callback) {
|
||||
var req = transport.request(options, function (res) {
|
||||
var buffer = "";
|
||||
res.setEncoding("utf-8");
|
||||
res.on("data", function (chunk) {
|
||||
buffer += chunk;
|
||||
try {
|
||||
var req = transport.request(options, function (res) {
|
||||
var buffer = "";
|
||||
res.setEncoding("utf-8");
|
||||
res.on("data", function (chunk) {
|
||||
buffer += chunk;
|
||||
});
|
||||
res.on("end", function () {
|
||||
callback(res.statusCode, buffer);
|
||||
});
|
||||
});
|
||||
res.on("end", function () {
|
||||
callback(res.statusCode, buffer);
|
||||
});
|
||||
});
|
||||
|
||||
req.end();
|
||||
req.end();
|
||||
} catch(e) {
|
||||
callback(503, "");
|
||||
}
|
||||
}
|
||||
|
||||
var Getters = {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -458,6 +458,7 @@ Playlist.prototype.lead = function(lead) {
|
|||
this._leadInterval = false;
|
||||
}
|
||||
else if(this.leading && !this._leadInterval) {
|
||||
this._lastUpdate = Date.now();
|
||||
this._leadInterval = setInterval(function() {
|
||||
pl._leadLoop();
|
||||
}, 1000);
|
||||
|
|
|
@ -6,7 +6,7 @@ var Logger = require("./logger");
|
|||
var Channel = require("./channel");
|
||||
var User = require("./user");
|
||||
|
||||
const VERSION = "2.3.1";
|
||||
const VERSION = "2.3.2";
|
||||
|
||||
function getIP(req) {
|
||||
var raw = req.connection.remoteAddress;
|
||||
|
|
2
user.js
2
user.js
|
@ -205,7 +205,7 @@ User.prototype.initCallbacks = function() {
|
|||
|
||||
this.socket.on("chatMsg", function(data) {
|
||||
if(this.channel != null) {
|
||||
if(data.msg.indexOf("/afk") == -1) {
|
||||
if(data.msg.indexOf("/afk") != 0) {
|
||||
this.setAFK(false);
|
||||
this.autoAFK();
|
||||
}
|
||||
|
|
|
@ -627,15 +627,8 @@ Callbacks = {
|
|||
var nametag = $("<span/>").text(data.name).appendTo(div);
|
||||
formatUserlistItem(div, data);
|
||||
addUserDropdown(div, data);
|
||||
var users = $("#userlist").children();
|
||||
for(var i = 0; i < users.length; i++) {
|
||||
var othername = users[i].children[1].innerHTML;
|
||||
if(othername.toLowerCase() > data.name.toLowerCase()) {
|
||||
div.insertBefore(users[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
div.appendTo($("#userlist"));
|
||||
sortUserlist();
|
||||
},
|
||||
|
||||
updateUser: function(data) {
|
||||
|
@ -647,16 +640,7 @@ Callbacks = {
|
|||
// I'm a leader! Set up sync function
|
||||
if(LEADTMR)
|
||||
clearInterval(LEADTMR);
|
||||
LEADTMR = setInterval(function() {
|
||||
PLAYER.getTime(function(seconds) {
|
||||
socket.emit("mediaUpdate", {
|
||||
id: PLAYER.id,
|
||||
currentTime: seconds,
|
||||
paused: PLAYER.paused,
|
||||
type: PLAYER.type
|
||||
});
|
||||
});
|
||||
}, 5000);
|
||||
LEADTMR = setInterval(sendVideoUpdate, 5000);
|
||||
}
|
||||
// I'm not a leader. Don't send syncs to the server
|
||||
else {
|
||||
|
@ -670,6 +654,8 @@ Callbacks = {
|
|||
if(user !== null) {
|
||||
formatUserlistItem(user, data);
|
||||
addUserDropdown(user, data);
|
||||
if(USEROPTS.sort_rank)
|
||||
sortUserlist();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -684,6 +670,8 @@ Callbacks = {
|
|||
.appendTo(user[0].children[0]);
|
||||
$(user[0].children[1]).css("font-style", "italic");
|
||||
}
|
||||
if(USEROPTS.sort_afk)
|
||||
sortUserlist();
|
||||
},
|
||||
|
||||
userLeave: function(data) {
|
||||
|
|
|
@ -115,7 +115,9 @@ var USEROPTS = {
|
|||
qbtn_idontlikechange : getOrDefault("qbtn_idontlikechange", false),
|
||||
first_visit : getOrDefault("first_visit", true),
|
||||
ignore_channelcss : getOrDefault("ignore_channelcss", false),
|
||||
ignore_channeljs : getOrDefault("ignore_channeljs", false)
|
||||
ignore_channeljs : getOrDefault("ignore_channeljs", false),
|
||||
sort_rank : getOrDefault("sort_rank", false),
|
||||
sort_afk : getOrDefault("sort_afk", false)
|
||||
};
|
||||
|
||||
var NO_WEBSOCKETS = USEROPTS.altsocket;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
.appendTo(sep);
|
||||
}
|
||||
}
|
||||
for(var i = s; i < s + this.opts.maxPages; i++) {
|
||||
for(var i = s; i < s + this.opts.maxPages && i < s + pages; i++) {
|
||||
(function (i) {
|
||||
var li = $("<li/>").appendTo(ul);
|
||||
if(i == p)
|
||||
|
|
|
@ -37,7 +37,6 @@ var YouTubePlayer = function (data) {
|
|||
autoplay: 1, // Autoplay video
|
||||
controls: 1, // Show controls
|
||||
iv_load_policy: 3, // No annotations
|
||||
modestbranding: 1, // No logo
|
||||
rel: 0, // No related videos
|
||||
wmode: wmode
|
||||
},
|
||||
|
|
|
@ -68,6 +68,38 @@ $("#logout").click(function() {
|
|||
});
|
||||
|
||||
/* chatbox */
|
||||
|
||||
$("#usercountwrap").mouseenter(function (ev) {
|
||||
var breakdown = calcUserBreakdown();
|
||||
// re-using profile-box class for convenience
|
||||
var popup = $("<div/>")
|
||||
.addClass("profile-box")
|
||||
.css("top", (ev.pageY + 5) + "px")
|
||||
.css("left", (ev.pageX) + "px")
|
||||
.appendTo($("#usercountwrap"));
|
||||
|
||||
var contents = "";
|
||||
for(var key in breakdown) {
|
||||
contents += "<strong>" + key + ": </strong>" + breakdown[key];
|
||||
contents += "<br>"
|
||||
}
|
||||
|
||||
popup.html(contents);
|
||||
});
|
||||
|
||||
$("#usercountwrap").mousemove(function (ev) {
|
||||
var popup = $("#usercountwrap").find(".profile-box");
|
||||
if(popup.length == 0)
|
||||
return;
|
||||
|
||||
popup.css("top", (ev.pageY + 5) + "px");
|
||||
popup.css("left", (ev.pageX) + "px");
|
||||
});
|
||||
|
||||
$("#usercountwrap").mouseleave(function () {
|
||||
$("#usercountwrap").find(".profile-box").remove();
|
||||
});
|
||||
|
||||
$("#messagebuffer").mouseenter(function() { SCROLLCHAT = false; });
|
||||
$("#messagebuffer").mouseleave(function() { SCROLLCHAT = true; });
|
||||
|
||||
|
|
|
@ -253,6 +253,71 @@ function addUserDropdown(entry, data) {
|
|||
});
|
||||
}
|
||||
|
||||
function calcUserBreakdown() {
|
||||
var breakdown = {
|
||||
"Site Admins": 0,
|
||||
"Channel Admins": 0,
|
||||
"Moderators": 0,
|
||||
"Regular Users": 0,
|
||||
"Guests": 0,
|
||||
"AFK": 0
|
||||
};
|
||||
$("#userlist .userlist_item").each(function (index, item) {
|
||||
var data = $(item).data("dropdown-info");
|
||||
if(data.rank >= 255)
|
||||
breakdown["Site Admins"]++;
|
||||
else if(data.rank >= 3)
|
||||
breakdown["Channel Admins"]++;
|
||||
else if(data.rank == 2)
|
||||
breakdown["Moderators"]++;
|
||||
else if(data.rank >= 1)
|
||||
breakdown["Regular Users"]++;
|
||||
else
|
||||
breakdown["Guests"]++;
|
||||
|
||||
if($(item).find(".icon-time").length > 0)
|
||||
breakdown["AFK"]++;
|
||||
});
|
||||
|
||||
return breakdown;
|
||||
}
|
||||
|
||||
function sortUserlist() {
|
||||
var slice = Array.prototype.slice;
|
||||
var list = slice.call($("#userlist .userlist_item"));
|
||||
list.sort(function (a, b) {
|
||||
var r1 = $(a).data("dropdown-info").rank;
|
||||
var r2 = $(b).data("dropdown-info").rank;
|
||||
var afk1 = $(a).find(".icon-time").length > 0;
|
||||
var afk2 = $(b).find(".icon-time").length > 0;
|
||||
var name1 = a.children[1].innerHTML.toLowerCase();
|
||||
var name2 = b.children[1].innerHTML.toLowerCase();
|
||||
|
||||
if(USEROPTS.sort_afk) {
|
||||
if(afk1 && !afk2)
|
||||
return 1;
|
||||
if(!afk1 && afk2)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(USEROPTS.sort_rank) {
|
||||
if(r1 < r2)
|
||||
return 1;
|
||||
if(r1 > r2)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return name1 === name2 ? 0 : (name1 < name2 ? -1 : 1);
|
||||
});
|
||||
|
||||
list.forEach(function (item) {
|
||||
$(item).detach();
|
||||
});
|
||||
list.forEach(function (item) {
|
||||
$(item).appendTo($("#userlist"));
|
||||
});
|
||||
}
|
||||
|
||||
/* queue stuff */
|
||||
|
||||
function scrollQueue() {
|
||||
|
@ -522,6 +587,18 @@ function showOptionsMenu() {
|
|||
showts.prop("checked", USEROPTS.show_timestamps);
|
||||
addOption("Show timestamps", tscontainer);
|
||||
|
||||
var srcontainer = $("<label/>").addClass("checkbox")
|
||||
.text("Sort userlist by rank");
|
||||
var sr = $("<input/>").attr("type", "checkbox").appendTo(srcontainer);
|
||||
sr.prop("checked", USEROPTS.sort_rank);
|
||||
addOption("Userlist sort", srcontainer);
|
||||
|
||||
var sacontainer = $("<label/>").addClass("checkbox")
|
||||
.text("AFKers at bottom of userlist");
|
||||
var sa = $("<input/>").attr("type", "checkbox").appendTo(sacontainer);
|
||||
sa.prop("checked", USEROPTS.sort_afk);
|
||||
addOption("Userlist sort", sacontainer);
|
||||
|
||||
var blinkcontainer = $("<label/>").addClass("checkbox")
|
||||
.text("Flash title on every incoming message");
|
||||
var blink = $("<input/>").attr("type", "checkbox").appendTo(blinkcontainer);
|
||||
|
@ -577,6 +654,9 @@ function showOptionsMenu() {
|
|||
USEROPTS.qbtn_idontlikechange = oqbtn.prop("checked");
|
||||
USEROPTS.ignore_channelcss = nocss.prop("checked");
|
||||
USEROPTS.ignore_channeljs = nojs.prop("checked");
|
||||
USEROPTS.sort_rank = sr.prop("checked");
|
||||
USEROPTS.sort_afk = sa.prop("checked");
|
||||
sortUserlist();
|
||||
if(CLIENT.rank >= Rank.Moderator) {
|
||||
USEROPTS.modhat = modhat.prop("checked");
|
||||
USEROPTS.joinmessage = join.prop("checked");
|
||||
|
@ -1218,9 +1298,11 @@ function formatChatMessage(data) {
|
|||
}
|
||||
if(data.superadminflair)
|
||||
skip = false;
|
||||
if(data.msgclass == "server-whisper") {
|
||||
if(data.msgclass == "server-whisper")
|
||||
skip = true;
|
||||
}
|
||||
// Prevent impersonation by abuse of the bold filter
|
||||
if(data.msg.match(/^\s*<strong>\w+\s*:\s*<\/strong>\s*/))
|
||||
skip = false;
|
||||
LASTCHATNAME = data.username;
|
||||
LASTCHATTIME = data.time;
|
||||
var div = $("<div/>");
|
||||
|
@ -1427,12 +1509,12 @@ function genPermissionsEditor() {
|
|||
makeOption("Jump to video", "playlistjump", standard, CHANNEL.perms.playlistjump+"");
|
||||
makeOption("Queue playlist", "playlistaddlist", standard, CHANNEL.perms.playlistaddlist+"");
|
||||
makeOption("Queue livestream", "playlistaddlive", standard, CHANNEL.perms.playlistaddlive+"");
|
||||
makeOption("Embed custom media", "playlistaddcustom", standard, CHANNEL.perms.playlistaddcustom + "");
|
||||
makeOption("Exceed maximum media length", "exceedmaxlength", standard, CHANNEL.perms.exceedmaxlength+"");
|
||||
makeOption("Add nontemporary media", "addnontemp", standard, CHANNEL.perms.addnontemp+"");
|
||||
makeOption("Temp/untemp playlist item", "settemp", standard, CHANNEL.perms.settemp+"");
|
||||
makeOption("Shuffle playlist", "playlistshuffle", standard, CHANNEL.perms.playlistshuffle+"");
|
||||
makeOption("Clear playlist", "playlistclear", standard, CHANNEL.perms.playlistclear+"");
|
||||
makeOption("Embed custom media", "playlistaddcustom", standard, CHANNEL.perms.playlistaddcustom + "");
|
||||
|
||||
addDivider("Polls");
|
||||
makeOption("Open/Close poll", "pollctl", modleader, CHANNEL.perms.pollctl+"");
|
||||
|
|
Loading…
Reference in a new issue