webserver_handlePages_admin.ino 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. void httpServerHandlePage_admin()
  2. {
  3. httpServerSendHtmlHeadChunked();
  4. httpServer.sendContent_P(html_head_end);
  5. httpServer.sendContent_P(html_bodytag);
  6. httpServerSendHtmlBodyPageheadChunked();
  7. httpServer.sendContent_P(html_admin_body1);
  8. #ifdef FIRMWARE_VARIANT_THERMOSTAT
  9. httpServer.sendContent_P(html_admin_body_therm);
  10. #elif FIRMWARE_VARIANT_HEATCONTROL
  11. httpServer.sendContent_P(html_admin_body_heatc);
  12. #endif
  13. httpServer.sendContent_P(html_admin_body2);
  14. #ifdef ENABLE_FEATURE_HTTP_UPDATER
  15. httpServer.sendContent_P(html_admin_body_ota);
  16. #endif
  17. #ifdef ENABLE_FEATURE_FILESYSTEM_BROWSER
  18. if (confWeb.FSbrowser)
  19. httpServer.sendContent_P(html_admin_body_fsbrowser);
  20. #endif
  21. #ifdef ENABLE_FEATURE_WEB_CONSOLE
  22. if (confWeb.wConsole)
  23. httpServer.sendContent_P(html_admin_body_console);
  24. #endif
  25. #ifdef ENABLE_FEATURE_WSCONSOLE
  26. if (confWeb.wsConsole)
  27. httpServer.sendContent_P(html_admin_body_wsconsole);
  28. #endif
  29. httpServer.sendContent_P(html_admin_body_end);
  30. httpServerSendHtmlFooterChunked();
  31. }
  32. void httpServerHandlePage_confWeb()
  33. {
  34. httpServerSendHtmlHeadChunked();
  35. httpServer.sendContent_P(html_js_confpages_start);
  36. httpServer.sendContent_P(html_confweb_script);
  37. httpServer.sendContent_P(html_js_confpages_end);
  38. httpServer.sendContent_P(html_head_end);
  39. httpServer.sendContent_P(html_bodytag_jsinit);
  40. httpServerSendHtmlBodyPageheadChunked();
  41. httpServer.sendContent_P(html_confweb_body);
  42. #ifdef ENABLE_FEATURE_WSCONSOLE
  43. httpServer.sendContent_P(html_confweb_body_wsconsole);
  44. #endif
  45. httpServer.sendContent_P(html_confweb_body2);
  46. #ifdef ENABLE_FEATURE_FILESYSTEM_BROWSER
  47. httpServer.sendContent_P(html_confweb_body_fsbrowser);
  48. #endif
  49. httpServer.sendContent_P(html_confweb_body3);
  50. httpServerSendHtmlFooterChunked();
  51. }
  52. void httpServerHandlePage_confMqtt()
  53. {
  54. httpServerSendHtmlHeadChunked();
  55. httpServer.sendContent_P(html_js_confpages_start);
  56. httpServer.sendContent_P(html_confmqtt_script);
  57. httpServer.sendContent_P(html_js_confpages_end);
  58. httpServer.sendContent_P(html_head_end);
  59. httpServer.sendContent_P(html_bodytag_jsinit);
  60. httpServerSendHtmlBodyPageheadChunked();
  61. httpServer.sendContent_P(html_confmqtt_body);
  62. httpServerSendHtmlFooterChunked();
  63. }
  64. void httpServerHandlePage_confDevWiFi()
  65. {
  66. httpServerSendHtmlHeadChunked();
  67. httpServer.sendContent_P(html_js_confpages_start);
  68. httpServer.sendContent_P(html_confDevWiFi_script);
  69. httpServer.sendContent_P(html_js_confpages_end);
  70. httpServer.sendContent_P(html_head_end);
  71. httpServer.sendContent_P(html_bodytag_jsinit);
  72. httpServerSendHtmlBodyPageheadChunked();
  73. httpServer.sendContent_P(html_confDevWiFi_body);
  74. httpServerSendHtmlFooterChunked();
  75. }
  76. void httpServerHandlePage_confAdd()
  77. {
  78. httpServerSendHtmlHeadChunked();
  79. httpServer.sendContent_P(html_js_confpages_start);
  80. httpServer.sendContent_P(html_confadd_script);
  81. httpServer.sendContent_P(html_js_confpages_end);
  82. httpServer.sendContent_P(html_head_end);
  83. httpServer.sendContent_P(html_bodytag_jsinit);
  84. httpServerSendHtmlBodyPageheadChunked();
  85. httpServer.sendContent_P(html_confadd_body);
  86. httpServerSendHtmlFooterChunked();
  87. }
  88. void httpServerHandlePage_confTime()
  89. {
  90. httpServerSendHtmlHeadChunked();
  91. httpServer.sendContent_P(html_js_confpages_start);
  92. httpServer.sendContent_P(html_conftime_script);
  93. httpServer.sendContent_P(html_js_confpages_end);
  94. httpServer.sendContent_P(html_head_end);
  95. httpServer.sendContent_P(html_bodytag_jsinit);
  96. httpServerSendHtmlBodyPageheadChunked();
  97. httpServer.sendContent_P(html_conftime_body);
  98. httpServerSendHtmlFooterChunked();
  99. }
  100. void httpServerHandlePage_confLog()
  101. {
  102. httpServerSendHtmlHeadChunked();
  103. httpServer.sendContent_P(html_js_confpages_start);
  104. httpServer.sendContent_P(html_conflog_script);
  105. httpServer.sendContent_P(html_js_confpages_end);
  106. httpServer.sendContent_P(html_head_end);
  107. httpServer.sendContent_P(html_bodytag_jsinit);
  108. httpServerSendHtmlBodyPageheadChunked();
  109. httpServer.sendContent_P(html_conflog_body);
  110. httpServerSendHtmlFooterChunked();
  111. }
  112. #ifdef ENABLE_FEATURE_WSCONSOLE
  113. void httpServerHandlePage_WSConsole()
  114. {
  115. httpServerSendHtmlHeadChunked();
  116. httpServer.sendContent_P(html_head_end);
  117. httpServer.sendContent_P(html_bodytag);
  118. httpServerSendHtmlBodyPageheadChunked();
  119. httpServer.sendContent_P(html_wsconsole_body);
  120. httpServer.sendContent_P(html_wsconsole_script);
  121. httpServer.sendContent_P(js_wsapp);
  122. httpServer.sendContent_P(html_wsconsole_endScript);
  123. httpServerSendHtmlFooterChunked();
  124. }
  125. #endif
  126. #ifdef ENABLE_FEATURE_WEB_CONSOLE
  127. void httpServerHandlePage_console()
  128. {
  129. httpServerSendHtmlHeadChunked();
  130. httpServer.sendContent_P(html_head_end);
  131. httpServer.sendContent_P(html_bodytag);
  132. httpServerSendHtmlBodyPageheadChunked();
  133. httpServer.sendContent_P(html_console_body);
  134. httpServerSendHtmlFooterChunked();
  135. }
  136. #endif
  137. void httpServerHandlePage_confSaved()
  138. {
  139. httpServerSendHtmlHeadChunked();
  140. httpServer.sendContent_P(html_head_end);
  141. httpServer.sendContent_P(html_bodytag);
  142. httpServerSendHtmlBodyPageheadChunked();
  143. httpServer.sendContent_P(html_confsaved_body);
  144. httpServerSendHtmlFooterChunked();
  145. }
  146. //void httpServerHandlePage_confSavedRestart() {
  147. // httpServerSendHtmlHeadChunked();
  148. // httpServer.sendContent_P(html_head_end);
  149. // httpServer.sendContent_P(html_bodytag);
  150. // httpServerSendHtmlBodyPageheadChunked();
  151. // httpServer.sendContent_P(html_confsavedrestart_body);
  152. // httpServerSendHtmlFooterChunked();
  153. //}
  154. void httpServerHandlePage_clearConf()
  155. {
  156. httpServerSendHtmlHeadChunked();
  157. httpServer.sendContent_P(html_head_end);
  158. httpServer.sendContent_P(html_bodytag);
  159. httpServerSendHtmlBodyPageheadChunked();
  160. httpServer.sendContent_P(html_clearconf_body);
  161. httpServerSendHtmlFooterChunked();
  162. }
  163. #ifdef ENABLE_FEATURE_FILESYSTEM_BROWSER
  164. void httpServerHandlePage_fsbrowser()
  165. {
  166. httpServerSendHtmlHeadChunked();
  167. httpServer.sendContent_P(html_head_end);
  168. httpServerSendHtmlBodyPageheadChunked();
  169. httpServer.sendContent_P(html_fsbrowser_body_1);
  170. // output FS file list
  171. Dir dir = LittleFS.openDir("/");
  172. char _tmpStr[301];
  173. uint8_t _numFiles=0;
  174. while (dir.next())
  175. {
  176. _numFiles++;
  177. if(_numFiles > 1) {
  178. httpServer.sendContent("\n");
  179. }
  180. File f = dir.openFile("r");
  181. // filter out some files in file list - i.E: "formatted" should never be deleted by accident as this will clear all config on the next reboot!!
  182. if(strcmp(dir.fileName().c_str(), "formatted") != 0) {
  183. sprintf_P(_tmpStr, html_fsbrowser_listentry, dir.fileName().c_str(), dir.fileName().c_str(), f.size(), dir.fileName().c_str());
  184. httpServer.sendContent(_tmpStr);
  185. }
  186. f.close();
  187. }
  188. FS_getInfo();
  189. sprintf_P(_tmpStr, html_fsbrowser_listEnd);
  190. httpServer.sendContent(_tmpStr);
  191. sprintf_P(_tmpStr, html_fsbrowser_stats_total, fs_info.totalBytes);
  192. httpServer.sendContent(_tmpStr);
  193. sprintf_P(_tmpStr, html_fsbrowser_stats_used, fs_info.usedBytes);
  194. httpServer.sendContent(_tmpStr);
  195. httpServer.sendContent_P(html_fsbrowser_body_2);
  196. httpServerSendHtmlFooterChunked();
  197. }
  198. #endif