feat(frontend): add favicon.svg

This commit is contained in:
thek4n 2026-06-07 20:02:28 +03:00
parent cb42cce041
commit 628d14a79a
6 changed files with 44 additions and 5 deletions

1
.gitignore vendored
View File

@ -3,4 +3,5 @@ sdkconfig
sdkconfig.old sdkconfig.old
main/frontend.h main/frontend.h
main/setup_frontend.h main/setup_frontend.h
main/favicon_svg.h
managed_components/ managed_components/

32
assets/favicon.svg Normal file
View File

@ -0,0 +1,32 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
<defs>
<style>
/* Light theme (default) */
.gauge-stroke { stroke: #1A1A1A; }
.gauge-fill { fill: #1A1A1A; }
.danger-zone { fill: #E53935; opacity: 0.85; }
/* Dark theme via media query */
@media (prefers-color-scheme: dark) {
.gauge-stroke { stroke: #E8E8E8; }
.gauge-fill { fill: #E8E8E8; }
.danger-zone { fill: #FF6B6B; opacity: 0.9; }
}
</style>
</defs>
<circle cx="50" cy="50" r="45" fill="none" class="gauge-stroke" stroke-width="3.5" stroke-linecap="round"/>
<rect x="44" y="90" width="12" height="10" class="gauge-fill" rx="1.5"/>
<polygon points="47,100 53,100 56,106 44,106" class="gauge-fill"/>
<line x1="18" y1="50" x2="26" y2="50" class="gauge-stroke" stroke-width="2.5" stroke-linecap="round"/>
<line x1="50" y1="13" x2="50" y2="21" class="gauge-stroke" stroke-width="2.5" stroke-linecap="round"/>
<line x1="82" y1="50" x2="74" y2="50" class="gauge-stroke" stroke-width="2.5" stroke-linecap="round"/>
<path d="M 74,50 A 24,24 0 0,1 66,71 L 60,65 A 18,18 0 0,0 66,50 Z" class="danger-zone"/>
<line x1="50" y1="52" x2="62" y2="40" class="gauge-stroke" stroke-width="3" stroke-linecap="round"/>
<circle cx="50" cy="52" r="3.5" class="gauge-fill"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<title>IoT Pump controller</title> <title>IoT Pump controller</title>
<style> <style>
:root { :root {

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<title>Wi-Fi Setup · Controller</title> <title>Wi-Fi Setup · Controller</title>
<style> <style>
* { * {
@ -12,7 +13,7 @@
body { body {
margin: 0; margin: 0;
min-height: 100vh; min-height: 100dvh;
background: radial-gradient(circle at 20% 30%, #121826, #0b0f17); background: radial-gradient(circle at 20% 30%, #121826, #0b0f17);
font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, 'Roboto', sans-serif; font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, 'Roboto', sans-serif;
display: flex; display: flex;

View File

@ -16,6 +16,8 @@ build:
sed -i '1i\static const ' main/frontend.h sed -i '1i\static const ' main/frontend.h
xxd -i assets/setup.html > main/setup_frontend.h xxd -i assets/setup.html > main/setup_frontend.h
sed -i '1i\static const ' main/setup_frontend.h sed -i '1i\static const ' main/setup_frontend.h
xxd -i assets/favicon.svg > main/favicon_svg.h
sed -i '1i\static const ' main/favicon_svg.h
idf.py build idf.py build

View File

@ -30,8 +30,10 @@
#include "lwip/inet.h" #include "lwip/inet.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "frontend.h" #include "frontend.h"
#include "setup_frontend.h" #include "setup_frontend.h"
#include "favicon_svg.h"
// ============================================================================ // ============================================================================
// Configuration validation // Configuration validation
@ -619,8 +621,8 @@ static app_error_t mdns_init_service(void) {
// ============================================================================ // ============================================================================
static esp_err_t favicon_get_handler(httpd_req_t *req) { static esp_err_t favicon_get_handler(httpd_req_t *req) {
httpd_resp_set_status(req, "204 No Content"); httpd_resp_set_type(req, "image/svg+xml");
httpd_resp_send(req, NULL, 0); httpd_resp_send(req, (const char*)assets_favicon_svg, assets_favicon_svg_len);
return ESP_OK; return ESP_OK;
} }
@ -993,7 +995,7 @@ static app_error_t http_server_start(void) {
httpd_uri_t uris[] = { httpd_uri_t uris[] = {
{.uri = "/", .method = HTTP_GET, .handler = root_get_handler}, {.uri = "/", .method = HTTP_GET, .handler = root_get_handler},
{.uri = "/favicon.ico", .method = HTTP_GET, .handler = favicon_get_handler}, {.uri = "/favicon.svg", .method = HTTP_GET, .handler = favicon_get_handler},
{.uri = "/pressure", .method = HTTP_GET, .handler = current_pressure_handler}, {.uri = "/pressure", .method = HTTP_GET, .handler = current_pressure_handler},
{.uri = "/state", .method = HTTP_GET, .handler = pump_state_handler}, {.uri = "/state", .method = HTTP_GET, .handler = pump_state_handler},
{.uri = "/thresholds", .method = HTTP_GET, .handler = get_thresholds_handler}, {.uri = "/thresholds", .method = HTTP_GET, .handler = get_thresholds_handler},
@ -1020,7 +1022,7 @@ static app_error_t setup_http_server_start(void) {
httpd_uri_t uris[] = { httpd_uri_t uris[] = {
{.uri = "/", .method = HTTP_GET, .handler = setup_get_handler}, {.uri = "/", .method = HTTP_GET, .handler = setup_get_handler},
{.uri = "/favicon.ico", .method = HTTP_GET, .handler = favicon_get_handler}, {.uri = "/favicon.svg", .method = HTTP_GET, .handler = favicon_get_handler},
{.uri = "/settings", .method = HTTP_POST, .handler = setup_set_settings_handler}, {.uri = "/settings", .method = HTTP_POST, .handler = setup_set_settings_handler},
{.uri = "/wifi_list", .method = HTTP_GET, .handler = setup_get_wifi_list_handler}, {.uri = "/wifi_list", .method = HTTP_GET, .handler = setup_get_wifi_list_handler},
}; };