Skip to content

Commit a03f4ee

Browse files
committed
Merge branch 'master' into header-footer
2 parents e2a287f + 0fad7f5 commit a03f4ee

7 files changed

+82
-36
lines changed

.github/workflows/compile_examples.yaml

+21-8
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@ jobs:
3939
uses: actions/cache@v2
4040
with:
4141
path: ~/.cache/pip
42-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
43-
restore-keys: ${{ runner.os }}-pip-
42+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ github.ref }}
43+
restore-keys: |
44+
${{ runner.os }}-pip-${{ github.ref }}-
45+
${{ runner.os }}-pip-
46+
4447
- name: Cache PlatformIO
4548
uses: actions/cache@v2
4649
with:
4750
path: ~/.platformio
48-
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
51+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ github.ref }}
52+
restore-keys: |
53+
${{ runner.os }}-${{ github.ref }}-
54+
${{ runner.os }}-
55+
4956
- name: Set up Python
5057
uses: actions/setup-python@v2
5158
- name: Install PlatformIO
5259
run: |
5360
python -m pip install --upgrade pip
5461
pip install --upgrade platformio
55-
- name: Install 3rd party dependecies
62+
- name: Install 3rd party dependencies
5663
run: |
5764
pio lib -g install \
5865
file://. \
@@ -92,20 +99,25 @@ jobs:
9299
uses: actions/cache@v2
93100
with:
94101
path: ~/.cache/pip
95-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
96-
restore-keys: ${{ runner.os }}-pip-
102+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ github.ref }}
103+
restore-keys: |
104+
${{ runner.os }}-pip-${{ github.ref }}-
105+
${{ runner.os }}-pip-
97106
- name: Cache PlatformIO
98107
uses: actions/cache@v2
99108
with:
100109
path: ~/.platformio
101-
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
110+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ github.ref }}
111+
restore-keys: |
112+
${{ runner.os }}-${{ github.ref }}-
113+
${{ runner.os }}-
102114
- name: Set up Python
103115
uses: actions/setup-python@v2
104116
- name: Install PlatformIO
105117
run: |
106118
python -m pip install --upgrade pip
107119
pip install --upgrade platformio
108-
- name: Install 3rd party dependecies
120+
- name: Install 3rd party dependencies
109121
run: |
110122
pio lib -g install \
111123
file://. \
@@ -116,3 +128,4 @@ jobs:
116128
run: pio ci --board=esp32dev
117129
env:
118130
PLATFORMIO_CI_SRC: ${{ matrix.example }}
131+

.github/workflows/compile_library.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ jobs:
2929
uses: actions/cache@v2
3030
with:
3131
path: ~/.cache/pip
32-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
33-
restore-keys: ${{ runner.os }}-pip-
32+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ matrix.board }}
33+
restore-keys: |
34+
${{ runner.os }}-pip-${{ matrix.board }}-
35+
${{ runner.os }}-pip-
3436
- name: Cache PlatformIO
3537
uses: actions/cache@v2
3638
with:
3739
path: ~/.platformio
38-
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
40+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ matrix.board }}
41+
restore-keys: |
42+
${{ runner.os }}-${{ matrix.board }}-
43+
${{ runner.os }}-
3944
- name: Set up Python
4045
uses: actions/setup-python@v2
4146
- name: Install PlatformIO

WiFiManager.cpp

+23-22
Original file line numberDiff line numberDiff line change
@@ -1272,22 +1272,23 @@ void WiFiManager::startWPS() {
12721272
}
12731273
#endif
12741274

1275-
String WiFiManager::getHTTPHead(String title){
1275+
String WiFiManager::getHTTPHead(String title, String classes){
12761276
String page;
12771277
page += FPSTR(HTTP_HEAD_START);
12781278
page.replace(FPSTR(T_v), title);
12791279
page += FPSTR(HTTP_SCRIPT);
12801280
page += FPSTR(HTTP_STYLE);
12811281
page += _customHeadElement;
12821282

1283-
if(_bodyClass != ""){
1284-
String p = FPSTR(HTTP_HEAD_END);
1285-
p.replace(FPSTR(T_c), _bodyClass); // add class str
1286-
page += p;
1283+
String p = FPSTR(HTTP_HEAD_END);
1284+
if (_bodyClass != "") {
1285+
if (classes != "") {
1286+
classes += " "; // add spacing, if necessary
1287+
}
1288+
classes += _bodyClass; // add class str
12871289
}
1288-
else {
1289-
page += FPSTR(HTTP_HEAD_END);
1290-
}
1290+
p.replace(FPSTR(T_c), classes);
1291+
page += p;
12911292

12921293
if (_customBodyHeader) {
12931294
page += _customBodyHeader;
@@ -1346,7 +1347,7 @@ void WiFiManager::handleRoot() {
13461347
#endif
13471348
if (captivePortal()) return; // If captive portal redirect instead of displaying the page
13481349
handleRequest();
1349-
String page = getHTTPHead(_title); // @token options @todo replace options with title
1350+
String page = getHTTPHead(_title, FPSTR(C_root)); // @token options @todo replace options with title
13501351
String str = FPSTR(HTTP_ROOT_MAIN); // @todo custom title
13511352
str.replace(FPSTR(T_t),_title);
13521353
str.replace(FPSTR(T_v),configPortalActive ? _apName : (getWiFiHostname() + " - " + WiFi.localIP().toString())); // use ip if ap is not active for heading @todo use hostname?
@@ -1371,7 +1372,7 @@ void WiFiManager::handleWifi(boolean scan) {
13711372
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- HTTP Wifi"));
13721373
#endif
13731374
handleRequest();
1374-
String page = getHTTPHead(FPSTR(S_titlewifi)); // @token titlewifi
1375+
String page = getHTTPHead(FPSTR(S_titlewifi), FPSTR(C_wifi)); // @token titlewifi
13751376
if (scan) {
13761377
#ifdef WM_DEBUG_LEVEL
13771378
// DEBUG_WM(WM_DEBUG_DEV,"refresh flag:",server->hasArg(F("refresh")));
@@ -1427,7 +1428,7 @@ void WiFiManager::handleParam(){
14271428
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- HTTP Param"));
14281429
#endif
14291430
handleRequest();
1430-
String page = getHTTPHead(FPSTR(S_titleparam)); // @token titlewifi
1431+
String page = getHTTPHead(FPSTR(S_titleparam), FPSTR(C_param)); // @token titlewifi
14311432

14321433
String pitem = "";
14331434

@@ -1892,11 +1893,11 @@ void WiFiManager::handleWifiSave() {
18921893
String page;
18931894

18941895
if(_ssid == ""){
1895-
page = getHTTPHead(FPSTR(S_titlewifisettings)); // @token titleparamsaved
1896+
page = getHTTPHead(FPSTR(S_titlewifisettings), FPSTR(C_wifi)); // @token titleparamsaved
18961897
page += FPSTR(HTTP_PARAMSAVED);
18971898
}
18981899
else {
1899-
page = getHTTPHead(FPSTR(S_titlewifisaved)); // @token titlewifisaved
1900+
page = getHTTPHead(FPSTR(S_titlewifisaved), FPSTR(C_wifi)); // @token titlewifisaved
19001901
page += FPSTR(HTTP_SAVED);
19011902
}
19021903

@@ -1925,7 +1926,7 @@ void WiFiManager::handleParamSave() {
19251926

19261927
doParamSave();
19271928

1928-
String page = getHTTPHead(FPSTR(S_titleparamsaved)); // @token titleparamsaved
1929+
String page = getHTTPHead(FPSTR(S_titleparamsaved), FPSTR(C_param)); // @token titleparamsaved
19291930
page += FPSTR(HTTP_PARAMSAVED);
19301931
if(_showBack) page += FPSTR(HTTP_BACKBTN);
19311932
page += getHTTPEnd();
@@ -1991,7 +1992,7 @@ void WiFiManager::handleInfo() {
19911992
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- HTTP Info"));
19921993
#endif
19931994
handleRequest();
1994-
String page = getHTTPHead(FPSTR(S_titleinfo)); // @token titleinfo
1995+
String page = getHTTPHead(FPSTR(S_titleinfo), FPSTR(C_info)); // @token titleinfo
19951996
reportStatus(page);
19961997

19971998
uint16_t infos = 0;
@@ -2336,7 +2337,7 @@ void WiFiManager::handleExit() {
23362337
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- HTTP Exit"));
23372338
#endif
23382339
handleRequest();
2339-
String page = getHTTPHead(FPSTR(S_titleexit)); // @token titleexit
2340+
String page = getHTTPHead(FPSTR(S_titleexit), FPSTR(C_exit)); // @token titleexit
23402341
page += FPSTR(S_exiting); // @token exiting
23412342
page += getHTTPEnd();
23422343
// ('Logout', 401, {'WWW-Authenticate': 'Basic realm="Login required"'})
@@ -2354,7 +2355,7 @@ void WiFiManager::handleReset() {
23542355
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- HTTP Reset"));
23552356
#endif
23562357
handleRequest();
2357-
String page = getHTTPHead(FPSTR(S_titlereset)); //@token titlereset
2358+
String page = getHTTPHead(FPSTR(S_titlereset), FPSTR(C_restart)); //@token titlereset
23582359
page += FPSTR(S_resetting); //@token resetting
23592360
page += getHTTPEnd();
23602361

@@ -2379,7 +2380,7 @@ void WiFiManager::handleErase(boolean opt) {
23792380
DEBUG_WM(WM_DEBUG_NOTIFY,F("<- HTTP Erase"));
23802381
#endif
23812382
handleRequest();
2382-
String page = getHTTPHead(FPSTR(S_titleerase)); // @token titleerase
2383+
String page = getHTTPHead(FPSTR(S_titleerase), FPSTR(C_erase)); // @token titleerase
23832384

23842385
bool ret = erase(opt);
23852386

@@ -2484,7 +2485,7 @@ void WiFiManager::handleClose(){
24842485
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- HTTP close"));
24852486
#endif
24862487
handleRequest();
2487-
String page = getHTTPHead(FPSTR(S_titleclose)); // @token titleclose
2488+
String page = getHTTPHead(FPSTR(S_titleclose), FPSTR(C_close)); // @token titleclose
24882489
page += FPSTR(S_closing); // @token closing
24892490
page += getHTTPEnd();
24902491
HTTPSend(page);
@@ -3001,7 +3002,7 @@ void WiFiManager::setShowStaticFields(boolean alwaysShow){
30013002
*/
30023003
void WiFiManager::setShowDnsFields(boolean alwaysShow){
30033004
if(_disableIpFields) _staShowDns = alwaysShow ? 1 : -1;
3004-
_staShowDns = alwaysShow ? 1 : 0;
3005+
else _staShowDns = alwaysShow ? 1 : 0;
30053006
}
30063007

30073008
/**
@@ -3910,7 +3911,7 @@ void WiFiManager::handleUpdate() {
39103911
DEBUG_WM(WM_DEBUG_VERBOSE,F("<- Handle update"));
39113912
#endif
39123913
if (captivePortal()) return; // If captive portal redirect instead of displaying the page
3913-
String page = getHTTPHead(_title); // @token options
3914+
String page = getHTTPHead(_title, FPSTR(C_update)); // @token options
39143915
String str = FPSTR(HTTP_ROOT_MAIN);
39153916
str.replace(FPSTR(T_t), _title);
39163917
str.replace(FPSTR(T_v), configPortalActive ? _apName : (getWiFiHostname() + " - " + WiFi.localIP().toString())); // use ip if ap is not active for heading
@@ -4020,7 +4021,7 @@ void WiFiManager::handleUpdateDone() {
40204021
DEBUG_WM(WM_DEBUG_VERBOSE, F("<- Handle update done"));
40214022
// if (captivePortal()) return; // If captive portal redirect instead of displaying the page
40224023

4023-
String page = getHTTPHead(FPSTR(S_options)); // @token options
4024+
String page = getHTTPHead(FPSTR(S_options), FPSTR(C_update)); // @token options
40244025
String str = FPSTR(HTTP_ROOT_MAIN);
40254026
str.replace(FPSTR(T_t),_title);
40264027
str.replace(FPSTR(T_v), configPortalActive ? _apName : WiFi.localIP().toString()); // use ip if ap is not active for heading

WiFiManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ class WiFiManager
539539
unsigned long _startconn = 0; // ms for timing wifi connects
540540

541541
// defaults
542-
const byte DNS_PORT = 53;
542+
const uint8_t DNS_PORT = 53;
543543
String _apName = "no-net";
544544
String _apPassword = "";
545545
String _ssid = ""; // var temp ssid
@@ -759,7 +759,7 @@ class WiFiManager
759759
String getIpForm(String id, String title, String value);
760760
String getScanItemOut();
761761
String getStaticOut();
762-
String getHTTPHead(String title);
762+
String getHTTPHead(String title, String classes = "");
763763
String getHTTPEnd();
764764
String getMenuOut();
765765
//helpers

wm_consts_en.h

+13
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static PGM_P _menutokens[] PROGMEM = {
4646
const uint8_t _nummenutokens = (sizeof(_menutokens) / sizeof(PGM_P));
4747

4848

49+
// Routes
4950
const char R_root[] PROGMEM = "/";
5051
const char R_wifi[] PROGMEM = "/wifi";
5152
const char R_wifinoscan[] PROGMEM = "/0wifi";
@@ -62,6 +63,18 @@ const char R_update[] PROGMEM = "/update";
6263
const char R_updatedone[] PROGMEM = "/u";
6364

6465

66+
// Classes
67+
const char C_root[] PROGMEM = "home";
68+
const char C_wifi[] PROGMEM = "wifi";
69+
const char C_info[] PROGMEM = "info";
70+
const char C_param[] PROGMEM = "param";
71+
const char C_close[] PROGMEM = "close";
72+
const char C_restart[] PROGMEM = "restart";
73+
const char C_exit[] PROGMEM = "exit";
74+
const char C_erase[] PROGMEM = "erase";
75+
const char C_update[] PROGMEM = "update";
76+
77+
6578
//Strings
6679
const char S_ip[] PROGMEM = "ip";
6780
const char S_gw[] PROGMEM = "gw";

wm_consts_fr.h

+13
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static PGM_P _menutokens[] PROGMEM = {
4747
const uint8_t _nummenutokens = (sizeof(_menutokens) / sizeof(PGM_P));
4848

4949

50+
// Routes
5051
const char R_root[] PROGMEM = "/";
5152
const char R_wifi[] PROGMEM = "/wifi";
5253
const char R_wifinoscan[] PROGMEM = "/0wifi";
@@ -63,6 +64,18 @@ const char R_update[] PROGMEM = "/update";
6364
const char R_updatedone[] PROGMEM = "/u";
6465

6566

67+
// Classes
68+
const char C_root[] PROGMEM = "home";
69+
const char C_wifi[] PROGMEM = "wifi";
70+
const char C_info[] PROGMEM = "info";
71+
const char C_param[] PROGMEM = "param";
72+
const char C_close[] PROGMEM = "close";
73+
const char C_restart[] PROGMEM = "restart";
74+
const char C_exit[] PROGMEM = "exit";
75+
const char C_erase[] PROGMEM = "erase";
76+
const char C_update[] PROGMEM = "update";
77+
78+
6679
//Strings
6780
const char S_ip[] PROGMEM = "ip";
6881
const char S_gw[] PROGMEM = "gw";

wm_strings_en.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ const char HTTP_STYLE[] PROGMEM = "<style>"
112112
"button.D{background-color:#dc3630}"
113113
"button:active{opacity:50% !important;cursor:wait;transition-delay: 0s}"
114114
// invert
115-
"body.invert,body.invert a,body.invert h1 {background-color:#060606;color:#fff;}"
115+
"body.invert{background-color:#060606;}"
116+
"body.invert,body.invert a,body.invert h1 {color:#fff;}"
116117
"body.invert .msg{color:#fff;background-color:#282828;border-top:1px solid #555;border-right:1px solid #555;border-bottom:1px solid #555;}"
117118
"body.invert .q[role=img]{-webkit-filter:invert(1);filter:invert(1);}"
118119
":disabled {opacity: 0.5;}"

0 commit comments

Comments
 (0)