Theme fixes; layout fixes; limit channel registrations

This commit is contained in:
calzoneman 2014-02-06 10:37:00 -06:00
parent 07feb91cc6
commit 359a228d5f
10 changed files with 110 additions and 38 deletions

View File

@ -55,6 +55,8 @@ mail:
youtube-v2-key: '' youtube-v2-key: ''
# Minutes between saving channel state to disk # Minutes between saving channel state to disk
channel-save-interval: 5 channel-save-interval: 5
# Limit for the number of channels a user can register
max-channels-per-user: 5
# Minimum number of seconds between guest logins from the same IP # Minimum number of seconds between guest logins from the same IP
guest-login-delay: 60 guest-login-delay: 60
# Block known Tor IP addresses # Block known Tor IP addresses

View File

@ -1713,10 +1713,7 @@ Channel.prototype.addMedia = function (data, callback) {
} }
if (err && err !== "Item not in library") { if (err && err !== "Item not in library") {
user.socket.emit("queueFail", { callback(err, null);
msg: "Internal error: " + err,
link: util.formatLink(data.id, data.type)
});
lock.release(); lock.release();
return; return;
} }

View File

@ -49,6 +49,7 @@ var defaults = {
}, },
"youtube-v2-key": "", "youtube-v2-key": "",
"channel-save-interval": 5, "channel-save-interval": 5,
"max-channels-per-user": 5,
"guest-login-delay": 60, "guest-login-delay": 60,
"enable-tor-blocker": true, "enable-tor-blocker": true,
stats: { stats: {

View File

@ -251,14 +251,34 @@ function handleNewChannel(req, res) {
return; return;
} }
if (name.match(Config.get("reserved-names.channels"))) { db.channels.listUserChannels(loginName, function (err, channels) {
db.channels.listUserChannels(loginName, function (err2, channels) { if (err) {
sendJade(res, "account-channels", { sendJade(res, "account-channels", {
loggedIn: true, loggedIn: true,
loginName: loginName, loginName: loginName,
channels: err2 ? [] : channels, channels: [],
newChannelError: err
});
return;
}
if (name.match(Config.get("reserved-names.channels"))) {
sendJade(res, "account-channels", {
loggedIn: true,
loginName: loginName,
channels: channels,
newChannelError: "That channel name is reserved" newChannelError: "That channel name is reserved"
}); });
return;
}
if (channels.length >= Config.get("max-channels-per-user")) {
sendJade(res, "account-channels", {
loggedIn: true,
loginName: loginName,
channels: channels,
newChannelError: "You are not allowed to register more than " +
Config.get("max-channels-per-user") + " channels."
}); });
return; return;
} }
@ -266,8 +286,8 @@ function handleNewChannel(req, res) {
db.channels.register(name, user.name, function (err, channel) { db.channels.register(name, user.name, function (err, channel) {
if (!err) { if (!err) {
Logger.eventlog.log("[channel] " + user.name + "@" + Logger.eventlog.log("[channel] " + user.name + "@" +
webserver.ipForRequest(req) + " registered channel " + webserver.ipForRequest(req) +
name); " registered channel " + name);
var sv = Server.getServer(); var sv = Server.getServer();
if (sv.isChannelLoaded(name)) { if (sv.isChannelLoaded(name)) {
var chan = sv.getChannel(name); var chan = sv.getChannel(name);
@ -279,13 +299,16 @@ function handleNewChannel(req, res) {
chan.emit("empty"); chan.emit("empty");
} }
} }
channels.push({
name: name
});
} }
db.channels.listUserChannels(loginName, function (err2, channels) {
sendJade(res, "account-channels", { sendJade(res, "account-channels", {
loggedIn: true, loggedIn: true,
loginName: loginName, loginName: loginName,
channels: err2 ? [] : channels, channels: channels,
newChannelError: err ? err : undefined newChannelError: err ? err : undefined
}); });
}); });

View File

@ -485,7 +485,6 @@ $("#cs-chanranks-owner").click(chanrankSubmit.bind(this, 4));
$(".plcontrol-collapse").collapse("hide"); $(".plcontrol-collapse").collapse("hide");
$("#plcontrol button.active").button("toggle"); $("#plcontrol button.active").button("toggle");
if (!wasActive) { if (!wasActive) {
console.log($(id)[0].className);
$(id).button("toggle"); $(id).button("toggle");
} }
}); });

View File

@ -671,9 +671,8 @@ function applyOpts() {
if(USEROPTS.hidevid) { if(USEROPTS.hidevid) {
$("#qualitywrap").html(""); $("#qualitywrap").html("");
$("#videowrap").remove(); removeVideo();
$("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12"); $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12");
$("#chatline").removeClass().addClass("col-lg-12 col-md-12 form-control");
} }
$("#chatbtn").remove(); $("#chatbtn").remove();
@ -1442,14 +1441,13 @@ function hdLayout() {
$("#mainpage").css("padding-top", "0"); $("#mainpage").css("padding-top", "0");
$("body").addClass("hd"); $("body").addClass("hd");
setTimeout(resizeStuff, 500);
} }
function chatOnly() { function chatOnly() {
//fluidLayout();
$("#toprow").remove() $("#toprow").remove()
$("#announcements").remove();
$("#playlistrow").remove(); $("#playlistrow").remove();
$("#videowrap").remove(); removeVideo();
$("#controlsrow").remove(); $("#controlsrow").remove();
$("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12"); $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12");
} }
@ -1460,7 +1458,7 @@ function resizeStuff() {
$("#ytapiplayer").width(VWIDTH).height(VHEIGHT); $("#ytapiplayer").width(VWIDTH).height(VHEIGHT);
// Only execute if we are on a fluid layout // Only execute if we are on a fluid layout
if ($("body").hasClass("fluid")) { if (!$("body").hasClass("fluid")) {
return; return;
} }
@ -1471,6 +1469,18 @@ function resizeStuff() {
$(window).resize(resizeStuff); $(window).resize(resizeStuff);
function removeVideo() {
try {
PLAYER.setVolume(0);
if (PLAYER.type === "rv") {
$(PLAYER.player).remove();
}
} catch (e) {
}
$("#videowrap").remove();
}
/* channel administration stuff */ /* channel administration stuff */
function genPermissionsEditor() { function genPermissionsEditor() {

File diff suppressed because one or more lines are too long

View File

@ -7713,6 +7713,10 @@ input.form-control[type="email"], textarea.form-control {
color: #c8c8c8; color: #c8c8c8;
} }
.queue_entry {
background-color: #060606;
}
.queue_active { .queue_active {
background-color: #333333; background-color: #333333;
} }

View File

@ -14,6 +14,10 @@ footer {
background-color: #eeeeee !important; background-color: #eeeeee !important;
} }
.queue_entry {
background-color: #ffffff;
}
.queue_active { .queue_active {
background-color: #d9edf7; background-color: #d9edf7;
} }

View File

@ -7989,6 +7989,10 @@ input.form-control[type="email"], textarea.form-control {
color: #c8c8c8; color: #c8c8c8;
} }
.queue_entry {
background-color: #272b30;
}
.queue_active { .queue_active {
background-image: -webkit-linear-gradient(#8a9196, #7a8288 60%, #70787d); background-image: -webkit-linear-gradient(#8a9196, #7a8288 60%, #70787d);
background-image: linear-gradient(#8a9196, #7a8288, #70787d); background-image: linear-gradient(#8a9196, #7a8288, #70787d);