diff --git a/channel.js b/channel.js index 9aad63a6..708054f5 100644 --- a/channel.js +++ b/channel.js @@ -19,6 +19,7 @@ var Logger = require("./logger.js"); var InfoGetter = require("./get-info.js"); var Server = require("./server.js"); var io = Server.io; +var NWS = require("./notwebsocket"); var Rank = require("./rank.js"); var Auth = require("./auth.js"); var ChatCommand = require("./chatcommand.js"); @@ -54,7 +55,7 @@ var Channel = function(name) { playlistdelete: 2, playlistjump: 1.5, playlistaddlist: 1.5, - playlistadd: 1.5, + playlistaddlive: 1.5, addnontemp: 2, settemp: 2, playlistgeturl: 1.5, @@ -75,7 +76,8 @@ var Channel = function(name) { customcss: "", customjs: "", chat_antiflood: false, - show_public: false + show_public: false, + enable_link_regex: true }; this.filters = [ new Filter("monospace", "`([^`]+)`", "g", "$1"), @@ -197,7 +199,9 @@ Channel.prototype.loadDump = function() { } data.logins = data.logins || {}; for(var ip in data.logins) { - this.logins[ip] = data.logins[ip]; + for(var i = 0; i < data.logins.length; i++) { + this.logins[ip].push(data.logins[ip][i]); + } } this.setLock(!(data.openqueue || false)); this.chatbuffer = data.chatbuffer || []; @@ -536,12 +540,7 @@ Channel.prototype.userJoin = function(user) { if(user.name != "") { for(var i = 0; i < this.users.length; i++) { if(this.users[i].name.toLowerCase() == user.name.toLowerCase()) { - user.name = ""; - user.loggedIn = false; - user.socket.emit("login", { - success: false, - error: "The username " + user.name + " is already in use on this channel" - }); + this.kick(this.users[i], "Duplicate login"); } } } @@ -650,13 +649,12 @@ Channel.prototype.sendRankStuff = function(user) { var ents = []; for(var ip in this.ipbans) { if(this.ipbans[ip] != null) { - var name; + var name = []; if(ip in this.logins) { - name = this.logins[ip].join(", "); - } - else { - name = this.ipbans[ip][0]; + name = this.logins[ip]; } + name.push(this.ipbans[ip][0]); + name = name.join(", "); var id = this.hideIP(ip); var disp = ip; if(user.rank < Rank.Siteadmin) { @@ -760,6 +758,15 @@ Channel.prototype.sendRecentChat = function(user) { Channel.prototype.sendAll = function(message, data) { io.sockets.in(this.name).emit(message, data); + NWS.inRoom(this.name).emit(message, data); +} + +Channel.prototype.sendAllWithPermission = function(perm, msg, data) { + for(var i = 0; i < this.users.length; i++) { + if(Rank.hasPermission(this.users[i], perm)) { + this.users[i].socket.emit(msg, data); + } + } } Channel.prototype.broadcastPlaylistMeta = function() { @@ -954,12 +961,13 @@ function mediaUpdate(chan, id) { } function isLive(type) { - return type == "li" - || type == "tw" - || type == "jt" - || type == "rt" - || type == "jw" - || type == "us"; + return type == "li" // Livestream.com + || type == "tw" // Twitch.tv + || type == "jt" // Justin.tv + || type == "rt" // RTMP + || type == "jw" // JWPlayer + || type == "us" // Ustream.tv + || type == "im";// Imgur album } Channel.prototype.queueAdd = function(media, idx) { @@ -986,6 +994,11 @@ Channel.prototype.autoTemp = function(media, user) { Channel.prototype.enqueue = function(data, user) { var idx = data.pos == "next" ? this.position + 1 : this.queue.length; + if(isLive(data.type) && !this.hasPermission(user, "playlistaddlive")) { + user.socket.emit("queueFail", "You don't have permission to queue livestreams"); + return; + } + // Prefer cache over looking up new data if(data.id in this.library) { var media = this.library[data.id].dup(); @@ -1052,6 +1065,12 @@ Channel.prototype.enqueue = function(data, user) { this.autoTemp(media, user); this.queueAdd(media, idx); break; + case "im": + var media = new Media(data.id, "Imgur Album", "--:--", "im"); + media.queueby = user ? user.name : ""; + this.autoTemp(media, user); + this.queueAdd(media, idx); + break; default: break; } @@ -1448,8 +1467,12 @@ Channel.prototype.trySetLock = function(user, data) { Channel.prototype.updateFilter = function(filter) { var found = false; for(var i = 0; i < this.filters.length; i++) { - if(this.filters[i].name == filter.name - && this.filters[i].source == filter.source) { + if(this.filters[i].name == "" && filter.name == "" + && this.filters[i].source == filter.source) { + found = true; + this.filters[i] = filter; + } + else if(filter.name != "" && this.filters[i].name == filter.name) { found = true; this.filters[i] = filter; } @@ -1624,7 +1647,7 @@ Channel.prototype.filterMessage = function(msg) { var subs = msg.split(link); // Apply other filters for(var j = 0; j < subs.length; j++) { - if(subs[j].match(link)) { + if(this.opts.enable_link_regex && subs[j].match(link)) { subs[j] = subs[j].replace(link, "$1"); continue; } @@ -1661,6 +1684,46 @@ Channel.prototype.sendMessage = function(username, msg, msgclass, data) { /* REGION Rank stuff */ +Channel.prototype.trySetRank = function(user, data) { + if(!Rank.hasPermission(user, "promote")) + return; + + if(typeof data.user !== "string" || typeof data.rank !== "number") + return; + + if(data.rank >= user.rank) + return; + + if(data.rank < 1) + return; + + var receiver; + for(var i = 0; i < this.users.length; i++) { + if(this.users[i].name == data.user) { + receiver = this.users[i]; + break; + } + } + + if(receiver) { + if(receiver.rank >= user.rank) + return; + receiver.rank = data.rank; + if(receiver.loggedIn) { + this.saveRank(receiver); + } + this.broadcastUserUpdate(receiver); + } + else { + var rrank = this.getRank(data.user); + if(rrank >= user.rank) + return; + Database.setChannelRank(this.name, data.user, data.rank); + } + + this.sendAllWithPermission("acl", "setChannelRank", data); +} + Channel.prototype.tryPromoteUser = function(actor, data) { if(!Rank.hasPermission(actor, "promote")) { return; @@ -1695,7 +1758,7 @@ Channel.prototype.tryPromoteUser = function(actor, data) { Database.setChannelRank(this.name, data.name, rank); } this.logger.log("*** " + actor.name + " promoted " + data.name + " from " + (rank - 1) + " to " + rank); - this.broadcastRankTable(); + //this.broadcastRankTable(); } } @@ -1732,7 +1795,7 @@ Channel.prototype.tryDemoteUser = function(actor, data) { Database.setChannelRank(this.name, data.name, rank); } this.logger.log("*** " + actor.name + " demoted " + data.name + " from " + (rank + 1) + " to " + rank); - this.broadcastRankTable(); + //this.broadcastRankTable(); } } diff --git a/chatcommand.js b/chatcommand.js index a134574a..59a0ade0 100644 --- a/chatcommand.js +++ b/chatcommand.js @@ -39,7 +39,7 @@ function handle(chan, user, msg, data) { handleBan(chan, user, msg.substring(5).split(" ")); } else if(msg.indexOf("/ipban ") == 0) { - handleIPBan(chan, user, msg.substring(5).split(" ")); + handleIPBan(chan, user, msg.substring(7).split(" ")); } else if(msg.indexOf("/unban ") == 0) { handleUnban(chan, user, msg.substring(7).split(" ")); @@ -86,12 +86,11 @@ function handleIPBan(chan, user, args) { break; } } - if(kickee && kickee.rank < user.rank) { - chan.logger.log("*** " + user.name + " banned " + args[0]); - args[0] = ""; - var reason = args.join(" "); - chan.kick(kickee, "(banned) " + reason); - chan.banIP(user, kickee); + if(kickee) { + chan.tryIPBan(user, { + id: chan.hideIP(kickee.ip), + name: kickee.name + }); } } } diff --git a/database.js b/database.js index 9557f477..c734695e 100644 --- a/database.js +++ b/database.js @@ -1,3 +1,14 @@ +/* +The MIT License (MIT) +Copyright (c) 2013 Calvin Montgomery + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of 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. +*/ + var mysql = require("mysql-libmysqlclient"); var Logger = require("./logger"); var Media = require("./media").Media; diff --git a/filter.js b/filter.js index c26a1fec..c2586abf 100644 --- a/filter.js +++ b/filter.js @@ -1,3 +1,14 @@ +/* +The MIT License (MIT) +Copyright (c) 2013 Calvin Montgomery + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of 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. +*/ + var Filter = function(name, regex, flags, replace) { this.name = name; this.source = regex; diff --git a/notwebsocket.js b/notwebsocket.js new file mode 100644 index 00000000..c4862ea4 --- /dev/null +++ b/notwebsocket.js @@ -0,0 +1,194 @@ +/* +The MIT License (MIT) +Copyright (c) 2013 Calvin Montgomery + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of 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. +*/ + +var Logger = require("./logger"); + +const chars = "abcdefghijklmnopqsrtuvwxyz" + + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + + "0123456789"; + +var NotWebsocket = function() { + this.hash = ""; + for(var i = 0; i < 30; i++) { + this.hash += chars[parseInt(Math.random() * (chars.length - 1))]; + } + + this.pktqueue = []; + this.handlers = {}; + this.room = ""; + this.lastpoll = Date.now(); + this.noflood = {}; +} + +NotWebsocket.prototype.checkFlood = function(id, rate) { + if(id in this.noflood) { + this.noflood[id].push(Date.now()); + } + else { + this.noflood[id] = [Date.now()]; + } + if(this.noflood[id].length > 10) { + this.noflood[id].shift(); + var hz = 10000 / (this.noflood[id][9] - this.noflood[id][0]); + if(hz > rate) { + throw "Rate is too high: " + id; + } + } +} + +NotWebsocket.prototype.emit = function(msg, data) { + var pkt = [msg, data]; + this.pktqueue.push(pkt); +} + +NotWebsocket.prototype.poll = function() { + this.checkFlood("poll", 100); + this.lastpoll = Date.now(); + var q = []; + for(var i = 0; i < this.pktqueue.length; i++) { + q.push(this.pktqueue[i]); + } + this.pktqueue.length = 0; + return q; +} + +NotWebsocket.prototype.on = function(msg, callback) { + if(!(msg in this.handlers)) + this.handlers[msg] = []; + this.handlers[msg].push(callback); +} + +NotWebsocket.prototype.recv = function(urlstr) { + this.checkFlood("recv", 100); + var msg, data; + try { + var js = JSON.parse(urlstr); + msg = js[0]; + data = js[1]; + } + catch(e) { + Logger.errlog.log("Failed to parse NWS string"); + Logger.errlog.log(urlstr); + } + if(!msg) + return; + if(!(msg in this.handlers)) + return; + for(var i = 0; i < this.handlers[msg].length; i++) { + this.handlers[msg][i](data); + } +} + +NotWebsocket.prototype.join = function(rm) { + if(!(rm in rooms)) { + rooms[rm] = []; + } + + rooms[rm].push(this); +} + +NotWebsocket.prototype.leave = function(rm) { + if(rm in rooms) { + var idx = rooms[rm].indexOf(this); + if(idx >= 0) { + rooms[rm].splice(idx, 1); + } + } +} + +NotWebsocket.prototype.disconnect = function() { + for(var rm in rooms) { + this.leave(rm); + } + + this.recv(JSON.stringify(["disconnect", undefined])); + this.emit("disconnect"); + + clients[this.hash] = null; + delete clients[this.hash]; +} + +function sendJSON(res, obj) { + var response = JSON.stringify(obj, null, 4); + if(res.callback) { + response = res.callback + "(" + response + ")"; + } + var len = unescape(encodeURIComponent(response)).length; + + res.setHeader("Content-Type", "application/json"); + res.setHeader("Content-Length", len); + res.end(response); +} + +var clients = {}; +var rooms = {}; + +function newConnection(req, res) { + var nws = new NotWebsocket(); + clients[nws.hash] = nws; + res.callback = req.query.callback; + sendJSON(res, nws.hash); + return nws; +} +exports.newConnection = newConnection; + +function msgReceived(req, res) { + var h = req.params.hash; + if(h in clients && clients[h] != null) { + var str = req.params.str; + res.callback = req.query.callback; + try { + if(str == "poll") { + sendJSON(res, clients[h].poll()); + } + else { + clients[h].recv(unescape(str)); + sendJSON(res, ""); + } + } + catch(e) { + res.send(429); // 429 Too Many Requests + } + } + else { + res.send(404); + } +} +exports.msgReceived = msgReceived; + +function inRoom(rm) { + var cl = []; + + if(rm in rooms) { + for(var i = 0; i < rooms[rm].length; i++) { + cl.push(rooms[rm][i]); + } + } + + cl.emit = function(msg, data) { + for(var i = 0; i < this.length; i++) { + this[i].emit(msg, data); + } + }; + + return cl; +} +exports.inRoom = inRoom; + +function checkDeadSockets() { + for(var h in clients) { + if(Date.now() - clients[h].lastpoll >= 2000) { + clients[h].disconnect(); + } + } +} + +setInterval(checkDeadSockets, 2000); diff --git a/package.json b/package.json index 838002ad..85c80382 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "1.9.3", + "version": "1.9.4", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/server.js b/server.js index 1676ad3a..d10e63a2 100644 --- a/server.js +++ b/server.js @@ -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. */ -const VERSION = "1.9.3"; +const VERSION = "1.9.4"; var fs = require("fs"); var Logger = require("./logger.js"); @@ -18,6 +18,7 @@ Logger.syslog.log("Starting CyTube v" + VERSION); var Config = require("./config.js"); var express = require("express"); var API = require("./api.js"); +var NWS = require("./notwebsocket"); var app = express(); app.get("/r/:channel(*)", function(req, res, next) { @@ -34,6 +35,53 @@ app.get("/api/:apireq(*)", function(req, res, next) { API.handle(req.url.substring(5), req, res); }); +function getClientIP(req) { + var ip; + var forward = req.header("x-forwarded-for"); + if(forward) { + ip = forward.split(",")[0]; + } + if(!ip) { + ip = req.connection.remoteAddress; + } + return ip; +} + +app.get("/nws/connect", function(req, res, next) { + var socket = NWS.newConnection(req, res); + var ip = getClientIP(req); + if(Database.checkGlobalBan(ip)) { + Logger.syslog.log("Disconnecting " + ip + " - bant"); + socket.emit("kick", { + reason: "You're globally banned!" + }); + socket.disconnect(true); + return; + } + socket.on("disconnect", function() { + exports.clients[ip]--; + }); + if(!(ip in exports.clients)) { + exports.clients[ip] = 1; + } + else { + exports.clients[ip]++; + } + if(exports.clients[ip] > Config.MAX_PER_IP) { + socket.emit("kick", { + reason: "Too many connections from your IP address" + }); + socket.disconnect(true); + return; + } + var user = new User(socket, ip); + Logger.syslog.log("Accepted connection from /" + user.ip); +}); + +app.get("/nws/:hash/:str", function(req, res, next) { + NWS.msgReceived(req, res); +}); + app.get("/:thing(*)", function(req, res, next) { res.sendfile(__dirname + "/www/" + req.params.thing); }); diff --git a/user.js b/user.js index 5175a9e6..549ac99e 100644 --- a/user.js +++ b/user.js @@ -146,6 +146,12 @@ User.prototype.initCallbacks = function() { } }.bind(this)); + this.socket.on("setChannelRank", function(data) { + if(this.channel != null) { + this.channel.trySetRank(this, data); + } + }.bind(this)); + this.socket.on("banName", function(data) { if(this.channel != null) { this.channel.banName(this, data.name || ""); @@ -521,11 +527,7 @@ User.prototype.login = function(name, pw, session) { if(this.channel != null && name != "") { for(var i = 0; i < this.channel.users.length; i++) { if(this.channel.users[i].name == name) { - this.socket.emit("login", { - success: false, - error: "The username " + name + " is already in use on this channel" - }); - return false; + this.channel.kick(this.channel.users[i], "Duplicate login"); } } } diff --git a/www/assets/css/ytsync.css b/www/assets/css/ytsync.css index c7e3016b..ce752dca 100644 --- a/www/assets/css/ytsync.css +++ b/www/assets/css/ytsync.css @@ -77,12 +77,21 @@ html, body { margin-bottom: 0; } -#usercount, #currenttitle { +#usercountcontainer, #currenttitle { border: 1px solid #aaaaaa; border-bottom: none; margin: 0; } +#usercount { + margin: 0; +} + +#ulistchevron { + cursor: pointer; + float: left; +} + #plmeta { border: 1px solid #aaaaaa; background-color: #ffffff; diff --git a/www/assets/js/account.js b/www/assets/js/account.js index 816e2036..04d04de8 100644 --- a/www/assets/js/account.js +++ b/www/assets/js/account.js @@ -1,3 +1,14 @@ +/* +The MIT License (MIT) +Copyright (c) 2013 Calvin Montgomery + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of 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. +*/ + var uname = readCookie("sync_uname") || ""; var session = readCookie("sync_session") || ""; var api = WEB_URL + "/api/json/"; diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 2c2201b5..b560d72d 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -1,3 +1,14 @@ +/* +The MIT License (MIT) +Copyright (c) 2013 Calvin Montgomery + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of 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. +*/ + Callbacks = { connect: function() { @@ -193,9 +204,9 @@ Callbacks = { $("#opt_customjs").val(opts.customjs); $("#opt_chat_antiflood").prop("checked", opts.chat_antiflood); $("#opt_show_public").prop("checked", opts.show_public); + $("#opt_enable_link_regex").prop("checked", opts.enable_link_regex); $("#customCss").remove(); if(opts.customcss.trim() != "") { - $("#usertheme").remove(); $("") .attr("rel", "stylesheet") .attr("href", opts.customcss) @@ -242,7 +253,6 @@ Callbacks = { $("#jstext").val(data.js); if(data.css) { - $("#usertheme").remove(); $("