diff --git a/data/logo.png b/data/logo.png new file mode 100644 index 0000000..5d18f7d Binary files /dev/null and b/data/logo.png differ diff --git a/src/main.cpp b/src/main.cpp index 12a37d1..8756481 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -231,6 +231,13 @@ static bool requireAuth() { // Web handlers // --------------------------------------------------------------------------- +static void handleLogo() { + File f = LittleFS.open("/logo.png", "r"); + if (!f) { server.send(404, "text/plain", "Not found"); return; } + server.streamFile(f, "image/png"); + f.close(); +} + static void handleRoot() { if (!requireAuth()) { Serial.println("[HTTP] GET / -> 401"); return; } Serial.println("[HTTP] GET /"); @@ -281,7 +288,8 @@ static void handleRoot() { html += "*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}"; html += "body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen,Ubuntu,sans-serif;background:#f2f4f8;color:#1a1a2e;display:flex;justify-content:center;align-items:flex-start;min-height:100vh;padding:24px 16px}"; html += ".card{background:#fff;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,.08);padding:32px;width:100%;max-width:560px}"; - html += "h1{font-size:24px;margin-bottom:4px}.sub{color:#666;font-size:14px;margin-bottom:24px}"; + html += ".hdr{display:flex;align-items:center;gap:16px;margin-bottom:24px}.hdr img{width:72px;height:72px;flex-shrink:0}"; + html += "h1{font-size:24px;margin-bottom:4px}.sub{color:#666;font-size:14px}"; html += ".info{background:#f8f9fc;border-radius:8px;padding:12px 16px;margin-bottom:20px;font-size:14px}"; html += ".info div{display:flex;justify-content:space-between;padding:4px 0}.info div span:first-child{color:#666}"; html += "label{display:block;font-size:14px;font-weight:600;margin-bottom:4px}"; @@ -300,7 +308,7 @@ static void handleRoot() { html += ".slid::before{content:\"\";position:absolute;height:14px;width:14px;left:2px;top:2px;background:#fff;border-radius:50%;transition:.3s;box-shadow:0 1px 3px rgba(0,0,0,.2)}"; html += ".switch input:checked+.slid{background:#4361ee}.switch input:checked+.slid::before{transform:translateX(14px)}"; html += "
"; - html += "

ESP32 Device

Configuration
"; + html += "
logo

ESP32 Device

Configuration
"; html += "
Hostname" + String(hostname) + "
"; html += "
IP" + WiFi.localIP().toString() + "
"; html += "
"; @@ -385,6 +393,7 @@ static void handleConfig() { static void startServer() { server.on("/", handleRoot); + server.on("/logo.png", handleLogo); server.on("/config", HTTP_POST, handleConfig); server.on("/reset", HTTP_POST, handleReset); server.begin();