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: ''
# Minutes between saving channel state to disk
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
guest-login-delay: 60
# Block known Tor IP addresses

View File

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

View File

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

View File

@ -251,41 +251,64 @@ function handleNewChannel(req, res) {
return;
}
if (name.match(Config.get("reserved-names.channels"))) {
db.channels.listUserChannels(loginName, function (err2, channels) {
db.channels.listUserChannels(loginName, function (err, channels) {
if (err) {
sendJade(res, "account-channels", {
loggedIn: true,
loginName: loginName,
channels: err2 ? [] : channels,
newChannelError: "That channel name is reserved"
channels: [],
newChannelError: err
});
});
return;
}
db.channels.register(name, user.name, function (err, channel) {
if (!err) {
Logger.eventlog.log("[channel] " + user.name + "@" +
webserver.ipForRequest(req) + " registered channel " +
name);
var sv = Server.getServer();
if (sv.isChannelLoaded(name)) {
var chan = sv.getChannel(name);
chan.users.forEach(function (u) {
u.kick("Channel reloading");
});
if (!chan.dead) {
chan.emit("empty");
}
}
return;
}
db.channels.listUserChannels(loginName, function (err2, channels) {
if (name.match(Config.get("reserved-names.channels"))) {
sendJade(res, "account-channels", {
loggedIn: true,
loginName: loginName,
channels: err2 ? [] : channels,
channels: channels,
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;
}
db.channels.register(name, user.name, function (err, channel) {
if (!err) {
Logger.eventlog.log("[channel] " + user.name + "@" +
webserver.ipForRequest(req) +
" registered channel " + name);
var sv = Server.getServer();
if (sv.isChannelLoaded(name)) {
var chan = sv.getChannel(name);
chan.users.forEach(function (u) {
u.kick("Channel reloading");
});
if (!chan.dead) {
chan.emit("empty");
}
}
channels.push({
name: name
});
}
sendJade(res, "account-channels", {
loggedIn: true,
loginName: loginName,
channels: channels,
newChannelError: err ? err : undefined
});
});

View File

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

View File

@ -671,9 +671,8 @@ function applyOpts() {
if(USEROPTS.hidevid) {
$("#qualitywrap").html("");
$("#videowrap").remove();
removeVideo();
$("#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();
@ -1442,14 +1441,13 @@ function hdLayout() {
$("#mainpage").css("padding-top", "0");
$("body").addClass("hd");
setTimeout(resizeStuff, 500);
}
function chatOnly() {
//fluidLayout();
$("#toprow").remove()
$("#announcements").remove();
$("#playlistrow").remove();
$("#videowrap").remove();
removeVideo();
$("#controlsrow").remove();
$("#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);
// Only execute if we are on a fluid layout
if ($("body").hasClass("fluid")) {
if (!$("body").hasClass("fluid")) {
return;
}
@ -1471,6 +1469,18 @@ function resizeStuff() {
$(window).resize(resizeStuff);
function removeVideo() {
try {
PLAYER.setVolume(0);
if (PLAYER.type === "rv") {
$(PLAYER.player).remove();
}
} catch (e) {
}
$("#videowrap").remove();
}
/* channel administration stuff */
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;
}
.queue_entry {
background-color: #060606;
}
.queue_active {
background-color: #333333;
}

View File

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

View File

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