diff --git a/client/index.html b/client/index.html
index f21dfc01..03e0de37 100644
--- a/client/index.html
+++ b/client/index.html
@@ -10,6 +10,7 @@
+ ">
diff --git a/client/themes/example.css b/client/themes/example.css
new file mode 100644
index 00000000..af2dd604
--- /dev/null
+++ b/client/themes/example.css
@@ -0,0 +1,7 @@
+/**
+ * This is just an example theme and does not
+ * contain anything.
+ */
+
+body {
+}
diff --git a/config.js b/config.js
index 0b735705..6c1e1b52 100644
--- a/config.js
+++ b/config.js
@@ -1,4 +1,5 @@
module.exports = {
port: 9000,
- public: true
+ public: true,
+ theme: "themes/example.css"
};
diff --git a/lib/server.js b/lib/server.js
index 35135d03..2e03304d 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -1,6 +1,7 @@
var _ = require("lodash");
var Client = require("./client");
var config = require("../config") || {};
+var fs = require("fs");
var http = require("connect");
var io = require("socket.io");
@@ -25,7 +26,7 @@ var inputs = [
];
module.exports = function() {
- sockets = io(http().use(http.static("client")).listen(config.port || 9000));
+ sockets = io(http().use(index).use(http.static("client")).listen(config.port || 9000));
sockets.on("connect", function(socket) {
if (config.public) {
auth.call(socket);
@@ -35,6 +36,20 @@ module.exports = function() {
});
};
+function index(req, res, next) {
+ if (req.url != "/") return next();
+ return fs.readFile("client/index.html", "utf-8", function(err, file) {
+ var data = _.merge(
+ require("../package.json"),
+ config
+ );
+ res.end(_.template(
+ file,
+ data
+ ));
+ });
+}
+
function init(socket, client) {
if (!client) {
socket.emit("auth");
@@ -83,10 +98,10 @@ function input(client, data) {
if (text.charAt(0) !== "/") {
text = "/say " + text;
}
-
+
var args = text.split(" ");
var cmd = args.shift().replace("/", "").toLowerCase();
-
+
inputs.forEach(function(plugin) {
try {
var fn = require("./plugins/inputs/" + plugin);
diff --git a/package.json b/package.json
index dd5e7aaa..62da59ec 100644
--- a/package.json
+++ b/package.json
@@ -16,14 +16,14 @@
"server"
],
"main": "http://localhost:9000/",
- "node-main": "./index.js",
- "single-instance": false,
- "window": {
- "title": "Shout",
- "toolbar": false,
- "height": 640,
- "width": 1024
- },
+ "node-main": "./index.js",
+ "single-instance": false,
+ "window": {
+ "title": "Shout",
+ "toolbar": false,
+ "height": 640,
+ "width": 1024
+ },
"scripts": {
"start": "node index.js"
},