mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #1915 from normankong/develop
Support HTTPS Magicmirror (resubmit)
This commit is contained in:
commit
30e93a9372
@ -19,6 +19,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Added the ability to hide the temp label and weather icon in the `currentweather` module to allow showing only information such as wind and sunset/rise.
|
- Added the ability to hide the temp label and weather icon in the `currentweather` module to allow showing only information such as wind and sunset/rise.
|
||||||
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
|
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
|
||||||
- Added Hebrew translation.
|
- Added Hebrew translation.
|
||||||
|
- Add HTTPS support and update config.js.sample
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Force declaration of public ip adress in config file (ISSUE #1852)
|
- Force declaration of public ip adress in config file (ISSUE #1852)
|
||||||
|
@ -21,6 +21,10 @@ var config = {
|
|||||||
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
|
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
|
||||||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
|
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
|
||||||
|
|
||||||
|
useHttps: false, // Support HTTPS or not, default "false" will use HTTP
|
||||||
|
httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true
|
||||||
|
httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true
|
||||||
|
|
||||||
language: "en",
|
language: "en",
|
||||||
timeFormat: 24,
|
timeFormat: 24,
|
||||||
units: "metric",
|
units: "metric",
|
||||||
|
14
js/server.js
14
js/server.js
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
var express = require("express");
|
var express = require("express");
|
||||||
var app = require("express")();
|
var app = require("express")();
|
||||||
var server = require("http").Server(app);
|
|
||||||
var io = require("socket.io")(server);
|
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var ipfilter = require("express-ipfilter").IpFilter;
|
var ipfilter = require("express-ipfilter").IpFilter;
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
@ -22,6 +20,18 @@ var Server = function(config, callback) {
|
|||||||
port = process.env.MM_PORT;
|
port = process.env.MM_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var server = null;
|
||||||
|
if(config.useHttps){
|
||||||
|
var options = {
|
||||||
|
key: fs.readFileSync(config.httpsPrivateKey),
|
||||||
|
cert: fs.readFileSync(config.httpsCertificate)
|
||||||
|
}
|
||||||
|
server = require("https").Server(options, app);
|
||||||
|
}else{
|
||||||
|
server = require("http").Server(app);
|
||||||
|
}
|
||||||
|
var io = require("socket.io")(server);
|
||||||
|
|
||||||
console.log("Starting server on port " + port + " ... ");
|
console.log("Starting server on port " + port + " ... ");
|
||||||
|
|
||||||
server.listen(port, config.address ? config.address : "localhost");
|
server.listen(port, config.address ? config.address : "localhost");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
var app = require("../js/app.js");
|
var app = require("../js/app.js");
|
||||||
app.start(function(config) {
|
app.start(function(config) {
|
||||||
var bindAddress = config.address ? config.address : "localhost";
|
var bindAddress = config.address ? config.address : "localhost";
|
||||||
console.log("\nReady to go! Please point your browser to: http://" + bindAddress + ":" + config.port);
|
var httpType = config.useHttps ? "https" : "http";
|
||||||
|
console.log("\nReady to go! Please point your browser to: " + httpType + "://" + bindAddress + ":" + config.port);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user