Added https support
This commit is contained in:
parent
4c94a67d49
commit
3e22b6e88a
34
config.js
34
config.js
|
@ -159,5 +159,39 @@ module.exports = {
|
|||
// @default "#foo, #shout-irc"
|
||||
//
|
||||
join: "#foo, #shout-irc"
|
||||
},
|
||||
|
||||
//
|
||||
// Run Shout with HTTPS support.
|
||||
//
|
||||
// @type object
|
||||
// @default {}
|
||||
//
|
||||
https: {
|
||||
//
|
||||
// Enable HTTPS support.
|
||||
//
|
||||
// @type boolean
|
||||
// @default false
|
||||
//
|
||||
enable: false,
|
||||
|
||||
//
|
||||
// Path to the key.
|
||||
//
|
||||
// @type string
|
||||
// @example "sslcert/key.pem"
|
||||
// @default ""
|
||||
//
|
||||
key: "",
|
||||
|
||||
//
|
||||
// Path to the certificate.
|
||||
//
|
||||
// @type string
|
||||
// @example "sslcert/key-cert.pem"
|
||||
// @default ""
|
||||
//
|
||||
certificate: ""
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "shout",
|
||||
"description": "The self-hosted web IRC client",
|
||||
"version": "0.36.0",
|
||||
"version": "0.37.0",
|
||||
"author": "Mattias Erming",
|
||||
"preferGlobal": true,
|
||||
"bin": {
|
||||
|
|
|
@ -19,10 +19,24 @@ module.exports = function(port, host, isPublic) {
|
|||
var app = express()
|
||||
.use(index)
|
||||
.use(express.static("client"))
|
||||
.use(express.static(Helper.resolveHomePath("cache")))
|
||||
.listen(config.port, config.host);
|
||||
.use(express.static(Helper.resolveHomePath("cache")));
|
||||
|
||||
sockets = io(app);
|
||||
var server = null;
|
||||
var https = config.https || {};
|
||||
var protocol = https.enable ? "https" : "http";
|
||||
|
||||
if (!https.enable){
|
||||
server = require("http");
|
||||
server = server.createServer(app).listen(port, host);
|
||||
} else {
|
||||
server = require("https");
|
||||
server = server.createServer({
|
||||
key: fs.readFileSync(https.key),
|
||||
cert: fs.readFileSync(https.certificate)
|
||||
}, app).listen(port, host)
|
||||
}
|
||||
|
||||
sockets = io(server);
|
||||
sockets.on("connect", function(socket) {
|
||||
if (config.public) {
|
||||
auth.call(socket);
|
||||
|
@ -34,7 +48,7 @@ module.exports = function(port, host, isPublic) {
|
|||
manager.sockets = sockets;
|
||||
|
||||
console.log("");
|
||||
console.log("Shout is now running on http://" + config.host + ":" + config.port + "/");
|
||||
console.log("Shout is now running on " + protocol + "://" + config.host + ":" + config.port + "/");
|
||||
console.log("Press ctrl-c to stop");
|
||||
console.log("");
|
||||
|
||||
|
|
Loading…
Reference in New Issue