Skip to content

Commit fd1a58e

Browse files
authored
Merge pull request #17 from theelims/psychichttp
Exchange ESPAsyncWebserver with PsychicHttp
2 parents 25eb90b + f81f81e commit fd1a58e

File tree

144 files changed

+25195
-2576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+25195
-2576
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.gcc-flags.json
44
*Thumbs.db
55
/data/www
6-
/lib/framework/WWWData.h
76
/interface/build
87
/interface/node_modules
98
/interface/.eslintcache
@@ -12,4 +11,8 @@ node_modules
1211
/releases
1312
/src/certs
1413
/temp
15-
14+
/build/firmware
15+
/lib/framework/WWWData.h
16+
*WWWData.h
17+
lib/framework/WWWData.h
18+
ssl_certs/cacert.pem

CHANGELOG.md

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,114 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [0.2.2]
5+
## [0.3.0] - 2023-02-05
6+
7+
> [!CAUTION]
8+
> This update has breaking changes!
9+
10+
This is a major change getting rid of all ESPAsyncTCP and ESPAsyncWebserver dependencies. Despite their popularity they are plagued with countless bugs, since years unmaintained, not SSL capable and simply not suitable for a production build. Although several attempts exist to fix the most pressing bugs even these libraries lead to frequent crashes. This new version replaces them with ESP-IDF based components. [PsychicHttp](https://github.com/hoeken/PsychicHttp) and [PsychicMqttClient](https://github.com/theelims/PsychicMqttClient) both wrap the ESP-IDF components in a familiar wrapper for easy porting of the code base. However, this will break existing code and will require some effort on your codebase. In return the stability is improved greatly and the RAM usage more friendly. Now e.g. running Bluetooth in parallel becomes possible.
11+
12+
### Added
13+
14+
- Added postscript to platform.io build process to copy, rename and calculate MD5 checksum of \*.bin file. These files are ready for uploading to the Github Release page.
15+
- Added more information to SystemStatus API
16+
- Added generateToken API for security settings
17+
- Added Multi-WiFi capability. Add up to five WiFi configurations and connect to either strongest network (default), or by priority.
18+
- Added InfoDialog as a simpler version of the ConfirmDialog for a simple notification modal.
19+
- Added Adafruit certificate repository as the default choice for the X509 certificate bundle.
20+
21+
### Changed
22+
23+
- Better route protection for user page with deep link.
24+
- Changed build_interface.py script to check for modified files in the interface sources before re-building the interface. Saves some time on the compilation process.
25+
- Upload firmware binary allows uploading of MD5 checksum file in advance to verify downloaded firmware package.
26+
- GithubFirmwareManager checks against PIO build_target in filename to support Github OTA for binaries build for various targets. You should rename your old release \*.bin files on the Github release pages for backward compatibility.
27+
- Changed MQTT Client to an ESP-IDF backed one which supports SSL/TLS X509 root CA bundles and transport over WS.
28+
- Changed the `PROGMEM_WWW` flag to `EMBED_WWW` as there is technically speaking no PROGMEM on ESP32's.
29+
- Updated dependencies to the latest version. Except SvelteKit.
30+
31+
### Fixed
32+
33+
- Fixed reactivity of System Status page.
34+
35+
### Removed
36+
37+
- Removed support for Arduino ESP OTA.
38+
- HttpEndpoints and Websocket Server without a securityManager are no longer possible.
39+
40+
### Migrate from ESPAsyncWebServer to PsychicHttp
41+
42+
#### Migrate `main.cpp`
43+
44+
Change the server and ESPSvelteKit instances to PsychicHttpServer and give the ESP32SvelteKit constructor the number of http endpoints of your project.
45+
46+
```
47+
PsychicHttpServer server;
48+
ESP32SvelteKit esp32sveltekit(&server, 120);
49+
```
50+
51+
Remove `server.begin();` in `void setup()`. This is handled by ESP32SvelteKit now.
52+
53+
#### Migrate `platformio.ini`
54+
55+
Remove the following `build_flags`:
56+
57+
```ini
58+
; Increase queue size of SSE and WS
59+
-D SSE_MAX_QUEUED_MESSAGES=64
60+
-D WS_MAX_QUEUED_MESSAGES=64
61+
-D CONFIG_ASYNC_TCP_RUNNING_CORE=0
62+
-D NO_GLOBAL_ARDUINOOTA
63+
-D PROGMEM_WWW
64+
```
65+
66+
Add the following `build_flags` and adjust to your app, if needed:
67+
68+
```ini
69+
-D BUILD_TARGET=\"$PIOENV\"
70+
-D APP_NAME=\"ESP32-Sveltekit\" ; Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
71+
-D APP_VERSION=\"0.3.0\" ; semver compatible version string
72+
-D EMBED_WWW
73+
```
74+
75+
Remove the lib dependency `esphome/AsyncTCP-esphome @ ^2.0.0` and add `https://github.com/theelims/PsychicMqttClient.git`
76+
77+
Consider adjusting `board_ssl_cert_source = adafruit`, so that the new MQTT client has universal SSL/TLS support with a wide range of CA root certificates.
78+
79+
#### Migrate `factory_settings.ini`
80+
81+
The new MQTT client has slightly renamed factory settings:
82+
83+
```ini
84+
; MQTT settings
85+
-D FACTORY_MQTT_ENABLED=false
86+
-D FACTORY_MQTT_URI=\"mqtts://mqtt.eclipseprojects.io:8883\"
87+
-D FACTORY_MQTT_USERNAME=\"\" ; supports placeholders
88+
-D FACTORY_MQTT_PASSWORD=\"\"
89+
-D FACTORY_MQTT_CLIENT_ID=\"#{platform}-#{unique_id}\" ; supports placeholders
90+
-D FACTORY_MQTT_KEEP_ALIVE=120
91+
-D FACTORY_MQTT_CLEAN_SESSION=true
92+
```
93+
94+
Max Topic Length is no longer needed.
95+
96+
#### Custom Stateful Services
97+
98+
Adapt the class constructor (`(PsychicHttpServer *server, ...`) to PsychicHttpServer.
99+
100+
Due to the loading sequence HttpEndoint and WebsocketServer both have gotten a `begin()` function to register their http endpoints with the server. This must be called in your stateful services' own `begin()` function:
101+
102+
```cpp
103+
void LightStateService::begin()
104+
{
105+
_httpEndpoint.begin();
106+
_webSocketServer.begin();
107+
_state.ledOn = DEFAULT_LED_STATE;
108+
onConfigUpdated();
109+
}
110+
```
111+
112+
## [0.2.2] - 2023-10-08
6113

7114
### Added
8115

@@ -53,7 +160,7 @@ All notable changes to this project will be documented in this file.
53160
- Compiler flag on which core ESP32-sveltekit tasks should run
54161
- Renamed WebSocketRxTx.h to WebSocketServer.h to create a distinction between WS Client and WS Server interfaces
55162
- Made code of LightStateExample slightly more verbose
56-
- getServer() returning a pointer to the AsnycWebServer instance.
163+
- getServer() returning a pointer to the AsyncWebServer instance.
57164
- Updated frontend dependencies and packages to newest version.
58165

59166
### Depreciated

ESP32-sveltekit.code-workspace

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,56 @@
99
"*.tcc": "cpp",
1010
"algorithm": "cpp",
1111
"esp32-hal-misc.c": "cpp",
12-
"esp_crt_bundle.h": "c"
12+
"esp_crt_bundle.h": "c",
13+
"functional": "cpp",
14+
"array": "cpp",
15+
"atomic": "cpp",
16+
"bitset": "cpp",
17+
"cctype": "cpp",
18+
"clocale": "cpp",
19+
"cmath": "cpp",
20+
"cstdarg": "cpp",
21+
"cstddef": "cpp",
22+
"cstdint": "cpp",
23+
"cstdio": "cpp",
24+
"cstdlib": "cpp",
25+
"cstring": "cpp",
26+
"ctime": "cpp",
27+
"cwchar": "cpp",
28+
"cwctype": "cpp",
29+
"deque": "cpp",
30+
"list": "cpp",
31+
"unordered_map": "cpp",
32+
"vector": "cpp",
33+
"exception": "cpp",
34+
"iterator": "cpp",
35+
"map": "cpp",
36+
"memory": "cpp",
37+
"memory_resource": "cpp",
38+
"numeric": "cpp",
39+
"optional": "cpp",
40+
"random": "cpp",
41+
"regex": "cpp",
42+
"string": "cpp",
43+
"string_view": "cpp",
44+
"system_error": "cpp",
45+
"tuple": "cpp",
46+
"type_traits": "cpp",
47+
"utility": "cpp",
48+
"fstream": "cpp",
49+
"initializer_list": "cpp",
50+
"iosfwd": "cpp",
51+
"istream": "cpp",
52+
"limits": "cpp",
53+
"new": "cpp",
54+
"ostream": "cpp",
55+
"sstream": "cpp",
56+
"stdexcept": "cpp",
57+
"streambuf": "cpp",
58+
"cinttypes": "cpp",
59+
"typeinfo": "cpp",
60+
"unordered_set": "cpp",
61+
"iomanip": "cpp"
1362
}
1463
}
1564
}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Manage different user of your app with two authorization levels. An administrato
3535

3636
### :airplane: OTA Upgrade Service
3737

38-
The framework can provide three different channels for Over-the-Air updates. Either an ArduinoOTA port for updates directly from the IDE, by uploading a \*.bin file from the web interface. Or by pulling a firmware image from an update server. This is implemented with the github release page as an example.
38+
The framework can provide two different channels for Over-the-Air updates. Either by uploading a \*.bin file from the web interface. Or by pulling a firmware image from an update server. This is implemented with the github release page as an example. It is even possible to have different build environments at the same time and the Github OTA process pulls the correct binary.
3939

4040
### :building_construction: Automated Build Chain
4141

42-
The automated build chain takes out the pain and tears of getting all the bits and pieces play nice together. The repository contains a PlatformIO project at its heart. A SvelteKit project for the frontend code and a mkdocs project for the documentation go alongside. The PlatformIO build tools not only build the SvelteKit frontend with Vite, but also ensure that the build results are gzipped and find their way into the flash memory of the ESP32. You have two choices to serve the frontend either from the flash partition, or embedded into the firmware binary from PROGMEM. The latter is much more friendly if your frontend code should be distributed OTA as well, leaving all configuration files intact.
42+
The automated build chain takes out the pain and tears of getting all the bits and pieces play nice together. The repository contains a PlatformIO project at its heart. A SvelteKit project for the frontend code and a mkdocs project for the documentation go alongside. The PlatformIO build tools not only build the SvelteKit frontend with Vite, but also ensure that the build results are gzipped and find their way into the flash memory of the ESP32. You have two choices to serve the frontend either from the flash partition, or embedded into the firmware binary. The latter is much more friendly if your frontend code should be distributed OTA as well, leaving all configuration files intact.
4343

4444
### :icecream: Compatible with all ESP32 Flavours
4545

@@ -57,9 +57,10 @@ The code runs on many variants of the ESP32 chip family. From the plain old ESP3
5757
- [tabler ICONS](https://tabler-icons.io/)
5858
- [unplugin-icons](https://github.com/antfu/unplugin-icons)
5959
- [svelte-modals](https://svelte-modals.mattjennings.io/)
60+
- [svelte-dnd-list](https://github.com/tarb/svelte-dnd-list)
6061
- [ArduinoJson](https://github.com/bblanchon/ArduinoJson)
61-
- [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer)
62-
- [AsyncMqttClient](https://github.com/marvinroger/async-mqtt-client)
62+
- [PsychicHttp](https://github.com/hoeken/PsychicHttp)
63+
- [PsychicMqttClient](https://github.com/theelims/PsychicMqttClient)
6364

6465
## Licensing
6566

0 commit comments

Comments
 (0)