Compare commits

...

4 Commits

Author SHA1 Message Date
Manuel Weiser b24c50722f chore: increment version to 1.0.9 in platformio.ini 2025-02-16 12:54:55 +01:00
Manuel Weiser 3ec23a9f79 feat: implement gzip compression for /spoolman route response 2025-02-16 12:54:24 +01:00
Manuel Weiser 75fe6b55ad chore: increment version to 1.0.8 in platformio.ini 2025-02-16 12:30:19 +01:00
Manuel Weiser fa2f980312 fix: update partition settings and version in platformio.ini, and enhance release workflow 2025-02-16 12:29:12 +01:00
4 changed files with 46 additions and 11 deletions
+2
View File
@@ -44,6 +44,8 @@ jobs:
--flash_freq 40m \
--flash_size 4MB \
-o .pio/build/esp32dev/filaman.bin \
0x1000 .pio/build/esp32dev/bootloader.bin \
0x8000 .pio/build/esp32dev/partitions.bin \
0x10000 .pio/build/esp32dev/firmware.bin \
0x290000 .pio/build/esp32dev/spiffs.bin
+5 -5
View File
@@ -1,5 +1,5 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x280000,
spiffs, data, spiffs, 0x290000,0x170000,
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x280000,
spiffs, data, spiffs, 0x290000, 0x170000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x280000
5 spiffs data spiffs 0x290000 0x170000
+6 -3
View File
@@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.0.7"
version = "1.0.9"
[env:esp32dev]
platform = espressif32
@@ -32,9 +32,12 @@ lib_deps =
; Enable SPIFFS upload
board_build.filesystem = spiffs
board_build.spiffs.partition = 2M
board_build.spiffs.upload_size = 2M
; Update partition settings
board_build.partitions = partitions.csv
board_upload.flash_size = 4MB
; Remove these as they're now defined in partitions.csv
; board_build.spiffs.partition = 2M
; board_build.spiffs.upload_size = 2M
build_flags =
-Os
+33 -3
View File
@@ -218,8 +218,31 @@ void setupWebserver(AsyncWebServer &server) {
// Route für Spoolman Setting
server.on("/spoolman", HTTP_GET, [](AsyncWebServerRequest *request){
Serial.println("Anfrage für /spoolman erhalten");
String html = loadHtmlWithHeader("/spoolman.html");
html.replace("{{spoolmanUrl}}", spoolmanUrl);
// Zuerst die gz-Datei laden
if (!SPIFFS.exists("/spoolman.html.gz")) {
request->send(404, "text/plain", "File not found");
return;
}
// Datei öffnen und in einen Puffer laden
File file = SPIFFS.open("/spoolman.html.gz", "r");
size_t fileSize = file.size();
uint8_t *gzippedContent = new uint8_t[fileSize];
file.read(gzippedContent, fileSize);
file.close();
// Entpacken des gzippedContent in einen String
String html;
// TODO: Hier muss der gzippedContent entpackt werden
// Dies erfordert eine zusätzliche Bibliothek wie zlib
// Ersetzungen vornehmen
String urlToReplace = spoolmanUrl;
if (urlToReplace.length() == 0) {
urlToReplace = "";
}
html.replace("{{spoolmanUrl}}", urlToReplace);
JsonDocument doc;
if (loadJsonValue("/bambu_credentials.json", doc) && doc.containsKey("bambu_ip")) {
@@ -235,7 +258,14 @@ void setupWebserver(AsyncWebServer &server) {
html.replace("{{bambuCode}}", bambuCode ? bambuCode : "");
}
request->send(200, "text/html", html);
// Komprimierte Antwort senden
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", html.c_str());
response->addHeader("Content-Encoding", "gzip");
response->addHeader("Cache-Control", CACHE_CONTROL);
request->send(response);
// Speicher freigeben
delete[] gzippedContent;
});
// Route für das Überprüfen der Spoolman-Instanz