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

Commit

Permalink
1.7.1 (#93)
Browse files Browse the repository at this point in the history
* 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 <Eisbaeeer@gmail.com>
Co-authored-by: Jacek Banaszczyk <jacek.banaszczyk@gmail.com>
  • Loading branch information
3 people authored Mar 6, 2021
1 parent 883ea9e commit db52254
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 26 deletions.
6 changes: 4 additions & 2 deletions docs/config-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ An example of how this file could look is shown below:

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.

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 :).
There are a few unique parameters:

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.
* 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 :).
* 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.
* 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.

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.

Expand Down
13 changes: 3 additions & 10 deletions docs/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,11 @@ As mentioned earlier a full certificate store is saved in PROGMEM as part of the

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.

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:
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`:

```c++
#path to openssl
openssl = "C:\\msys32\\usr\\bin\\openssl"
```

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:
**-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

```
pip install asn1crypto
```
Another prerequisite is the Python module asn1crypto. If this module is not available, the script will attempt to install it using `pip`.

## Certificate Store Size

Expand Down
7 changes: 2 additions & 5 deletions docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,9 @@ The build flags are optional, since all default generated artefacts are already

**-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).

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:
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

```python
#path to openssl
openssl = "C:\\msys32\\usr\\bin\\openssl"
```
**-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

**-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).

Expand Down
6 changes: 4 additions & 2 deletions gui/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ function Root() {
});
}

const projectName = configData["projectName"] || Config.find(entry => entry.name === "projectName").value || "ESP8266";
const projectName = configData["projectName"] || Config.find(entry => entry.name === "projectName") ? Config.find(entry => entry.name === "projectName").value : "ESP8266";
const projectVersion = configData["projectVersion"] || Config.find(entry => entry.name === "projectVersion") ? Config.find(entry => entry.name === "projectVersion").value : "";

return <><GlobalStyle />

<BrowserRouter>

<Header>
<h1><Box style={{verticalAlign:"-0.1em"}} /> {projectName}</h1>
<h1><Box style={{verticalAlign:"-0.1em"}} /> {projectName} {projectVersion}</h1>

<Hamburger onClick={() => setMenu(!menu)} />
<Menu className={menu ? "" : "menuHidden"}>
Expand Down
55 changes: 55 additions & 0 deletions gui/js/lang/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"titleWifi": "WiFi Einstellungen",
"titleDash": "Dashboard",
"titleConf": "Konfiguration",
"titleFile": "Datei Manager",
"titleFw": "Firmware Update",
"globalSave": "Speichern",
"globalCancel": "Abbrechen",
"globalContinue": "Weiter",
"globalOk": "OK",
"globalStatus": "Status",
"globalBack": "Zurück",
"wifiIP": "IP Addresse",
"wifiSub": "Subnetz",
"wifiGW": "Gateway",
"wifiSSID": "SSID",
"wifiPass": "Passwort",
"wifiDNS": "DNS",
"wifiDHCP": "DHCP",
"wifiConn": "Verbunden mit",
"wifiForget": "Zurücksetzen",
"wifiUpdate": "Kennwort aktualisieren",
"wifiCP": "Captive portal ist aktiv",
"wifiModal1": "Bist du dir sicher? Beim fortsetzen wird ein Captive Portal gestartet.",
"wifiModal2": "Bist du dir sicher? Beim fortsetzen wird die vorhandene Verbindung zum Netzwerk getrennt.",
"dashEmpty": "Es sind keine Inhalte in der JSON-Datei definiert.",
"dashLive": "LIVE",
"dashConn": "VERBINDE",
"dashDisconn": "GETRENNT",
"filesEmpty": "Keine Dateien verfügbar",
"filesDl": "Datei herunterladen",
"filesRm": "Datei löschen",
"filesFwTitle": "Datei auswählen",
"filesTitle": "Datei Liste",
"filesUsed": "Datei ausgewählt",
"filesBtn": "Hochladen",
"filesMsg1": "Das Hochladen ist fehlgeschlagen. Die Datei ist entweder zu gro&szlig; oder der Dateiname ist zu lang (>32).",
"filesMsg2": "Die ausgewählte Datei hat ein falsches Format.",
"fwSelect": "Auswählen",
"fwFlash": "Schreiben",
"fwReboot": "Neustart",
"fwBtn": "Firmware aktualisieren",
"fwBtn2": "Neu starten",
"fwStep1a_preFilename": "Ausgewählte Datei",
"fwStep1b_postFilename": "wird verwendet",
"fwStep2a_preFilename": "Die Firmware",
"fwStep2b_postFilename": "wurde hochgeladen",
"fwStep2c": "Bitte warten, der Vorgang kann ein paar Minuten dauern. Gerät nicht ausschalten!",
"fwStep3a_preFilename": "Die Firmware",
"fwStep3b_postFilename": "wurde erfolgreich aktualisiert.",
"fwStep3c": "Bitte das Gerät neu starten, damit die Firmware aktiv wird.",
"fwModal1": "Bist du dir sicher? Beim Fortsetzen wird die aktuelle Firmware überschrieben.",
"fwModal2": "Das Firmware update ist fehlgeschlagen.",
"fwModal3": "Das Gerät startet neu. Bitte ein paar Sekunden warten und die Seite neu laden."
}
3 changes: 2 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ extra_scripts = scripts/preBuild.py
#available build flags:
#-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
#-DREBUILD_CERTS forces a rebuild of the root certificate store
#-DOPENSSL="C:/Program Files/Git/usr/bin/openssl.exe" Path to openssl executable
#-DREBUILD_CONFIG forces a rebuild of the configuration manager cpp files based on the JSON
#-DREBUILD_DASHBOARD forces a rebuild of the dashboard cpp files based on the JSON
#-DDOMAIN_LIST=google.com,maakbaas.com comma separated list of domain names to limit the certificates included
#-DCONFIG_PATH=configuration.json defines a custom location for your JSON file
#-DDASHBOARD_PATH=dashboard.json defines a custom location for your JSON file
#-DDASHBOARD_PATH=dashboard.json defines a custom location for your JSON file
8 changes: 5 additions & 3 deletions scripts/preBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from shutil import copyfile
import subprocess
import inspect, os.path
from os.path import join, realpath

#auto install asn1crypto if not defined
try:
Expand All @@ -11,7 +10,7 @@
Import('env')
env.Execute(
env.VerboseAction(
'$PYTHONEXE -m pip install "asn1crypto" ',
'"$PYTHONEXE" -m pip install "asn1crypto" ',
"ASN1 crypto import failed, installing.",
)
)
Expand All @@ -29,6 +28,7 @@
config = False
dash = False
certs = False
openssl = None

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

if html:
preBuildHTMLFun()
Expand All @@ -57,6 +59,6 @@
if dash:
preBuildDashFun()
if certs:
preBuildCertificatesFun(domains)
preBuildCertificatesFun(domains, openssl)


7 changes: 4 additions & 3 deletions scripts/preBuildCertificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from ssl import SSLContext # Modern SSL?
from ssl import HAS_SNI # Has SNI?

def preBuildCertificatesFun(domains):
def preBuildCertificatesFun(domains, openssl):

print('Start building certificate store', flush=True)
print('Start building certificate store', flush=True)

allDomains = True

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

#path to openssl
openssl = "C:/msys32/usr/bin/openssl"
if openssl is None:
openssl = "C:/Program Files/Git/usr/bin/openssl.exe"

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

0 comments on commit db52254

Please sign in to comment.