mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
ip address filtering
This commit is contained in:
parent
4ff86795b9
commit
5d29fa5e62
@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Added
|
||||
- Method to overwrite the module's header. [See documentation.](https://github.com/MichMich/MagicMirror/tree/develop/modules#getheader)
|
||||
- Option to limit access to certain IP addresses based on the value of `ipWhitelist` in the `config.js`, default is access from localhost only (Issue [#456](https://github.com/MichMich/MagicMirror/issues/456))
|
||||
|
||||
### Updated
|
||||
- Modified translations for Frysk.
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ['127.0.0.1', '::ffff:127.0.0.1'],
|
||||
// you use ips with subnet mask: ['127.0.0.1', '127.0.0.1/24']
|
||||
// you use also use ip ranges: ['127.0.0.1', ['192.168.0.1', '192.168.0.100']]
|
||||
|
||||
language: 'en',
|
||||
timeFormat: 24,
|
||||
|
@ -10,11 +10,17 @@ var app = require("express")();
|
||||
var server = require("http").Server(app);
|
||||
var io = require("socket.io")(server);
|
||||
var path = require("path");
|
||||
var ipfilter = require('express-ipfilter').IpFilter;
|
||||
|
||||
var Server = function(config, callback) {
|
||||
console.log("Starting server op port " + config.port + " ... ");
|
||||
|
||||
server.listen(config.port);
|
||||
if (config.ipWhitelist === undefined) {
|
||||
config.ipWhitelist = ['127.0.0.1', '::ffff:127.0.0.1'];
|
||||
console.log("Warning: Missing value (ipWhitelist) from config.js, assuming default (localhost access only): " + config.ipWhitelist);
|
||||
}
|
||||
app.use(ipfilter(config.ipWhitelist, {mode: 'allow', log: false}));
|
||||
app.use("/js", express.static(__dirname));
|
||||
app.use("/config", express.static(path.resolve(__dirname + "/../config")));
|
||||
app.use("/css", express.static(path.resolve(__dirname + "/../css")));
|
||||
|
@ -39,6 +39,7 @@
|
||||
"dependencies": {
|
||||
"electron-prebuilt": "^0.37.2",
|
||||
"express": "^4.14.0",
|
||||
"express-ipfilter": "latest",
|
||||
"feedme": "latest",
|
||||
"iconv-lite": "latest",
|
||||
"moment": "latest",
|
||||
|
Loading…
x
Reference in New Issue
Block a user