Browse Source

0.5.110

* MQTT fix reconnection by new lib version #780
* add `about` page
pull/618/head
lumapu 2 years ago
parent
commit
c4e9fec8e7
  1. 2
      src/CHANGES.md
  2. 57
      src/web/html/about.html
  3. 2
      src/web/html/api.js
  4. 3
      src/web/html/includes/nav.html
  5. 19
      src/web/web.h

2
src/CHANGES.md

@ -4,7 +4,7 @@
## 0.5.110 ## 0.5.110
* MQTT fix reconnection by new lib version #780 * MQTT fix reconnection by new lib version #780
* display 'failed' if no Update was selected #813 * add `about` page
## 0.5.109 ## 0.5.109
* reduced heap fragmentation by optimizing MqTT #768 * reduced heap fragmentation by optimizing MqTT #768

57
src/web/html/about.html

@ -0,0 +1,57 @@
<!doctype html>
<html>
<head>
<title>About</title>
{#HTML_HEADER}
</head>
<body>
{#HTML_NAV}
<div id="wrapper">
<div id="content">
<div class="my-3"><h2>About AhoyDTU</h2></div>
<div class="my-3">
<div class="row my-3 head">
<div class="p-2">Used Libraries</div>
</div>
<div class="row"><a href="https://github.com/bertmelis/espMqttClient" target="_blank">bertmelis/espMqttClient</a></div>
<div class="row"><a href="https://github.com/yubox-node-org/ESPAsyncWebServer" target="_blank">yubox-node-org/ESPAsyncWebServer</a></div>
<div class="row"><a href="https://github.com/bblanchon/ArduinoJson" target="_blank">bblanchon/ArduinoJson</a></div>
<div class="row"><a href="https://github.com/nrf24/RF24" target="_blank">nrf24/RF24</a></div>
<div class="row"><a href="https://github.com/paulstoffregen/Time" target="_blank">paulstoffregen/Time</a></div>
<div class="row"><a href="https://github.com/olikraus/U8g2" target="_blank">olikraus/U8g2</a></div>
<div class="row"><a href="https://github.com/zinggjm/GxEPD2" target="_blank">zinggjm/GxEPD2</a></div>
<div class="row my-3 head">
<div class="p-2">Contact Information</div>
</div>
<div class="row">
<div class="col-5 col-sm-3">Github Repository</div>
<div class="col-7 col-sm-9"><a href="https://github.com/lumapu/ahoy">https://github.com/lumapu/ahoy</a></div>
</div>
<div class="row">
<div class="col-5 col-sm-3">Discord Chat</div>
<div class="col-7 col-sm-9"><a href="https://discord.gg/WzhxEY62mB" target="_blank">Discord</a></div>
</div>
<div class="row">
<div class="col-5 col-sm-3">E-Mail</div>
<div class="col-7 col-sm-9"><a href="mailto:contact@ahoydtu.de">contact@ahoydtu.de</a></div>
</div>
</div>
</div>
</div>
{#HTML_FOOTER}
<script type="text/javascript">
function parseGeneric(obj) {
parseNav(obj);
parseESP(obj);
parseRssi(obj);
}
function parse(obj) {
if(null != obj) {
parseGeneric(obj["generic"]);
}
}
getAjax("/api/html/save", parse);
</script>
</body>
</html>

2
src/web/html/api.js

@ -74,7 +74,7 @@ function topnav() {
} }
function parseNav(obj) { function parseNav(obj) {
for(i = 0; i < 10; i++) { for(i = 0; i < 11; i++) {
if(i == 2) if(i == 2)
continue; continue;
var l = document.getElementById("nav"+i); var l = document.getElementById("nav"+i);

3
src/web/html/includes/nav.html

@ -15,11 +15,10 @@
<span class="seperator"></span> <span class="seperator"></span>
<a id="nav8" href="/api" target="_blank">REST API</a> <a id="nav8" href="/api" target="_blank">REST API</a>
<a id="nav9" href="https://ahoydtu.de" target="_blank">Documentation</a> <a id="nav9" href="https://ahoydtu.de" target="_blank">Documentation</a>
<a id="nav10" href="/about">About</a>
<span class="seperator"></span> <span class="seperator"></span>
<a id="nav0" class="hide" href="/login">Login</a> <a id="nav0" class="hide" href="/login">Login</a>
<a id="nav1" class="hide" href="/logout">Logout</a> <a id="nav1" class="hide" href="/logout">Logout</a>
</div> </div>
<div id="wifiicon" class="info"></div> <div id="wifiicon" class="info"></div>
</div> </div>

19
src/web/web.h

@ -30,6 +30,7 @@
#include "html/h/save_html.h" #include "html/h/save_html.h"
#include "html/h/update_html.h" #include "html/h/update_html.h"
#include "html/h/visualization_html.h" #include "html/h/visualization_html.h"
#include "html/h/about_html.h"
#define WEB_SERIAL_BUF_SIZE 2048 #define WEB_SERIAL_BUF_SIZE 2048
@ -83,6 +84,7 @@ class Web {
mWeb.on("/upload", HTTP_POST, std::bind(&Web::onUpload, this, std::placeholders::_1), mWeb.on("/upload", HTTP_POST, std::bind(&Web::onUpload, this, std::placeholders::_1),
std::bind(&Web::onUpload2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); std::bind(&Web::onUpload2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6));
mWeb.on("/serial", HTTP_GET, std::bind(&Web::onSerial, this, std::placeholders::_1)); mWeb.on("/serial", HTTP_GET, std::bind(&Web::onSerial, this, std::placeholders::_1));
mWeb.on("/about", HTTP_GET, std::bind(&Web::onAbout, this, std::placeholders::_1));
mWeb.on("/debug", HTTP_GET, std::bind(&Web::onDebug, this, std::placeholders::_1)); mWeb.on("/debug", HTTP_GET, std::bind(&Web::onDebug, this, std::placeholders::_1));
@ -243,7 +245,7 @@ class Web {
} }
void showUpdate(AsyncWebServerRequest *request) { void showUpdate(AsyncWebServerRequest *request) {
bool reboot = (!Update.hasError() && Update.size() > 0); bool reboot = (!Update.hasError());
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: "); String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: ");
if (reboot) if (reboot)
@ -616,6 +618,21 @@ class Web {
request->send(response); request->send(response);
} }
void onAbout(AsyncWebServerRequest *request) {
if (CHECK_MASK(mConfig->sys.protectionMask, PROT_MASK_LIVE)) {
if (mProtected) {
checkRedirect(request);
return;
}
}
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), about_html, about_html_len);
response->addHeader(F("Content-Encoding"), "gzip");
response->addHeader(F("content-type"), "text/html; charset=UTF-8");
request->send(response);
}
void onDebug(AsyncWebServerRequest *request) { void onDebug(AsyncWebServerRequest *request) {
mApp->getSchedulerNames(); mApp->getSchedulerNames();
AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), "ok"); AsyncWebServerResponse *response = request->beginResponse(200, F("text/html; charset=UTF-8"), "ok");

Loading…
Cancel
Save