Skip to content

Commit dcd64e1

Browse files
committed
Update for 3.0.0 and QoL improvements
1 parent bb77987 commit dcd64e1

File tree

11 files changed

+182
-113
lines changed

11 files changed

+182
-113
lines changed

Diff for: cores/esp32/HEXBuilder.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
License along with this library; if not, write to the Free Software
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
19-
#ifndef __ESP8266_HEX_BUILDER__
20-
#define __ESP8266_HEX_BUILDER__
19+
#ifndef HEXBuilder_h
20+
#define HEXBuilder_h
2121

2222
#include <WString.h>
2323
#include <Stream.h>

Diff for: libraries/ESP32/examples/HEXBuilder/HEXBuilder.ino

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
void setup() {
44
Serial.begin(115200);
5-
delay(100);
5+
while (!Serial) { delay(10); }
66
Serial.println("\n\n\nStart.");
77

88
// Convert a HEX string like 6c6c6f20576f726c64 to a binary buffer
@@ -72,5 +72,4 @@ void setup() {
7272
Serial.println("Done.");
7373
}
7474

75-
void loop() {
76-
}
75+
void loop() {}

Diff for: libraries/ESP32/examples/MD5Builder/MD5Builder.ino

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
void setup() {
1414
Serial.begin(115200);
15-
delay(100);
15+
while (!Serial) { delay(10); }
1616
Serial.println("\n\n\nStart.");
1717

1818
// Check if a password obfuscated in an MD5 actually
@@ -85,13 +85,12 @@ void setup() {
8585
};
8686
uint8_t res[16];
8787
md.getBytes(res);
88-
if (memcmp(raw, res, 16))
89-
Serial.println("Odd - failing MD5 on byte array when compared as bytes");
88+
if (memcmp(raw, res, 16))
89+
Serial.println("Odd - failing MD5 on byte array when compared as bytes");
9090
else
9191
Serial.println("OK!");
9292

9393
}
9494
}
9595

96-
void loop() {
97-
}
96+
void loop() {}

Diff for: libraries/WebServer/examples/HttpAuthCallback/HttpAuthCallback.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ String * credentialsHandler(HTTPAuthMethod mode, String username, String params[
3333

3434
void setup() {
3535
Serial.begin(115200);
36+
while (!Serial) { delay(10); }
3637
WiFi.mode(WIFI_STA);
3738
WiFi.begin(ssid, password);
3839
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -60,4 +61,4 @@ void loop() {
6061
ArduinoOTA.handle();
6162
server.handleClient();
6263
delay(2);//allow the cpu to switch to other tasks
63-
}
64+
}

Diff for: libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ credentials_t passwdfile[] = {
2424

2525
void setup() {
2626
Serial.begin(115200);
27+
while (!Serial) { delay(10); }
2728
WiFi.mode(WIFI_STA);
2829
WiFi.begin(ssid, password);
2930
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -63,4 +64,4 @@ void loop() {
6364
ArduinoOTA.handle();
6465
server.handleClient();
6566
delay(2);//allow the cpu to switch to other tasks
66-
}
67+
}

Diff for: libraries/WebServer/examples/HttpAuthOneTimePassword/HttpAuthOneTimePassword.ino

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
#if 1
2-
// bodge to get this example to compile in the default install.
3-
void setup() {};
4-
void loop() {};
5-
#else
61
#include <WiFi.h>
72
#include <ESPmDNS.h>
83
#include <ArduinoOTA.h>
@@ -135,7 +130,7 @@ String * checkOTP(HTTPAuthMethod mode, String username, String params[]) {
135130
//
136131
for (int i = -2 ; i <= 2; i++) {
137132
String * otp = TOTP::currentOTP(time(NULL) + i * TOTP::RFC6238_DEFAULT_interval, *seed);
138-
133+
139134
if (!params[0].startsWith(*otp))
140135
continue;
141136

@@ -159,6 +154,7 @@ String * checkOTP(HTTPAuthMethod mode, String username, String params[]) {
159154

160155
void setup() {
161156
Serial.begin(115200);
157+
while (!Serial) { delay(10); }
162158
WiFi.mode(WIFI_STA);
163159
WiFi.begin(ssid, password);
164160
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -224,4 +220,3 @@ void loop() {
224220
delete otp;
225221
}
226222
}
227-
#endif

Diff for: libraries/WebServer/examples/HttpAuthOneTimePasswordNaive/HttpAuthOneTimePasswordNaive.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const int digits = 6; // length (default is 0)
7777
7878
void setup() {
7979
Serial.begin(115200);
80+
while (!Serial) { delay(10); }
8081
WiFi.mode(WIFI_STA);
8182
WiFi.begin(ssid, password);
8283
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -92,7 +93,7 @@ void setup() {
9293
9394
server.on("/", []() {
9495
if (!server.authenticate([](HTTPAuthMethod mode, String username, String params[]) -> String * {
95-
if (username == demouser)
96+
if (username == demouser)
9697
return TOTP::currentOTP(seed);
9798
return NULL;
9899
}))

Diff for: libraries/WebServer/examples/HttpBasicAuthSHA1/HttpBasicAuthSHA1.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const char* www_password_base64 = "jLEk+MJ3wW7Asu4AVp/RUaCONCs=";
3535

3636
void setup() {
3737
Serial.begin(115200);
38+
while (!Serial) { delay(10); }
3839
WiFi.mode(WIFI_STA);
3940
WiFi.begin(ssid, password);
4041
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -72,4 +73,4 @@ void loop() {
7273
ArduinoOTA.handle();
7374
server.handleClient();
7475
delay(2);//allow the cpu to switch to other tasks
75-
}
76+
}

Diff for: libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken/HttpBasicAuthSHA1orBearerToken.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ String * check_bearer_or_auth(HTTPAuthMethod mode, String authReq, String params
5151
// we expect authReq to be "bearer some-secret"
5252
//
5353
String lcAuthReq = authReq;
54-
lcAuthReq.toLowerCase();
54+
lcAuthReq.toLowerCase();
5555
if (mode == OTHER_AUTH && (lcAuthReq.startsWith("bearer "))) {
5656
String secret = authReq.substring(7);
5757
secret.trim();
@@ -71,6 +71,7 @@ return server.authenticateBasicSHA1(www_username_hex, www_password_hex) ?
7171

7272
void setup() {
7373
Serial.begin(115200);
74+
while (!Serial) { delay(10); }
7475
WiFi.mode(WIFI_STA);
7576
WiFi.begin(ssid, password);
7677
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
@@ -91,7 +92,7 @@ void setup() {
9192
Serial.println("No/failed authentication");
9293
return server.requestAuthentication();
9394
}
94-
server.send(200, "text/plain", "Login okOK");
95+
server.send(200, "text/plain", "Login OK");
9596
return;
9697
});
9798

@@ -106,4 +107,4 @@ void loop() {
106107
ArduinoOTA.handle();
107108
server.handleClient();
108109
delay(2);//allow the cpu to switch to other tasks
109-
}
110+
}

0 commit comments

Comments
 (0)