DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
web_assets.cpp File Reference

Go to the source code of this file.

Variables

const char DETWS_DASHBOARD_PAGE []
 Real-time SVG telemetry dashboard page (DETWS_ENABLE_DASHBOARD).
 
const char DETWS_PROV_FORM []
 Captive-portal form for WiFi credential entry (provisioning service).
 
const char DETWS_PROV_SAVED_HTML [] = "<html><body> Saved. Rebooting... </body></html>"
 Success page shown after credentials are saved and the device reboots.
 
const char DETWS_TERMINAL_PAGE []
 Self-contained WebSocket terminal page (green-phosphor CRT theme; auto ws/wss).
 
const char DETWS_STATS_JSON []
 Runtime stats JSON (rendered via send_template); add/rename fields to taste.
 
const char DETWS_METRICS_PROM []
 All available Prometheus metrics; comment a value line out with a leading # to drop it.
 

Variable Documentation

◆ DETWS_DASHBOARD_PAGE

const char DETWS_DASHBOARD_PAGE[]

Real-time SVG telemetry dashboard page (DETWS_ENABLE_DASHBOARD).

Definition at line 10 of file web_assets.cpp.

◆ DETWS_PROV_FORM

const char DETWS_PROV_FORM[]
Initial value:
=
"<!doctype html><html><head><meta name=\"viewport\" content=\"width=device-width\" /><title>WiFi setup</title><"
"/head><body><h2>WiFi setup</h2><form method=\"POST\" action=\"/save\"> SSID:<br /><input name=\"ssid\" maxleng"
"th=\"32\" /><br /> Password:<br /><input name=\"psk\" type=\"password\" maxlength=\"63\" /><br /><br /><input "
"type=\"submit\" value=\"Save\" /></form></body></html>"

Captive-portal form for WiFi credential entry (provisioning service).

Definition at line 82 of file web_assets.cpp.

◆ DETWS_PROV_SAVED_HTML

const char DETWS_PROV_SAVED_HTML[] = "<html><body> Saved. Rebooting... </body></html>"

Success page shown after credentials are saved and the device reboots.

Definition at line 88 of file web_assets.cpp.

◆ DETWS_TERMINAL_PAGE

const char DETWS_TERMINAL_PAGE[]
Initial value:
=
"<!doctype html><html><head><meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width,init"
"ial-scale=1\" /><title>DetWS Terminal</title> <style>:root{--g:#2bb35a;--g2:#00c000;--bg:#080c08;}*{box-sizing"
":border-box;}html,body{margin:0;height:100%;background:var(--bg);color:var(--g);font:14px/1.45 \"Consolas\",\""
"DejaVu Sans Mono\",monospace;}#wrap{display:flex;flex-direction:column;height:100%;position:relative;}#out{fle"
"x:1;overflow:auto;padding:10px;white-space:pre-wrap;word-break:break-word;text-shadow:0 0 4px rgba(43,179,90,0"
".55);}#bar{display:flex;border-top:1px solid #14401f;background:#0a0f0a;}#ps{padding:8px 4px 8px 10px;color:va"
"r(--g2);}#in{flex:1;background:transparent;border:0;color:var(--g);font:inherit;padding:8px;outline:none;}#st{"
"padding:4px 10px;font-size:11px;color:#1c6e38;border-top:1px solid #14401f;}#crt{position:absolute;inset:0;poi"
"nter-events:none;z-index:9;background:repeating-linear-gradient( rgba(0,0,0,0) 0 2px,rgba(0,0,0,0.18) 3px );bo"
"x-shadow:inset 0 0 120px rgba(0,0,0,0.6);}.e{color:#d2553a;}</style> </head><body><div id=\"wrap\"><div id=\"o"
"ut\"></div><div id=\"bar\"><span id=\"ps\">&gt;</span ><input id=\"in\" autocomplete=\"off\" autofocus /></div"
"><div id=\"st\">connecting…</div><div id=\"crt\"></div></div> <script>var out = document.getElementById(\"out"
"\"),\ninp = document.getElementById(\"in\"),\nst = document.getElementById(\"st\");\nvar hist = [],\nhi = 0,\n"
"ws,\nurl =\n(location.protocol == \"https:\" ? \"wss\" : \"ws\") +\n\"://\" +\nlocation.host +\nlocation.pathn"
"ame.replace(/\\/$/, \"\") +\n\"/ws\";\nfunction add(t, c) {\nvar b =\nout.scrollHeight - out.clientHeight - ou"
"t.scrollTop < 40;\nvar s = document.createElement(\"span\");\nif (c) s.className = c;\ns.textContent = t;\nout"
".appendChild(s);\nif (b) out.scrollTop = out.scrollHeight;\n}\nfunction conn() {\nws = new WebSocket(url);\nws"
".onopen = function () {\nst.textContent = \"connected\";\n};\nws.onmessage = function (e) {\nadd(e.data);\n};"
"\nws.onclose = function () {\nst.textContent = \"disconnected — retrying…\";\nsetTimeout(conn, 1000);\n};\nws."
"onerror = function () {\ntry {\nws.close();\n} catch (_) {}\n};\n}\ninp.addEventListener(\"keydown\", function"
" (e) {\nif (e.key == \"Enter\") {\nvar v = inp.value;\nif (v) {\nif (ws && ws.readyState == 1) {\nws.send(v);"
"\nadd(\"> \" + v + \"\\n\");\n} else add(\"> \" + v + \" (offline)\\n\", \"e\");\nhist.push(v);\nhi = hist.len"
"gth;\n}\ninp.value = \"\";\n} else if (e.key == \"ArrowUp\") {\nif (hi > 0) {\nhi--;\ninp.value = hist[hi] || "
"\"\";\n}\n} else if (e.key == \"ArrowDown\") {\nif (hi < hist.length) {\nhi++;\ninp.value = hist[hi] || \"\";"
"\n}\n}\n});\nconn();</script> </body></html>"

Self-contained WebSocket terminal page (green-phosphor CRT theme; auto ws/wss).

Definition at line 90 of file web_assets.cpp.

◆ DETWS_STATS_JSON

const char DETWS_STATS_JSON[]
Initial value:
=
"{\"uptime_ms\":{{uptime_ms}},\"requests\":{{requests}},\"http_2xx\":{{http_2xx}},\"http_4xx\":{{http_4xx}},\"h"
"ttp_5xx\":{{http_5xx}},\"active_conns\":{{active_conns}},\"free_heap\":{{free_heap}}}"

Runtime stats JSON (rendered via send_template); add/rename fields to taste.

Definition at line 118 of file web_assets.cpp.

◆ DETWS_METRICS_PROM

const char DETWS_METRICS_PROM[]
Initial value:
=
"# HELP detws_uptime_seconds Device uptime in seconds.\n# TYPE detws_uptime_seconds gauge\ndetws_uptime_seconds"
" {{uptime_seconds}}\n# HELP detws_http_requests_total Total HTTP responses sent.\n# TYPE detws_http_requests_t"
"otal counter\ndetws_http_requests_total {{requests_total}}\n# HELP detws_http_responses_total HTTP responses b"
"y status class.\n# TYPE detws_http_responses_total counter\ndetws_http_responses_total{class=\"2xx\"} {{resp_2"
"xx}}\ndetws_http_responses_total{class=\"4xx\"} {{resp_4xx}}\ndetws_http_responses_total{class=\"5xx\"} {{resp"
"_5xx}}\n# HELP detws_active_connections Currently active connection slots.\n# TYPE detws_active_connections ga"
"uge\ndetws_active_connections {{active_conns}}\n# HELP detws_max_connections Connection slot capacity.\n# TYPE"
" detws_max_connections gauge\ndetws_max_connections {{max_conns}}\n# HELP detws_free_heap_bytes Free heap in b"
"ytes.\n# TYPE detws_free_heap_bytes gauge\ndetws_free_heap_bytes {{free_heap}}\n# HELP detws_min_free_heap_byt"
"es Lowest free heap observed since boot, in bytes.\n# TYPE detws_min_free_heap_bytes gauge\ndetws_min_free_hea"
"p_bytes {{min_free_heap}}\n# HELP detws_heap_size_bytes Total heap size, in bytes.\n# TYPE detws_heap_size_byt"
"es gauge\ndetws_heap_size_bytes {{heap_size}}\n# HELP detws_max_alloc_heap_bytes Largest contiguous allocatabl"
"e heap block, in bytes.\n# TYPE detws_max_alloc_heap_bytes gauge\ndetws_max_alloc_heap_bytes {{max_alloc_heap}"
"}\n"

All available Prometheus metrics; comment a value line out with a leading # to drop it.

Definition at line 123 of file web_assets.cpp.