Skip to content

Commit 93f2574

Browse files
main.cpp: add a better description on the default / endpoint
Mainly for debugging, it's better to have all info on the default page. Later, more stuff will be added. Eventually some fill-in form for the post API.
1 parent 2a0a922 commit 93f2574

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/main.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void resetWebServer();
3838
void serveWebServer();
3939

4040
const String deviceId = "SmartHue-" + String(ESP.getChipId(), HEX);
41+
const String repoUrl = "https://github.com/ThomasDevoogdt/SmartHue";
4142

4243
#define LOG_ID deviceId.c_str()
4344

@@ -303,8 +304,21 @@ void setupWebServer()
303304
auto &logger = p_var->logger;
304305
auto &server = p_var->server;
305306
logger.log("[Webserver] serve /");
306-
String response = "Welcome to " + deviceId + ", please have a look at https://github.com/ThomasDevoogdt/SmartHue for more information.";
307-
server->send(200, "application/json", response);
307+
String response =
308+
"<!DOCTYPE html>"
309+
"<html>"
310+
"<body>"
311+
"<h1>" + deviceId + "</h1>"
312+
"<p>Welcome to " + deviceId + ", please have a look at <a href=\"" + repoUrl + "\">" + repoUrl + "</a> for more information.</p>"
313+
"<h2>GET</h2>"
314+
"<ul>"
315+
"<li><a href=\"https://" + deviceId + ".local/api/version\">/api/version</a></li>"
316+
"<li><a href=\"https://" + deviceId + ".local/api/systeminfo\">/api/systeminfo</a></li>"
317+
"<li><a href=\"https://" + deviceId + ".local/api/config\">/api/config</a></li>"
318+
"</ul>"
319+
"</body>"
320+
"</html>";
321+
server->send(200, "text/html", response);
308322
});
309323

310324
server->on("/api/version", HTTP_GET, []() {

0 commit comments

Comments
 (0)