feat: update version to 1.1.0 and modify gzip compression handling for /spoolman route
Some checks failed
Create Release / build (push) Has been cancelled

This commit is contained in:
Manuel Weiser 2025-02-16 13:00:42 +01:00
parent b24c50722f
commit 2703689e4e
4 changed files with 8 additions and 35 deletions

View File

@ -12,7 +12,7 @@
<div style="display: flex; align-items: center; gap: 2rem;">
<img src="/logo.png" alt="FilaMan Logo" class="logo">
<div class="logo-text">
<h1>FilaMan<span class="version">v1.0.2</span></h1>
<h1>FilaMan<span class="version">v1.0.9</span></h1>
<h4>Filament Management Tool</h4>
</div>
</div>

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.0.9"
version = "1.1.0"
[env:esp32dev]
platform = espressif32

View File

@ -13,6 +13,9 @@ def copy_file(input_file, output_file):
shutil.copy2(input_file, output_file)
def should_compress(file):
# Skip compression for spoolman.html
if file == 'spoolman.html':
return False
# Komprimiere nur bestimmte Dateitypen
return file.endswith(('.js', '.png', '.css', '.html'))

View File

@ -218,31 +218,8 @@ void setupWebserver(AsyncWebServer &server) {
// Route für Spoolman Setting
server.on("/spoolman", HTTP_GET, [](AsyncWebServerRequest *request){
Serial.println("Anfrage für /spoolman erhalten");
// 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);
String html = loadHtmlWithHeader("/spoolman.html");
html.replace("{{spoolmanUrl}}", spoolmanUrl);
JsonDocument doc;
if (loadJsonValue("/bambu_credentials.json", doc) && doc.containsKey("bambu_ip")) {
@ -258,14 +235,7 @@ void setupWebserver(AsyncWebServer &server) {
html.replace("{{bambuCode}}", bambuCode ? bambuCode : "");
}
// 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;
request->send(200, "text/html", html);
});
// Route für das Überprüfen der Spoolman-Instanz