Added theme support
This commit is contained in:
parent
e2f47ccb97
commit
7165a2f385
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="css/bootstrap.css">
|
<link rel="stylesheet" href="css/bootstrap.css">
|
||||||
<link rel="stylesheet" href="css/style.css">
|
<link rel="stylesheet" href="css/style.css">
|
||||||
|
<link id="theme" rel="stylesheet" href="<%= typeof theme !== "undefined" ? theme : "" %>">
|
||||||
|
|
||||||
<link rel="apple-touch-icon" sizes="144x144" href="/img/apple-icon-144x144.png" />
|
<link rel="apple-touch-icon" sizes="144x144" href="/img/apple-icon-144x144.png" />
|
||||||
<link rel="shortcut icon" href="/img/favicon.png">
|
<link rel="shortcut icon" href="/img/favicon.png">
|
||||||
|
7
client/themes/example.css
Normal file
7
client/themes/example.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* This is just an example theme and does not
|
||||||
|
* contain anything.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
port: 9000,
|
port: 9000,
|
||||||
public: true
|
public: true,
|
||||||
|
theme: "themes/example.css"
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
var Client = require("./client");
|
var Client = require("./client");
|
||||||
var config = require("../config") || {};
|
var config = require("../config") || {};
|
||||||
|
var fs = require("fs");
|
||||||
var http = require("connect");
|
var http = require("connect");
|
||||||
var io = require("socket.io");
|
var io = require("socket.io");
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ var inputs = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
module.exports = function() {
|
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) {
|
sockets.on("connect", function(socket) {
|
||||||
if (config.public) {
|
if (config.public) {
|
||||||
auth.call(socket);
|
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) {
|
function init(socket, client) {
|
||||||
if (!client) {
|
if (!client) {
|
||||||
socket.emit("auth");
|
socket.emit("auth");
|
||||||
|
16
package.json
16
package.json
@ -16,14 +16,14 @@
|
|||||||
"server"
|
"server"
|
||||||
],
|
],
|
||||||
"main": "http://localhost:9000/",
|
"main": "http://localhost:9000/",
|
||||||
"node-main": "./index.js",
|
"node-main": "./index.js",
|
||||||
"single-instance": false,
|
"single-instance": false,
|
||||||
"window": {
|
"window": {
|
||||||
"title": "Shout",
|
"title": "Shout",
|
||||||
"toolbar": false,
|
"toolbar": false,
|
||||||
"height": 640,
|
"height": 640,
|
||||||
"width": 1024
|
"width": 1024
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js"
|
"start": "node index.js"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user