Skip to content

Commit db57205

Browse files
committed
Merge branch 'main' into ethernet-support
2 parents 15dedfb + 1a35638 commit db57205

File tree

13 files changed

+16328
-15616
lines changed

13 files changed

+16328
-15616
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
## Upcoming [0.6.0] - tbd
5+
## [0.6.0] - 2025-11-03
66

77
> [!CAUTION]
88
> This update has breaking changes!
@@ -76,11 +76,16 @@ All notable changes to this project will be documented in this file.
7676
- Fixed preprocessor warning: usage of #ifdef with OR operator [#100](https://github.com/theelims/ESP32-sveltekit/pull/100)
7777
- Fixed preprocessor warning: redefinition of ESP_PLATFORM [#100](https://github.com/theelims/ESP32-sveltekit/pull/100)
7878
- Fixed deprecated usage of merge-bin and its parameters in scripts/merge_bin.py [#100](https://github.com/theelims/ESP32-sveltekit/pull/100)
79+
- Fixed Download OTA. Issues with certificate validation might remain, but build flag `-D DOWNLOAD_OTA_SKIP_CERT_VERIFY` allows to circumvent issue by sacrificing certificate validation.
7980

8081
### Removed
8182

8283
- Removed async workers in PsychicHttp, as these were not used, but caused linker errors.
8384

85+
### Depreciate
86+
87+
- Support for ESP Arduino 2 and ESP-IDF v4 will depreciate some time in the future. Try to migrate to the current Arduino 3 / ESP-IDF v5 based branch.
88+
8489
### Migration Guide
8590

8691
#### PIO Arduino & ESP-IDF 5
@@ -108,6 +113,10 @@ This will migrate some of your svelte files to the new naming convention of Tail
108113

109114
The themes are to be found in `app.css` now. Add them back if they had been changed from the default.
110115

116+
### Acknowledgment
117+
118+
Many thanks to @runeharlyk, @ewowi, @hmbacher, and @stamp who contributed significantly to this new release.
119+
111120
## [0.5.0] - 2024-05-06
112121

113122
Changes the Event Socket System to use a clearer message structure and MessagePack. Brings breaking changes to the `EventSocket.h` API.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The code runs on many variants of the ESP32 chip family. From the plain old ESP3
5959
- [tabler ICONS](https://tabler-icons.io/)
6060
- [unplugin-icons](https://github.com/antfu/unplugin-icons)
6161
- [svelte-modals](https://svelte-modals.mattjennings.io/)
62-
- [svelte-dnd-list](https://github.com/tarb/svelte-dnd-list)
62+
- [svelte-dnd-action](https://github.com/isaacHagoel/svelte-dnd-action)
6363
- [ArduinoJson](https://github.com/bblanchon/ArduinoJson)
6464
- [PsychicHttp](https://github.com/hoeken/PsychicHttp)
6565
- [PsychicMqttClient](https://github.com/theelims/PsychicMqttClient)

docs/buildprocess.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ The script will download a public certificate store from Mozilla (`board_ssl_cer
170170

171171
To enable SSL the feature `FT_NTP=1` must be enabled as well.
172172

173+
!!! bug
174+
175+
At the moment there is a bug with the certificate bundle when using the firmware download e.g. from Github. By using the build flag `-D DOWNLOAD_OTA_SKIP_CERT_VERIFY` you may skip certificate validation to keep OTA working. Only OTA seems affected, not MQTT. Keep in mind, that this voids the main security feature of SSL and allows man-in-the-middle attacks.
176+
173177
## Vite and LittleFS 32 Character Limit
174178

175179
The static files for the website are build using vite. By default vite adds a unique hash value to all filenames for improved caching performance. However, LittleFS on the ESP32 is limited to filenames with 32 characters. This restricts the number of characters available for the user to name svelte files. To give a little bit more headroom a vite-plugin removes all hash values, as they offer no benefit on an ESP32. However, have the 32 character limit in mind when naming files. Excessively long names may still cause some issues when building the LittleFS binary.

interface/src/lib/components/GithubUpdateDialog.svelte

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
} else if ($telemetry.download_ota.status == 'finished') {
4040
message = 'Restarting ...';
4141
progress = 0;
42-
// Reload page after 5 sec
42+
// Reload page after 20 sec
4343
timerId = setTimeout(() => {
4444
modals.closeAll();
4545
location.reload();
46-
}, 5000);
46+
}, 20000);
4747
}
4848
});
4949
@@ -52,9 +52,6 @@
5252
// prevents modal from closing
5353
return false;
5454
} else {
55-
$telemetry.download_ota.status = 'idle';
56-
$telemetry.download_ota.error = '';
57-
$telemetry.download_ota.progress = 0;
5855
return true;
5956
}
6057
});
@@ -90,7 +87,6 @@
9087
disabled={updating}
9188
onclick={() => {
9289
modals.closeAll();
93-
location.reload();
9490
}}
9591
>
9692
<Cancel class="mr-2 h-5 w-5" /><span>Close</span></button

interface/src/routes/system/update/GithubFirmwareManager.svelte

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { user } from '$lib/stores/user';
33
import { page } from '$app/state';
44
import { modals } from 'svelte-modals';
5+
import type { ModalComponent } from 'svelte-modals';
56
import { slide } from 'svelte/transition';
67
import { cubicOut } from 'svelte/easing';
78
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
@@ -66,8 +67,7 @@
6667
}
6768
}
6869
if (url === '') {
69-
// if no asset was found, use the first one
70-
modals.open(InfoDialog, {
70+
modals.open(InfoDialog as unknown as ModalComponent<any>, {
7171
title: 'No matching firmware found',
7272
message:
7373
'No matching firmware was found for the current device. Upload the firmware manually or build from sources.',
@@ -76,8 +76,7 @@
7676
});
7777
return;
7878
}
79-
80-
modals.open(ConfirmDialog, {
79+
modals.open(ConfirmDialog as unknown as ModalComponent<any>, {
8180
title: 'Confirm flashing new firmware to the device',
8281
message: 'Are you sure you want to overwrite the existing firmware with a new one?',
8382
labels: {
@@ -86,8 +85,8 @@
8685
},
8786
onConfirm: () => {
8887
postGithubDownload(url);
89-
modals.open(GithubUpdateDialog, {
90-
onConfirm: () => modals.closeAlls()
88+
modals.open(GithubUpdateDialog as unknown as ModalComponent<any>, {
89+
onConfirm: () => modals.closeAll()
9190
});
9291
}
9392
});
@@ -96,22 +95,28 @@
9695

9796
<SettingsCard collapsible={false}>
9897
{#snippet icon()}
99-
<Github class="lex-shrink-0 mr-2 h-6 w-6 self-end rounded-full" />
98+
<Github class="lex-shrink-0 mr-2 h-6 w-6 self-end rounded-full" />
10099
{/snippet}
101100
{#snippet title()}
102-
<span >Github Firmware Manager</span>
101+
<span>Github Firmware Manager</span>
103102
{/snippet}
104103
{#await getGithubAPI()}
105104
<Spinner />
106105
{:then githubReleases}
106+
<div class="alert alert-info">
107+
<div>
108+
<span class="font-bold">Current Firmware Version:</span>
109+
v{page.data.features.firmware_version}
110+
</div>
111+
</div>
107112
<div class="relative w-full overflow-visible">
108113
<div class="overflow-x-auto" transition:slide|local={{ duration: 300, easing: cubicOut }}>
109114
<table class="table w-full table-auto">
110115
<thead>
111116
<tr class="font-bold">
112117
<th align="left">Release</th>
113118
<th align="center" class="hidden sm:block">Release Date</th>
114-
<th align="center">Experimental</th>
119+
<th align="center">Exp.</th>
115120
<th align="center">Install</th>
116121
</tr>
117122
</thead>

interface/src/routes/wifi/sta/Wifi.svelte

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,6 @@
257257
await getWifiStatus();
258258
await getWifiSettings();
259259
}
260-
261-
function truncateSSID(ssid: string, maxLength: number = 15): string {
262-
if (ssid.length <= maxLength) {
263-
return ssid;
264-
}
265-
return ssid.substring(0, maxLength) + '...';
266-
}
267260
</script>
268261

269262
<SettingsCard collapsible={false}>
@@ -505,30 +498,30 @@
505498
>
506499
{#snippet children({ item: network, index }: { item: any; index: number })}
507500
<!-- svelte-ignore a11y_click_events_have_key_events -->
508-
<div class="rounded-box bg-base-100 flex items-center gap-2 px-2 py-2">
509-
<Grip class="h-6 w-6 text-base-content/30 cursor-grab flex-shrink-0" />
510-
<div class="mask mask-hexagon bg-primary h-auto w-10 flex-shrink-0">
501+
<div
502+
class="rounded-box bg-base-100 grid grid-cols-[auto_auto_minmax(6rem,1fr)_auto] items-center gap-3 p-2"
503+
>
504+
<Grip class="h-6 w-6 text-base-content/30 cursor-grab" />
505+
<div class="mask mask-hexagon bg-primary h-auto w-10">
511506
<Router class="text-primary-content h-auto w-full scale-75" />
512507
</div>
513-
<div class="flex flex-1 gap-x-2 min-w-0">
514-
<div class="font-bold truncate min-w-0" title={network.ssid}>
515-
{network.ssid}
516-
</div>
508+
<div class="flex items-center gap-2 overflow-hidden">
509+
<div class="font-bold truncate">{network.ssid}</div>
517510
{#if network.static_ip_config}
518511
<div
519-
class="badge badge-sm badge-secondary opacity-75 shrink-0 hidden sm:block"
512+
class="badge badge-sm badge-secondary opacity-75 flex-shrink-0 hidden sm:block"
520513
>
521514
Static
522515
</div>
523516
{:else}
524517
<div
525-
class="badge badge-sm badge-outline badge-secondary opacity-75 shrink-0 hidden sm:block"
518+
class="badge badge-sm badge-outline badge-secondary opacity-75 flex-shrink-0 hidden sm:block"
526519
>
527520
DHCP
528521
</div>
529522
{/if}
530523
</div>
531-
<div class="flex items-center gap-x-1 flex-shrink-0">
524+
<div class="flex">
532525
<button
533526
class="btn btn-ghost btn-sm"
534527
onclick={() => {

interface/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const config: UserConfig = {
1818
proxy: {
1919
// Proxying REST: http://localhost:5173/rest/bar -> http://192.168.1.83/rest/bar
2020
'/rest': {
21-
target: 'http://192.168.1.110',
21+
target: 'http://192.168.1.111',
2222
changeOrigin: true
2323
},
2424
// Proxying websockets ws://localhost:5173/ws -> ws://192.168.1.83/ws
2525
'/ws': {
26-
target: 'ws://192.168.1.110',
26+
target: 'ws://192.168.1.111',
2727
changeOrigin: true,
2828
ws: true
2929
}

lib/framework/DownloadFirmwareService.cpp

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,45 @@
1616
extern const uint8_t rootca_crt_bundle_start[] asm("_binary_src_certs_x509_crt_bundle_bin_start");
1717
extern const uint8_t rootca_crt_bundle_end[] asm("_binary_src_certs_x509_crt_bundle_bin_end");
1818

19+
/**
20+
* This is github-io.pem
21+
*/
22+
const char *githubCACertificate = "-----BEGIN CERTIFICATE-----\n"
23+
"MIIGEzCCA/ugAwIBAgIQfVtRJrR2uh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zk6s+go/lunrotEbaGmAhY\n"
53+
"LcmsJWTyXnW0OMGuf1pGg+pRyrbxmRE1a6Vqe8YAsOf4vmSyrcjC8azjUeqkk+B5\n"
54+
"yOGBQMkKW+ESPMFgKuOXwIlCypTPRpgSabuY0MLTDXJLR27lk8QyKGOHQ+SwMj4K\n"
55+
"00u/I5sUKUErmgQfky3xxzlIPK1aEn8=\n"
56+
"-----END CERTIFICATE-----\n";
57+
1958
static EventSocket *_socket = nullptr;
2059
static int previousProgress = 0;
2160
static String *otaURL = nullptr;
@@ -27,7 +66,7 @@ void update_started()
2766
doc["status"] = "preparing";
2867
JsonObject jsonObject = doc.as<JsonObject>();
2968
_socket->emitEvent(EVENT_DOWNLOAD_OTA, jsonObject);
30-
ESP_LOGD(SVK_TAG, "HTTP onUpdate started");
69+
ESP_LOGD(SVK_TAG, "HTTP Update started");
3170
}
3271

3372
void update_progress(int currentBytes, int totalBytes)
@@ -44,20 +83,40 @@ void update_progress(int currentBytes, int totalBytes)
4483
previousProgress = progress;
4584
}
4685

86+
void update_finished()
87+
{
88+
String output;
89+
doc["status"] = "finished";
90+
doc["progress"] = 100;
91+
JsonObject jsonObject = doc.as<JsonObject>();
92+
_socket->emitEvent(EVENT_DOWNLOAD_OTA, jsonObject);
93+
ESP_LOGI(SVK_TAG, "HTTP Update successful - Restarting");
94+
#ifdef SERIAL_INFO
95+
Serial.println("HTTP Update successful - Restarting");
96+
#endif
97+
98+
vTaskDelay(250 / portTICK_PERIOD_MS);
99+
}
100+
47101
void updateTask(void *param)
48102
{
49103
String url = *((String *)param);
50104
delete (String *)param; // Clean up the allocated memory
51105

52106
WiFiClientSecure client;
53107

108+
#ifndef DOWNLOAD_OTA_SKIP_CERT_VERIFY
109+
54110
#if ESP_ARDUINO_VERSION_MAJOR == 3
55111
client.setCACertBundle(rootca_crt_bundle_start, rootca_crt_bundle_end - rootca_crt_bundle_start);
56112
#else
57113
client.setCACertBundle(rootca_crt_bundle_start);
58114
#endif
59115

60-
// client.setInsecure(); // For testing purposes only, remove this line for production code
116+
#else
117+
ESP_LOGW(SVK_TAG, "Skipping SSL certificate verification for OTA update!");
118+
client.setInsecure();
119+
#endif
61120

62121
client.setTimeout(12000);
63122

@@ -67,6 +126,7 @@ void updateTask(void *param)
67126
String output;
68127
httpUpdate.onStart(update_started);
69128
httpUpdate.onProgress(update_progress);
129+
httpUpdate.onEnd(update_finished);
70130

71131
t_httpUpdate_return ret = httpUpdate.update(client, url.c_str());
72132
JsonObject jsonObject;
@@ -98,16 +158,6 @@ void updateTask(void *param)
98158
ESP_LOGE(SVK_TAG, "HTTP Update failed, has same firmware version");
99159
#ifdef SERIAL_INFO
100160
Serial.println("HTTP Update failed, has same firmware version");
101-
#endif
102-
break;
103-
case HTTP_UPDATE_OK:
104-
105-
doc["status"] = "finished";
106-
_emitEvent = true;
107-
108-
ESP_LOGI(SVK_TAG, "HTTP Update successful - Restarting");
109-
#ifdef SERIAL_INFO
110-
Serial.println("HTTP Update successful - Restarting");
111161
#endif
112162
break;
113163
}

lib/framework/DownloadFirmwareService.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#include <WiFiClientSecure.h>
2626
#include <HTTPUpdate.h>
27-
// #include <SSLCertBundle.h>
2827

2928
#define GITHUB_FIRMWARE_PATH "/rest/downloadUpdate"
3029
#define EVENT_DOWNLOAD_OTA "otastatus"

0 commit comments

Comments
 (0)