From c54915e9402cbf34b955ee2d6c819c6510de9ec5 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 18 Feb 2014 21:56:54 -0600 Subject: [PATCH] Fixes --- lib/channel.js | 2 ++ lib/customembed.js | 7 ++++++- www/assets/js/ui.js | 2 ++ www/assets/js/util.js | 2 -- www/js/theme.js | 4 ++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index 8b6d2124..d9f60521 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -871,6 +871,8 @@ Channel.prototype.handleBanAllIP = function (actor, name, reason, range) { * Bans an individual IP */ Channel.prototype.banIP = function (actor, ip, name, reason, range) { + var self = this; + if (range) { ip = ip.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, "$1.$2.$3"); } diff --git a/lib/customembed.js b/lib/customembed.js index 6cdb844e..e5e7ef90 100644 --- a/lib/customembed.js +++ b/lib/customembed.js @@ -2,6 +2,10 @@ const allowed = ["iframe", "object", "param", "embed"]; const tag_re = /<\s*\/?\s*([a-z]+)(\s*([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^"'>]*))*\s*>/ig; function filter(str) { + if (typeof str !== "string") { + return ""; + } + str = str.replace(tag_re, function (match, tag) { if(!~allowed.indexOf(tag.toLowerCase())) { return match.replace("<", "<").replace(">", ">"); @@ -11,7 +15,8 @@ function filter(str) { str = str.replace(/(\bon\w*\s*=\s*('[^']*'|"[^"]"|[^\s><]*))/ig, function () { return ""; }); - return str; + + return str.substring(0, 20000); } exports.filter = filter; diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index 948fca4c..62106423 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -690,3 +690,5 @@ $("#userlisttoggle").click(toggleUserlist); $(".add-temp").change(function () { $(".add-temp").prop("checked", $(this).prop("checked")); }); + +applyOpts(); diff --git a/www/assets/js/util.js b/www/assets/js/util.js index d93f9d9d..cf19195d 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -719,8 +719,6 @@ function applyOpts() { } } -applyOpts(); - function showPollMenu() { $("#pollwrap .poll-menu").remove(); var menu = $("
").addClass("well poll-menu") diff --git a/www/js/theme.js b/www/js/theme.js index 3e1bf4e6..910e7011 100644 --- a/www/js/theme.js +++ b/www/js/theme.js @@ -11,14 +11,18 @@ } } + console.log("cookie theme=", theme); + if (theme !== "default") { var cur = document.getElementById("usertheme"); cur.parentNode.removeChild(cur); + console.log('removed'); var css = document.createElement("link"); css.setAttribute("rel", "stylesheet"); css.setAttribute("type", "text/css"); css.setAttribute("href", theme); css.setAttribute("id", "usertheme"); document.head.appendChild(css); + console.log(css); } })();