diff --git a/config.template.yaml b/config.template.yaml
index 6dcfb80a..0a682cba 100644
--- a/config.template.yaml
+++ b/config.template.yaml
@@ -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 tag
html-template:
title: 'CyTube',
description: 'Free, open source synchtube'
diff --git a/lib/channel-new.js b/lib/channel-new.js
index 33a6df62..70eae989 100644
--- a/lib/channel-new.js
+++ b/lib/channel-new.js
@@ -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);
}
diff --git a/lib/chatcommand.js b/lib/chatcommand.js
index 0ab45e3b..faca710e 100644
--- a/lib/chatcommand.js
+++ b/lib/chatcommand.js
@@ -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 {
diff --git a/lib/config.js b/lib/config.js
index 363ce766..d809068e 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -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);
};
diff --git a/lib/database/channels.js b/lib/database/channels.js
index 1b602944..42c7542e 100644
--- a/lib/database/channels.js
+++ b/lib/database/channels.js
@@ -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));
});
});
diff --git a/lib/server.js b/lib/server.js
index ae5aea9f..fb9d3fcc 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -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));
diff --git a/lib/web/account.js b/lib/web/account.js
index 585c6c23..8b41c6af 100644
--- a/lib/web/account.js
+++ b/lib/web/account.js
@@ -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", {
diff --git a/lib/web/webserver.js b/lib/web/webserver.js
index 8ff0cebd..60674998 100644
--- a/lib/web/webserver.js
+++ b/lib/web/webserver.js
@@ -1,9 +1,3 @@
-/**
- * web/webserver.js - functions for serving web content
- *
- * @author Calvin Montgomery
- */
-
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());
diff --git a/templates/channel.jade b/templates/channel.jade
index b7efb4f8..8a895603 100644
--- a/templates/channel.jade
+++ b/templates/channel.jade
@@ -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
diff --git a/templates/pagefooter.jade b/templates/pagefooter.jade
new file mode 100644
index 00000000..e69de29b
diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js
index 01b2e9ab..06e1fa3d 100644
--- a/www/assets/js/ui.js
+++ b/www/assets/js/ui.js
@@ -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 = $("").addClass("container").insertBefore(main);
- var row = $("").addClass("row").appendTo(container);
- var div = $("").addClass("col-lg-6 col-md-6").appendTo(row);
- main.css("display", "none");
- var label = $("").text("Enter Channel:").appendTo(div);
- var entry = $("").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) {
diff --git a/www/assets/js/util.js b/www/assets/js/util.js
index f7cec12d..eae3a57f 100644
--- a/www/assets/js/util.js
+++ b/www/assets/js/util.js
@@ -1278,8 +1278,8 @@ function formatChatMessage(data) {
if (data.meta.superadminflair) {
name.addClass("label")
.addClass(data.meta.superadminflair.labelclass);
- $("").addClass(data.meta.superadminflair.icon)
- .addClass("icon-white")
+ $("").addClass(data.meta.superadminflair.icon)
+ .addClass("glyphicon")
.prependTo(name);
}