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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,8 @@
var db = require("../database");
var valid = require("../utilities").isValidChannelName;
var fs = require("fs");
var path = require("path");
var Logger = require("../logger");
var blackHole = function () { };
@ -48,29 +51,38 @@ function initTables(name, owner, callback) {
return;
}
module.exports.setRank(name, owner, 4, function (err) {
db.users.getGlobalRank(owner, function (err, rank) {
if (err) {
dropTable("chan_" + name + "_ranks");
callback(err, null);
return;
}
createLibraryTable(name, function (err) {
rank = Math.max(rank, 4);
module.exports.setRank(name, owner, rank, function (err) {
if (err) {
dropTable("chan_" + name + "_ranks");
callback(err, null);
return;
}
createBansTable(name, function (err) {
createLibraryTable(name, function (err) {
if (err) {
dropTable("chan_" + name + "_ranks");
dropTable("chan_" + name + "_library");
callback(err, null);
return;
}
callback(null, true);
createBansTable(name, function (err) {
if (err) {
dropTable("chan_" + name + "_ranks");
dropTable("chan_" + name + "_library");
callback(err, null);
return;
}
callback(null, true);
});
});
});
});
@ -194,9 +206,9 @@ module.exports = {
}
db.query("INSERT INTO `channels` " +
"(`name`, `owner`, `time`) VALUES (?, ?, ?)",
[name, owner, Date.now()],
function (err, res) {
"(`name`, `owner`, `time`) VALUES (?, ?, ?)",
[name, owner, Date.now()],
function (err, res) {
if (err) {
callback(err, null);
return;
@ -252,6 +264,15 @@ module.exports = {
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));
});
});

View File

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

View File

@ -295,6 +295,16 @@ function handleDeleteChannel(req, res) {
}
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) {
db.channels.listUserChannels(loginName, function (err2, 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 net = require("net");
var express = require("express");
@ -179,8 +173,6 @@ function handleSocketConfig(req, res) {
module.exports = {
/**
* Initializes webserver callbacks
*
* @param app - The express instance to initialize
*/
init: function (app) {
app.use(express.json());

View File

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

View File

View File

@ -1,11 +1,11 @@
/*
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.
*/
@ -410,28 +410,6 @@ if(m) {
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 */
$(":input:not(textarea)").keypress(function(ev) {

View File

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