Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit db52254

Browse files
maakbaasEisbaeeerjbanaszczyk
authored
1.7.1 (#93)
* Added German language * PYTHONEXE bugfix in case of spaces in path * add openssl path as a build flag * projectVersion in configuration * fixed fallback in index.js * Updated docs Co-authored-by: Lars Weimar <[email protected]> Co-authored-by: Jacek Banaszczyk <[email protected]>
1 parent 883ea9e commit db52254

File tree

8 files changed

+79
-26
lines changed

8 files changed

+79
-26
lines changed

docs/config-manager.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ An example of how this file could look is shown below:
130130

131131
Supported data types are: bool, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, float and char. The length argument is mandatory for datatype char to indicate the length of the string. Variable length strings are not supported. Also, arrays are not supported for now.
132132

133-
The configuration parameter `projectName` is unique in this framework. You can remove it, but if you use a parameter with this name, it will be shown as the header title in the web interface :).
133+
There are a few unique parameters:
134134

135-
The parameter named `language` is also unique and can be used to change the language of the web interface. Supported languages are placed in the folder `gui/js/lang`. Change the language code and rebuild the HTML interface to change the language. If your language is not yet supported, feel free to create a pull request for it.
135+
* The configuration parameter `projectName` is unique in this framework. You can remove it, but if you use a parameter with this name, it will be shown as the header title in the web interface :).
136+
* The parameter named `language` is also unique and can be used to change the language of the web interface. Supported languages are placed in the folder `gui/js/lang`. Change the language code and rebuild the HTML interface to change the language. If your language is not yet supported, feel free to create a pull request for it.
137+
* The parameter named `projectVersion` can be added to the configuration file, and will add this version string to the header of the web interface, and can of course be used in your code as well.
136138

137139
For this example, the pre-build python script `preBuildConfig.py` will generate the following two files. These should be fairly self explanatory and show how the JSON file is translated into a C struct.
138140

docs/fetch.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,11 @@ As mentioned earlier a full certificate store is saved in PROGMEM as part of the
147147

148148
If you ever want to update or rebuild the certificate store, you can do this by enabling or running the pre-build script `preBuildCertificates.py`. This script will read in all root certificates from the Mozilla certificate store and process these into a format that is compatible with the ESP8266 Arduino layer.
149149

150-
For this step OpenSSL is needed. On Linux this is probably available by default, on Windows this comes as part of something like MinGW, or Cygwin, but is also installed with the Windows Git client. If needed you can edit the path to OpenSSL at the top of the `preBuildCertificates.py` file:
150+
For this step OpenSSL is needed. On Linux this is probably available by default, on Windows this comes as part of something like MinGW, or Cygwin, but is also installed with the Windows Git client. If needed you can edit the path to OpenSSL by adding the build flag below to `platformio.ini`:
151151

152-
```c++
153-
#path to openssl
154-
openssl = "C:\\msys32\\usr\\bin\\openssl"
155-
```
156-
157-
Another prerequisite is that you need the Python module asn1crypto. Since currently PlatformIO uses its own internal Python version, this means you need to open a new PlatformIO terminal, and then execute the command:
152+
**-DOPENSSL="C:/Program Files/Git/usr/bin/openssl.exe"** Path to openssl executable. The location shown here is the default location. If your openssl is in a different location, change this flag accordingly
158153

159-
```
160-
pip install asn1crypto
161-
```
154+
Another prerequisite is the Python module asn1crypto. If this module is not available, the script will attempt to install it using `pip`.
162155

163156
## Certificate Store Size
164157

docs/installation-guide.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,9 @@ The build flags are optional, since all default generated artefacts are already
7979

8080
**-DREBUILD_CERTS:** This build step generates `certificates.h` containing a full root certificate store to enable arbitrary HTTPS requests with the ESP8266. More info on this process can be found [here](https://github.com/maakbaas/esp8266-iot-framework/blob/master/docs/fetch.md).
8181

82-
For this step OpenSSL is needed. On Linux this is probably available by default, on Windows this comes as part of something like MinGW, or Cygwin, but is also installed with the Windows Git client. If needed you can edit the path to OpenSSL at the top of the file:
82+
For this step OpenSSL is needed. On Linux this is probably available by default, on Windows this comes as part of something like MinGW, or Cygwin, but is also installed with the Windows Git client. If needed you can edit the path to OpenSSL with the next build flag
8383

84-
```python
85-
#path to openssl
86-
openssl = "C:\\msys32\\usr\\bin\\openssl"
87-
```
84+
**-DOPENSSL="C:/Program Files/Git/usr/bin/openssl.exe"** Path to openssl executable. The location shown here is the default location. If your openssl is in a different location, change this flag accordingly
8885

8986
**-DCONFIG_PATH=configuration.json:** This option defines a custom location for your configuration JSON file. This is needed when using the framework as a library, to allow you to define a JSON file in your project folder. The path is relative to the PlatformIO project root folder. More detail on the JSON file can be found [here](https://github.com/maakbaas/esp8266-iot-framework/blob/master/docs/config-manager.md).
9087

gui/js/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ function Root() {
6363
});
6464
}
6565

66-
const projectName = configData["projectName"] || Config.find(entry => entry.name === "projectName").value || "ESP8266";
66+
const projectName = configData["projectName"] || Config.find(entry => entry.name === "projectName") ? Config.find(entry => entry.name === "projectName").value : "ESP8266";
67+
const projectVersion = configData["projectVersion"] || Config.find(entry => entry.name === "projectVersion") ? Config.find(entry => entry.name === "projectVersion").value : "";
68+
6769
return <><GlobalStyle />
6870

6971
<BrowserRouter>
7072

7173
<Header>
72-
<h1><Box style={{verticalAlign:"-0.1em"}} /> {projectName}</h1>
74+
<h1><Box style={{verticalAlign:"-0.1em"}} /> {projectName} {projectVersion}</h1>
7375

7476
<Hamburger onClick={() => setMenu(!menu)} />
7577
<Menu className={menu ? "" : "menuHidden"}>

gui/js/lang/de.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"titleWifi": "WiFi Einstellungen",
3+
"titleDash": "Dashboard",
4+
"titleConf": "Konfiguration",
5+
"titleFile": "Datei Manager",
6+
"titleFw": "Firmware Update",
7+
"globalSave": "Speichern",
8+
"globalCancel": "Abbrechen",
9+
"globalContinue": "Weiter",
10+
"globalOk": "OK",
11+
"globalStatus": "Status",
12+
"globalBack": "Zurück",
13+
"wifiIP": "IP Addresse",
14+
"wifiSub": "Subnetz",
15+
"wifiGW": "Gateway",
16+
"wifiSSID": "SSID",
17+
"wifiPass": "Passwort",
18+
"wifiDNS": "DNS",
19+
"wifiDHCP": "DHCP",
20+
"wifiConn": "Verbunden mit",
21+
"wifiForget": "Zurücksetzen",
22+
"wifiUpdate": "Kennwort aktualisieren",
23+
"wifiCP": "Captive portal ist aktiv",
24+
"wifiModal1": "Bist du dir sicher? Beim fortsetzen wird ein Captive Portal gestartet.",
25+
"wifiModal2": "Bist du dir sicher? Beim fortsetzen wird die vorhandene Verbindung zum Netzwerk getrennt.",
26+
"dashEmpty": "Es sind keine Inhalte in der JSON-Datei definiert.",
27+
"dashLive": "LIVE",
28+
"dashConn": "VERBINDE",
29+
"dashDisconn": "GETRENNT",
30+
"filesEmpty": "Keine Dateien verfügbar",
31+
"filesDl": "Datei herunterladen",
32+
"filesRm": "Datei löschen",
33+
"filesFwTitle": "Datei auswählen",
34+
"filesTitle": "Datei Liste",
35+
"filesUsed": "Datei ausgewählt",
36+
"filesBtn": "Hochladen",
37+
"filesMsg1": "Das Hochladen ist fehlgeschlagen. Die Datei ist entweder zu gro&szlig; oder der Dateiname ist zu lang (>32).",
38+
"filesMsg2": "Die ausgewählte Datei hat ein falsches Format.",
39+
"fwSelect": "Auswählen",
40+
"fwFlash": "Schreiben",
41+
"fwReboot": "Neustart",
42+
"fwBtn": "Firmware aktualisieren",
43+
"fwBtn2": "Neu starten",
44+
"fwStep1a_preFilename": "Ausgewählte Datei",
45+
"fwStep1b_postFilename": "wird verwendet",
46+
"fwStep2a_preFilename": "Die Firmware",
47+
"fwStep2b_postFilename": "wurde hochgeladen",
48+
"fwStep2c": "Bitte warten, der Vorgang kann ein paar Minuten dauern. Gerät nicht ausschalten!",
49+
"fwStep3a_preFilename": "Die Firmware",
50+
"fwStep3b_postFilename": "wurde erfolgreich aktualisiert.",
51+
"fwStep3c": "Bitte das Gerät neu starten, damit die Firmware aktiv wird.",
52+
"fwModal1": "Bist du dir sicher? Beim Fortsetzen wird die aktuelle Firmware überschrieben.",
53+
"fwModal2": "Das Firmware update ist fehlgeschlagen.",
54+
"fwModal3": "Das Gerät startet neu. Bitte ein paar Sekunden warten und die Seite neu laden."
55+
}

platformio.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ extra_scripts = scripts/preBuild.py
2626
#available build flags:
2727
#-DREBUILD_HTML forces a rebuild of the html.h, this is needed if you make modifications to the GUI, or the configuration or dashboard JSON files
2828
#-DREBUILD_CERTS forces a rebuild of the root certificate store
29+
#-DOPENSSL="C:/Program Files/Git/usr/bin/openssl.exe" Path to openssl executable
2930
#-DREBUILD_CONFIG forces a rebuild of the configuration manager cpp files based on the JSON
3031
#-DREBUILD_DASHBOARD forces a rebuild of the dashboard cpp files based on the JSON
3132
#-DDOMAIN_LIST=google.com,maakbaas.com comma separated list of domain names to limit the certificates included
3233
#-DCONFIG_PATH=configuration.json defines a custom location for your JSON file
33-
#-DDASHBOARD_PATH=dashboard.json defines a custom location for your JSON file
34+
#-DDASHBOARD_PATH=dashboard.json defines a custom location for your JSON file

scripts/preBuild.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from shutil import copyfile
33
import subprocess
44
import inspect, os.path
5-
from os.path import join, realpath
65

76
#auto install asn1crypto if not defined
87
try:
@@ -11,7 +10,7 @@
1110
Import('env')
1211
env.Execute(
1312
env.VerboseAction(
14-
'$PYTHONEXE -m pip install "asn1crypto" ',
13+
'"$PYTHONEXE" -m pip install "asn1crypto" ',
1514
"ASN1 crypto import failed, installing.",
1615
)
1716
)
@@ -29,6 +28,7 @@
2928
config = False
3029
dash = False
3130
certs = False
31+
openssl = None
3232

3333
# private library flags
3434
domains = ''
@@ -49,6 +49,8 @@
4949
copyfile(env.get("PROJECT_DIR") + '/' + item[1], '../gui/js/dashboard.json')
5050
elif isinstance(item, tuple) and item[0] == "DOMAIN_LIST":
5151
domains = item[1]
52+
elif isinstance(item, tuple) and item[0].lower() == "openssl":
53+
openssl = item[1]
5254

5355
if html:
5456
preBuildHTMLFun()
@@ -57,6 +59,6 @@
5759
if dash:
5860
preBuildDashFun()
5961
if certs:
60-
preBuildCertificatesFun(domains)
62+
preBuildCertificatesFun(domains, openssl)
6163

6264

scripts/preBuildCertificates.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
from ssl import SSLContext # Modern SSL?
2525
from ssl import HAS_SNI # Has SNI?
2626

27-
def preBuildCertificatesFun(domains):
27+
def preBuildCertificatesFun(domains, openssl):
2828

29-
print('Start building certificate store', flush=True)
29+
print('Start building certificate store', flush=True)
3030

3131
allDomains = True
3232

@@ -43,7 +43,8 @@ def preBuildCertificatesFun(domains):
4343
dir_path = os.path.dirname(os.path.abspath(filename))
4444

4545
#path to openssl
46-
openssl = "C:/msys32/usr/bin/openssl"
46+
if openssl is None:
47+
openssl = "C:/Program Files/Git/usr/bin/openssl.exe"
4748

4849
# below script content is adapted from:
4950
# https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py

0 commit comments

Comments
 (0)