From bea6b211cbb5edc6dc638b83b99783acc49397f0 Mon Sep 17 00:00:00 2001 From: carsifreifunk Date: Sat, 19 Aug 2017 16:36:04 +0200 Subject: [PATCH 01/51] Create config-schema.json --- config-schema.json | 160 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 config-schema.json diff --git a/config-schema.json b/config-schema.json new file mode 100644 index 0000000..cb9da64 --- /dev/null +++ b/config-schema.json @@ -0,0 +1,160 @@ + + +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": {}, + "id": "http://example.com/example.json", + "properties": { + "contact": { + "id": "/properties/contact", + "properties": { + "email": { + "id": "/properties/contact/properties/email", + "type": "string" + }, + "name": { + "description": "Nodemaintainer ", + "id": "/properties/contact/properties/name", + "type": "string" + }, + "sendToMap": { + "description": "Send entered email contact to Freifunkmap", + "id": "/properties/contact/properties/sendToMap", + "type": "boolean" + }, + "showOnContactPage": { + "id": "/properties/contact/properties/showOnContactPage", + "type": "boolean" + } + }, + "type": "object" + }, + "internet": { + "id": "/properties/internet", + "properties": { + "share": { + "id": "/properties/internet/properties/share", + "type": "boolean" + }, + "speedLimit": { + "id": "/properties/internet/properties/speedLimit", + "type": "boolean" + }, + "speedLimitDown": { + "id": "/properties/internet/properties/speedLimitDown", + "type": "number" + }, + "speedLimitUp": { + "id": "/properties/internet/properties/speedLimitUp", + "type": "number" + } + }, + "type": "object" + }, + "ip": { + "id": "/properties/ip", + "properties": { + "distribute": { + "description": "Distribute IP addresses to clients", + "id": "/properties/ip/properties/distribute", + "title": "", + "type": "boolean" + }, + "meshLan": { + "id": "/properties/ip/properties/meshLan", + "type": "boolean" + }, + "v4": { + "id": "/properties/ip/properties/v4", + "properties": { + "lan": { + "description": "mesh IP for LAN (Lanmesh)", + "id": "/properties/ip/properties/v4/properties/lan", + "type": "string" + }, + "radio0": { + "id": "/properties/ip/properties/v4/properties/radio0", + "type": "string" + }, + "radio1": { + "id": "/properties/ip/properties/v4/properties/radio1", + "type": "string" + } + }, + "type": "object" + }, + "v4ClientSubnet": { + "id": "/properties/ip/properties/v4ClientSubnet", + "type": "string" + }, + "v6Prefix": { + "id": "/properties/ip/properties/v6Prefix", + "type": "string" + } + }, + "type": "object" + }, + "location": { + "id": "/properties/location", + "properties": { + "city": { + "id": "/properties/location/properties/city", + "type": "string" + }, + "lat": { + "id": "/properties/location/properties/lat", + "type": "number" + }, + "lng": { + "description": "alternative lon", + "id": "/properties/location/properties/lng", + "type": "number" + }, + "postalCode": { + "id": "/properties/location/properties/postalCode", + "type": "string" + }, + "street": { + "id": "/properties/location/properties/street", + "type": "string" + } + }, + "type": "object" + }, + "monitoring": { + "id": "/properties/monitoring", + "properties": { + "enabled": { + "description": "", + "id": "/properties/monitoring/properties/enabled", + "type": "boolean" + } + }, + "type": "object" + }, + "router": { + "id": "/properties/router", + "properties": { + "name": { + "id": "/properties/router/properties/name", + "type": "string" + }, + "passwordHash": { + "id": "/properties/router/properties/passwordHash", + "type": "string" + }, + "sshkeys": { + "id": "/properties/router/properties/sshkeys", + "items": { + "id": "/properties/router/properties/sshkeys/items", + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "type": "object" +} + From 6a38f9f4cef9a83a3df0aab56ab86c6e0d1f75a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=A4u?= Date: Sat, 19 Aug 2017 14:39:53 +0200 Subject: [PATCH 02/51] update dependencies --- package.json | 4 +++- webpack.config.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 33c45fa..1a1565d 100644 --- a/package.json +++ b/package.json @@ -51,13 +51,15 @@ "angular-bootstrap": "^0.12.2", "angular-messages": "^1.6.1", "angular-sanitize": "^1.6.1", + "angular-simple-logger": "^0.1.7", "angular-translate": "^2.13.1", "angular-translate-loader-static-files": "^2.13.1", "angular-ui-bootstrap": "^2.4.0", - "angular-ui-router": "^1.0.0-beta.3", + "@uirouter/angularjs": "^1.0.6", "bootstrap": "^3.3.7", "font-awesome": "^4.7.0", "ip-address": "^5.0.2", + "leaflet": "^1.2.0", "nano-md5": "^1.0.3", "ssh-pub-key-validation": "^1.0.0", "ui-leaflet": "^2.0.0" diff --git a/webpack.config.js b/webpack.config.js index 010175e..8aef058 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -68,7 +68,7 @@ module.exports = { // less to css test: /\.less$/, loader: extractCss.extract({ - loader: ['css-loader?sourceMap', 'less-loader?sourceMap'], + use: ['css-loader?sourceMap', 'less-loader?sourceMap'], }), }, { From 7eef022c15f29161d9cbab79b749d84ac7451c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=A4u?= Date: Sat, 19 Aug 2017 14:44:40 +0200 Subject: [PATCH 03/51] rename antistoererhaftung to internettunnel --- src/components/wizard-internet/wizard-internet.html | 6 +++--- src/nls/locale-de.json | 2 +- src/nls/locale-en.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/wizard-internet/wizard-internet.html b/src/components/wizard-internet/wizard-internet.html index 55334ff..ee0b0e8 100644 --- a/src/components/wizard-internet/wizard-internet.html +++ b/src/components/wizard-internet/wizard-internet.html @@ -100,9 +100,9 @@

-
+
@@ -110,7 +110,7 @@

- .antistoererhaftung.help + .internettunnel.help

diff --git a/src/nls/locale-de.json b/src/nls/locale-de.json index 796b30c..2b8c628 100644 --- a/src/nls/locale-de.json +++ b/src/nls/locale-de.json @@ -138,7 +138,7 @@ "help": "Upload Transfer Limit in Mbit/s." } }, - "antistoererhaftung": { + "internettunnel": { "label": "VPN", "help": "Leitet deinen Internetverkehr über einen Tunnel zu einem anderen Server weiter." }, diff --git a/src/nls/locale-en.json b/src/nls/locale-en.json index 3cbc5cd..e3c9bc4 100644 --- a/src/nls/locale-en.json +++ b/src/nls/locale-en.json @@ -148,7 +148,7 @@ "help": "Upload transfer limit in Mbit/s." } }, - "antistoererhaftung": { + "internettunnel": { "label": "VPN", "help": "Tunnels your internet traffic to a different server." }, From 6e4e24492e000cbce22d6660ab7da6e2e75b99d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=A4u?= Date: Sat, 19 Aug 2017 18:00:51 +0200 Subject: [PATCH 04/51] add vpn config for internet tunnel --- .../load-file-button/load-file-button.js | 20 +- .../wizard-internet/wizard-internet.html | 193 ++++++++---------- .../wizard-internet/wizard-internet.js | 18 ++ src/nls/locale-en.json | 24 ++- 4 files changed, 149 insertions(+), 106 deletions(-) diff --git a/src/components/load-file-button/load-file-button.js b/src/components/load-file-button/load-file-button.js index 6feb719..8e4e401 100644 --- a/src/components/load-file-button/load-file-button.js +++ b/src/components/load-file-button/load-file-button.js @@ -6,6 +6,7 @@ export default module('app.components.load-file-button', []) .component('loadFileButton', { bindings: { accept: '@', + base64: '@', onDismiss: '&', onLoaded: '&', }, @@ -22,9 +23,24 @@ export default module('app.components.load-file-button', []) if (!event.target.files || event.target.files.length === 0) return; const reader = new this.$window.FileReader(); reader.onload = frEvent => this.$scope.$apply(() => { - this.onLoaded({content: frEvent.target.result}); + if (this.base64) { + this.onLoaded({content: frEvent.target.result.split(',')[1]}); + } else { + this.onLoaded({content: frEvent.target.result}); + } }); - reader.readAsText(event.target.files[0]); + if (this.base64) { + reader.readAsDataURL(event.target.files[0]); + } else { + reader.readAsText(event.target.files[0]); + } + } + + removeBase64TypeString(contentString) { + if (this.base64) { + return contentString.split(',')[1]; + } + return contentString.result; } }, template: require('./load-file-button.html'), diff --git a/src/components/wizard-internet/wizard-internet.html b/src/components/wizard-internet/wizard-internet.html index ee0b0e8..82a0262 100644 --- a/src/components/wizard-internet/wizard-internet.html +++ b/src/components/wizard-internet/wizard-internet.html @@ -98,9 +98,9 @@

- + -
+
@@ -108,121 +108,108 @@

-
+
-
+
-
-
- -
-
- .conf.select -

 {{wizard.internet.vpn.conf.filename}} - -
-
-
- .conf.error.pattern -
-
-
+
+
+
+ + + .conf.select +
-
-
-
- -
-
- .certificate.select -

 {{wizard.internet.vpn.cert.filename}} - -
-
-
- .cert.error.pattern -
-
-
+
+
+ + + .certificate.select +
-
-
-
- -
-
- .key.select -

 {{wizard.internet.vpn.key.filename}} - -
-
-
- .key.error.pattern -
-
-
+
+
+ + + .cacertificate.select + +
+
+
+
+ + + .key.select + +
+
+
+
+ + + .takey.select +
-
-
- -
-
- .takey.select -

 {{wizard.internet.vpn.takey.filename}} - -
-
-
- .takey.error.pattern -
-
-
+
+
+ .secrethelp +
+
+
+
+
+ + + .secret.select + +
+
+
+
+ + + .authuserpass.select +
@@ -243,7 +230,7 @@

- +
diff --git a/src/components/wizard-internet/wizard-internet.js b/src/components/wizard-internet/wizard-internet.js index 111db87..ec14e16 100644 --- a/src/components/wizard-internet/wizard-internet.js +++ b/src/components/wizard-internet/wizard-internet.js @@ -1,5 +1,7 @@ import { copy, module } from 'angular'; +const OPENVPN = 'openvpn'; + export default module('app.components.wizard-internet', []) .component('wizardInternet', { bindings: { @@ -8,6 +10,7 @@ export default module('app.components.wizard-internet', []) }, // TODO: handle vpn controller: class WizardContactCtrl { + constructor($scope) { 'ngInject'; @@ -21,6 +24,18 @@ export default module('app.components.wizard-internet', []) copy(internet, this.newInternet); } + uploadOpenvpnContent(content, type) { + if (!this.newInternet.tunnel) { + this.newInternet.tunnel = {}; + } + this.newInternet.tunnel.type = OPENVPN; + this.uploadContent(content, type); + } + + uploadContent(content, type) { + this.newInternet.tunnel[type] = content; + } + updateOutput(newInternet) { let internet = copy(newInternet); if (!internet.share) { @@ -31,6 +46,9 @@ export default module('app.components.wizard-internet', []) delete internet.speedLimitDown; delete internet.speedLimitUp; } + if (!internet.tunnel || !internet.tunnel.enabled) { + delete internet.tunnel; + } this.onUpdate({internet}); } }, diff --git a/src/nls/locale-en.json b/src/nls/locale-en.json index e3c9bc4..bfd4106 100644 --- a/src/nls/locale-en.json +++ b/src/nls/locale-en.json @@ -156,9 +156,10 @@ "label": "Mesh VPN", "help": "Connects mesh clouds via internet tunnel. (Use, if your router is not connected to the backbone via radio.)" }, - "generateCertificate": { + "tunnel": { "label": "VPN certificate and key for this router", "help": "The Förderverein Freie Netzwerke operates the VPN03 servers for protecting yourself from the Störerhaftung. If this option is enabled, the wizard automatically generates a new certificate and key for VPN03. Disable this option if you already have a VPN03 config or if you want to use another VPN service (OpenVPN).", + "secrethelp": "If you use password authentication instead of certificates, upload your secrets here:", "certificate": { "label": "VPN certificate", "select": ".cert file", @@ -180,6 +181,27 @@ "pattern": "Wrong file format or name. Only text files are allowed." } }, + "cacertificate": { + "label": "CA Certificate", + "select": ".cert file", + "error": { + "pattern": "Wrong file format or name. Only text files are allowed." + } + }, + "secret": { + "label": "VPN secret", + "select": "secret file", + "error": { + "pattern": "Wrong file format or name. Only text files are allowed." + } + }, + "authuserpass": { + "label": "Auth User pass", + "select": "auth user pass file", + "error": { + "pattern": "Wrong file format or name. Only text files are allowed." + } + }, "conf": { "label": "VPN configuration file", "select": ".ovpn file", From d45aab8ac19cc9f8f14190655b6cb80efc662e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=A4u?= Date: Sat, 19 Aug 2017 18:17:51 +0200 Subject: [PATCH 05/51] fixes package names --- src/components/home/home.js | 2 +- src/components/status-olsr/status-olsr.js | 2 +- src/components/status-system/status-system.js | 2 +- src/components/wizard/wizard.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/home/home.js b/src/components/home/home.js index 310343b..c1d3333 100644 --- a/src/components/home/home.js +++ b/src/components/home/home.js @@ -1,5 +1,5 @@ import { module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; export default module('app.components.home', [uiRouter]) .config(($stateProvider) => { diff --git a/src/components/status-olsr/status-olsr.js b/src/components/status-olsr/status-olsr.js index ed268bd..3756c16 100644 --- a/src/components/status-olsr/status-olsr.js +++ b/src/components/status-olsr/status-olsr.js @@ -1,5 +1,5 @@ import { module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; export default module('app.components.status-olsr', [uiRouter]) .config(($stateProvider) => { diff --git a/src/components/status-system/status-system.js b/src/components/status-system/status-system.js index 73cc005..766af0b 100644 --- a/src/components/status-system/status-system.js +++ b/src/components/status-system/status-system.js @@ -1,5 +1,5 @@ import { module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; require('./status-system.less'); diff --git a/src/components/wizard/wizard.js b/src/components/wizard/wizard.js index d6455c9..57e6bb4 100644 --- a/src/components/wizard/wizard.js +++ b/src/components/wizard/wizard.js @@ -1,5 +1,5 @@ import { copy, module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; require('./wizard.less'); From 4cbd09a6bd139ef875eb2689a3e3b87716af8123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=A4u?= Date: Sat, 19 Aug 2017 18:38:04 +0200 Subject: [PATCH 06/51] add required keyword --- .../load-file-button/load-file-button.html | 2 +- .../load-file-button/load-file-button.js | 1 + .../wizard-internet/wizard-internet.html | 20 +++++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/load-file-button/load-file-button.html b/src/components/load-file-button/load-file-button.html index 9d65de8..e644369 100644 --- a/src/components/load-file-button/load-file-button.html +++ b/src/components/load-file-button/load-file-button.html @@ -1,4 +1,4 @@ diff --git a/src/components/load-file-button/load-file-button.js b/src/components/load-file-button/load-file-button.js index 8e4e401..bbf5434 100644 --- a/src/components/load-file-button/load-file-button.js +++ b/src/components/load-file-button/load-file-button.js @@ -7,6 +7,7 @@ export default module('app.components.load-file-button', []) bindings: { accept: '@', base64: '@', + required: '@', onDismiss: '&', onLoaded: '&', }, diff --git a/src/components/wizard-internet/wizard-internet.html b/src/components/wizard-internet/wizard-internet.html index 82a0262..8d28939 100644 --- a/src/components/wizard-internet/wizard-internet.html +++ b/src/components/wizard-internet/wizard-internet.html @@ -123,15 +123,31 @@

+ ng-class="{ + 'has-success': (ipForm.ipv6Prefix | fieldSuccess), + 'has-error': (ipForm.ipv6Prefix | fieldError), + }"> .conf.select +
+
+
+
+ .conf.error.pattern +
+
+
-
- +

-
-
-
-

- - .shareInternet.thanks -

-
-
- - -
- -
-
-
-
- -
- -
-
- -
-
- -
-
-
-
- .help -
+
+
+
-
-
- -
.down.help
-
-
- -
.up.help
-
-
-
-
-
-
- - - - -
- -
-
- -
-
+ -
- -
-
+
-
-
- - - .conf.select - - -
-
-
-
- .conf.error.pattern -
-
-
-
-
-
- - - .certificate.select - -
-
-
-
- - - .cacertificate.select - -
-
-
-
- - - .key.select - -
-
-
-
- - - .takey.select - +
+

+ + .shareInternet.thanks +

-
-
-
- .secrethelp -
-
-
-
-
- - - .secret.select - -
-
-
-
- - - .authuserpass.select - + + +
+ +
+
+ +
-
-
-
-
-
-
- - - .showlist -
-
-
    - .list -
-
-
-
-
- - -
- -
-
- -
-
-
+
-
+
+
-
-
-
-
- -
-
- .conf.select -

 {{wizard.internet.meshvpn.conf.filename}} - -
-
-
- .conf.error.pattern -
+
+
+ +
+
+
+
+ .help +
+
+
+
+ +
.down.help
+
+
+ +
.up.help
+
+
+
+
-
-
-
-
-