Fix a buttload of things

This commit is contained in:
calzoneman 2014-01-26 00:01:36 -06:00
parent bedf3afb61
commit 6570c3da6c
12 changed files with 59 additions and 51 deletions

View file

@ -7,10 +7,11 @@ mysql:
server: 'localhost' server: 'localhost'
database: 'cytube3' database: 'cytube3'
user: 'cytube3' user: 'cytube3'
password: 'pickles' password: ''
# HTTP server details # HTTP server details
http: http:
# If you want to bind a specific IP, put it here, otherwise leave empty
host: '' host: ''
port: 8080 port: 8080
domain: 'http://localhost' domain: 'http://localhost'
@ -25,6 +26,7 @@ https:
certfile: 'localhost.cert' certfile: 'localhost.cert'
# Page template values # Page template values
# title goes in the upper left corner, description goes in a <meta> tag
html-template: html-template:
title: 'CyTube', title: 'CyTube',
description: 'Free, open source synchtube' description: 'Free, open source synchtube'

View file

@ -2608,7 +2608,7 @@ Channel.prototype.handleChat = function (user, data) {
} }
} else { } else {
if (msg.indexOf(">") === 0) { if (msg.indexOf(">") === 0) {
data.meta.addClass = "greentext"; meta.addClass = "greentext";
} }
this.sendMessage(user, msg, meta); this.sendMessage(user, msg, meta);
} }

View file

@ -38,9 +38,10 @@ var handlers = {
if (user.global_rank < 255) { if (user.global_rank < 255) {
return false; return false;
} }
var superadminflair = { var superadminflair = {
labelclass: "label-important", labelclass: "label-danger",
icon: "icon-globe" icon: "glyphicon-globe"
}; };
var args = msg.split(" "); var args = msg.split(" ");
@ -48,7 +49,7 @@ var handlers = {
for (var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
var a = args[i]; var a = args[i];
if (a.indexOf("!icon-") === 0) { if (a.indexOf("!icon-") === 0) {
superadminflair.icon = a.substring(1); superadminflair.icon = "glyph" + a.substring(1);
} else if (a.indexOf("!label-") === 0) { } else if (a.indexOf("!label-") === 0) {
superadminflair.labelclass = a.substring(1); superadminflair.labelclass = a.substring(1);
} else { } else {

View file

@ -30,7 +30,7 @@ var defaults = {
https: { https: {
enabled: false, enabled: false,
port: 8443, port: 8443,
domain: "https://localhost:8443", domain: "https://localhost",
keyfile: "localhost.key", keyfile: "localhost.key",
passphrase: "", passphrase: "",
certfile: "localhost.cert" certfile: "localhost.cert"
@ -131,6 +131,9 @@ exports.load = function (file) {
cfg.debug = false; cfg.debug = false;
} }
cfg.http.domain = cfg.http.domain.replace(/\/*$/, "");
cfg.https.domain = cfg.https.domain.replace(/\/*$/, "");
Logger.syslog.log("Loaded configuration from " + file); Logger.syslog.log("Loaded configuration from " + file);
}; };

View file

@ -1,5 +1,8 @@
var db = require("../database"); var db = require("../database");
var valid = require("../utilities").isValidChannelName; var valid = require("../utilities").isValidChannelName;
var fs = require("fs");
var path = require("path");
var Logger = require("../logger");
var blackHole = function () { }; var blackHole = function () { };
@ -48,7 +51,15 @@ function initTables(name, owner, callback) {
return; return;
} }
module.exports.setRank(name, owner, 4, function (err) { db.users.getGlobalRank(owner, function (err, rank) {
if (err) {
callback(err, null);
return;
}
rank = Math.max(rank, 4);
module.exports.setRank(name, owner, rank, function (err) {
if (err) { if (err) {
dropTable("chan_" + name + "_ranks"); dropTable("chan_" + name + "_ranks");
callback(err, null); callback(err, null);
@ -75,6 +86,7 @@ function initTables(name, owner, callback) {
}); });
}); });
}); });
});
} }
module.exports = { module.exports = {
@ -252,6 +264,15 @@ module.exports = {
err = e4; err = e4;
} }
console.log(path.join(__dirname, "..", "..", "chandump", name));
fs.unlink(path.join(__dirname, "..", "..", "chandump", name),
function (err) {
if (err) {
Logger.errlog.log("Deleting chandump failed:");
Logger.errlog.log(err);
}
});
callback(err, !Boolean(err)); callback(err, !Boolean(err));
}); });
}); });

View file

@ -189,7 +189,7 @@ Server.prototype.packChannelList = function (publicOnly) {
return true; return true;
} }
return c.opts.show_public && !c.opts.password; return c.opts.show_public;
}); });
return channels.map(this.packChannel.bind(this)); return channels.map(this.packChannel.bind(this));

View file

@ -295,6 +295,16 @@ function handleDeleteChannel(req, res) {
} }
db.channels.lookup(name, function (err, channel) { db.channels.lookup(name, function (err, channel) {
if (err) {
sendJade(res, "account-channels", {
loggedIn: true,
loginName: loginName,
channels: [],
deleteChannelError: err
});
return;
}
if (channel.owner !== user.name && user.global_rank < 255) { if (channel.owner !== user.name && user.global_rank < 255) {
db.channels.listUserChannels(loginName, function (err2, channels) { db.channels.listUserChannels(loginName, function (err2, channels) {
sendJade(res, "account-channels", { sendJade(res, "account-channels", {

View file

@ -1,9 +1,3 @@
/**
* web/webserver.js - functions for serving web content
*
* @author Calvin Montgomery <cyzon@cyzon.us>
*/
var path = require("path"); var path = require("path");
var net = require("net"); var net = require("net");
var express = require("express"); var express = require("express");
@ -179,8 +173,6 @@ function handleSocketConfig(req, res) {
module.exports = { module.exports = {
/** /**
* Initializes webserver callbacks * Initializes webserver callbacks
*
* @param app - The express instance to initialize
*/ */
init: function (app) { init: function (app) {
app.use(express.json()); app.use(express.json());

View file

@ -125,6 +125,7 @@ html(lang="en")
.col-lg-5.col-md-5 .col-lg-5.col-md-5
#videowidth.col-lg-7.col-md-7 #videowidth.col-lg-7.col-md-7
#sitefooter #sitefooter
include pagefooter
#useroptions.modal.fade(tabindex="-1", role="dialog", aria-hidden="true") #useroptions.modal.fade(tabindex="-1", role="dialog", aria-hidden="true")
.modal-dialog .modal-dialog
.modal-content .modal-content

View file

View file

@ -410,28 +410,6 @@ if(m) {
CHANNEL.name = CHANNEL.name.substring(0, CHANNEL.name.indexOf("#")); CHANNEL.name = CHANNEL.name.substring(0, CHANNEL.name.indexOf("#"));
} }
} }
/*
else {
var main = $("#main");
var container = $("<div/>").addClass("container").insertBefore(main);
var row = $("<div/>").addClass("row").appendTo(container);
var div = $("<div/>").addClass("col-lg-6 col-md-6").appendTo(row);
main.css("display", "none");
var label = $("<label/>").text("Enter Channel:").appendTo(div);
var entry = $("<input/>").attr("type", "text").appendTo(div);
entry.keydown(function(ev) {
var host = document.protocol + "//" + document.host + "/";
if(ev.keyCode == 13) {
document.location = host + "r/" + entry.val();
container.remove();
main.css("display", "");
}
});
}
*/
/* custom footer */
$("#sitefooter").load("footer.html");
/* oh internet explorer, how I hate thee */ /* oh internet explorer, how I hate thee */
$(":input:not(textarea)").keypress(function(ev) { $(":input:not(textarea)").keypress(function(ev) {

View file

@ -1278,8 +1278,8 @@ function formatChatMessage(data) {
if (data.meta.superadminflair) { if (data.meta.superadminflair) {
name.addClass("label") name.addClass("label")
.addClass(data.meta.superadminflair.labelclass); .addClass(data.meta.superadminflair.labelclass);
$("<i/>").addClass(data.meta.superadminflair.icon) $("<span/>").addClass(data.meta.superadminflair.icon)
.addClass("icon-white") .addClass("glyphicon")
.prependTo(name); .prependTo(name);
} }