Skip to content

Commit 0b4ca35

Browse files
committed
Fix webpage
1 parent e06381b commit 0b4ca35

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/WebPortal.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ void WebPortal::setup(Entry& mqttEntry, ConfigEntry& config, NTPClient& ntpClien
3737

3838
void WebPortal::handleRoot() {
3939
if(!auth()) return;
40-
webServer->send(200, "text/html", "");
4140

4241
webServer->sendContent_P(HTML_MAIN1);
4342

@@ -50,11 +49,11 @@ void WebPortal::handleRoot() {
5049
webServer->sendContent_P(HTML_MAIN2);
5150

5251
webServer->sendContent_P(HTML_CONFIG_HEADER);
53-
config->each([&](Entry* entry) {
54-
if(entry != config) {
55-
sendConfig(entry);
56-
}
57-
});
52+
//config->each([&](Entry* entry) {
53+
//if(entry != config) {
54+
//sendConfig(entry);
55+
//}
56+
//});
5857

5958
webServer->sendContent_P(HTML_MAIN3);
6059

@@ -76,6 +75,8 @@ void WebPortal::handleRoot() {
7675
page.replace("{device_id}", mqtt->get("$system")["deviceId"].getValue());
7776
page.replace("{topic}", mqtt->getTopic());
7877
webServer->sendContent(page);
78+
79+
webServer->client().stop();
7980
}
8081

8182
void WebPortal::sendSensor(Entry* entry) {
@@ -174,7 +175,7 @@ void WebPortal::loop() {
174175
}
175176

176177
String WebPortal::time(long time) {
177-
double utcOffset = config->getDouble("time.offset", 2);
178+
double utcOffset = 2; //config->getDouble("time.offset", 2);
178179

179180
long localTime = round(ntp->getTime(time) + 3600 * utcOffset);
180181

@@ -191,11 +192,13 @@ String WebPortal::time(long time) {
191192
}
192193

193194
bool WebPortal::auth() {
195+
/*
194196
char pass[32];
195197
config->getCString("password", "", pass);
196198
if (strlen(pass) > 0 && !webServer->authenticate("admin", pass)) {
197199
webServer->requestAuthentication();
198200
return false;
199201
}
202+
*/
200203
return true;
201204
}

0 commit comments

Comments
 (0)