소스 검색

default webpage

Chris Mullins 8 년 전
부모
커밋
e0df8f3ebd
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      lib/WebServer/MiLightHttpServer.cpp
  2. 3 0
      lib/WebServer/MiLightHttpServer.h

+ 1 - 1
lib/WebServer/MiLightHttpServer.cpp

@@ -9,7 +9,7 @@
 void MiLightHttpServer::begin() {
   applySettings(settings);
   
-  server.on("/", HTTP_GET, handleServeFile(WEB_INDEX_FILENAME, "text/html"));
+  server.on("/", HTTP_GET, handleServeFile(WEB_INDEX_FILENAME, "text/html", DEFAULT_INDEX_PAGE));
   server.on("/settings", HTTP_GET, handleServeFile(SETTINGS_FILE, "application/json"));
   server.on("/settings", HTTP_PUT, [this]() { handleUpdateSettings(); });
   server.on("/settings", HTTP_POST, [this]() { server.send(200, "text/plain", "success"); }, handleUpdateFile(SETTINGS_FILE));

+ 3 - 0
lib/WebServer/MiLightHttpServer.h

@@ -9,6 +9,9 @@
 
 typedef std::function<void(void)> SettingsSavedHandler;
 
+const char DEFAULT_INDEX_PAGE[] PROGMEM
+  = "Web app not installed. Click <a href=\"/download_update/web\">here</a> to attempt to download it from GitHub.";
+
 class MiLightHttpServer {
 public:
   MiLightHttpServer(Settings& settings, MiLightClient*& milightClient)