mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Adding a data attribute for ssid for input value
so it has nothing to do with the html , and can have different encoding, we could also just use IDs but scan cannot change, or use bssid #1370
This commit is contained in:
+4
-3
@@ -1562,7 +1562,8 @@ String WiFiManager::WiFiManager::getScanItemOut(){
|
||||
// Serial.println(WiFi.BSSIDstr(indices[i]));
|
||||
continue; // No idea why I am seeing these, lets just skip them for now
|
||||
}
|
||||
item.replace(FPSTR(T_v), htmlEntities(WiFi.SSID(indices[i]))); // ssid no encoding
|
||||
item.replace(FPSTR(T_V), htmlEntities(WiFi.SSID(indices[i]))); // ssid no encoding
|
||||
item.replace(FPSTR(T_v), htmlEntities(WiFi.SSID(indices[i]),true)); // ssid no encoding
|
||||
if(tok_e) item.replace(FPSTR(T_e), encryptionTypeStr(enc_type));
|
||||
if(tok_r) item.replace(FPSTR(T_r), (String)rssiperc); // rssi percentage 0-100
|
||||
if(tok_R) item.replace(FPSTR(T_R), (String)WiFi.RSSI(indices[i])); // rssi db
|
||||
@@ -3298,11 +3299,11 @@ boolean WiFiManager::validApPassword(){
|
||||
* @param string str string to replace entities
|
||||
* @return string encoded string
|
||||
*/
|
||||
String WiFiManager::htmlEntities(String str) {
|
||||
// str.replace(" "," ");
|
||||
String WiFiManager::htmlEntities(String str, bool whitespace) {
|
||||
str.replace("&","&");
|
||||
str.replace("<","<");
|
||||
str.replace(">",">");
|
||||
if(whitespace) str.replace(" "," ");
|
||||
// str.replace("-","–");
|
||||
// str.replace("\"",""");
|
||||
// str.replace("/": "/");
|
||||
|
||||
+1
-1
@@ -384,7 +384,7 @@ class WiFiManager
|
||||
void debugPlatformInfo();
|
||||
|
||||
// helper for html
|
||||
String htmlEntities(String str);
|
||||
String htmlEntities(String str, bool whitespace = false);
|
||||
|
||||
// set the country code for wifi settings, CN
|
||||
void setCountry(String cc);
|
||||
|
||||
+4
-2
@@ -24,7 +24,7 @@ const char HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html>"
|
||||
"<title>{v}</title>";
|
||||
|
||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function c(l){"
|
||||
"document.getElementById('s').value=l.innerText||l.textContent;"
|
||||
"document.getElementById('s').value=l.getAttribute('data-ssid')||l.innerText||l.textContent;"
|
||||
"p = l.nextElementSibling.classList.contains('l');"
|
||||
"document.getElementById('p').disabled = !p;"
|
||||
"if(p)document.getElementById('p').focus();}</script>"; // @todo add button states, disable on click , show ack , spinner etc
|
||||
@@ -33,6 +33,7 @@ const char HTTP_HEAD_END[] PROGMEM = "</head><body class='{c}'><div clas
|
||||
// example of embedded logo, base64 encoded inline, No styling here
|
||||
// const char HTTP_ROOT_MAIN[] PROGMEM = "<img title=' alt=' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADQElEQVRoQ+2YjW0VQQyE7Q6gAkgFkAogFUAqgFQAVACpAKiAUAFQAaECQgWECggVGH1PPrRvn3dv9/YkFOksoUhhfzwz9ngvKrc89JbnLxuA/63gpsCmwCADWwkNEji8fVNgotDM7osI/x777x5l9F6JyB8R4eeVql4P0y8yNsjM7KGIPBORp558T04A+CwiH1UVUItiUQmZ2XMReSEiAFgjAPBeVS96D+sCYGaUx4cFbLfmhSpnqnrZuqEJgJnd8cQplVLciAgX//Cf0ToIeOB9wpmloLQAwpnVmAXgdf6pwjpJIz+XNoeZQQZlODV9vhc1Tuf6owrAk/8qIhFbJH7eI3eEzsvydQEICqBEkZwiALfF70HyHPpqScPV5HFjeFu476SkRA0AzOfy4hYwstj2ZkDgaphE7m6XqnoS7Q0BOPs/sw0kDROzjdXcCMFCNwzIy0EcRcOvBACfh4k0wgOmBX4xjfmk4DKTS31hgNWIKBCI8gdzogTgjYjQWFMw+o9LzJoZ63GUmjWm2wGDc7EvDDOj/1IVMIyD9SUAL0WEhpriRlXv5je5S+U1i2N88zdPuoVkeB+ls4SyxCoP3kVm9jsjpEsBLoOBNC5U9SwpGdakFkviuFP1keblATkTENTYcxkzgxTKOI3jyDxqLkQT87pMA++H3XvJBYtsNbBN6vuXq5S737WqHkW1VgMQNXJ0RshMqbbT33sJ5kpHWymzcJjNTeJIymJZtSQd9NHQHS1vodoFoTMkfbJzpRnLzB2vi6BZAJxWaCr+62BC+jzAxVJb3dmmiLzLwZhZNPE5e880Suo2AZgB8e8idxherqUPnT3brBDTlPxO3Z66rVwIwySXugdNd+5ejhqp/+NmgIwGX3Py3QBmlEi54KlwmjkOytQ+iJrLJj23S4GkOeecg8G091no737qvRRdzE+HLALQoMTBbJgBsCj5RSWUlUVJiZ4SOljb05eLFWgoJ5oY6yTyJp62D39jDANoKKcSocPJD5dQYzlFAFZJflUArgTPZKZwLXAnHmerfJquUkKZEgyzqOb5TuDt1P3nwxobqwPocZA11m4A1mBx5IxNgRH21ti7KbAGiyNn3HoF/gJ0w05A8xclpwAAAABJRU5ErkJggg==' /><h1>{v}</h1><h3>WiFiManager</h3>";
|
||||
const char HTTP_ROOT_MAIN[] PROGMEM = "<h1>{t}</h1><h3>{v}</h3>";
|
||||
|
||||
const char * const HTTP_PORTAL_MENU[] PROGMEM = {
|
||||
"<form action='/wifi' method='get'><button>Configure WiFi</button></form><br/>\n", // MENU_WIFI
|
||||
"<form action='/0wifi' method='get'><button>Configure WiFi (No Scan)</button></form><br/>\n", // MENU_WIFINOSCAN
|
||||
@@ -50,7 +51,7 @@ const char * const HTTP_PORTAL_MENU[] PROGMEM = {
|
||||
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "";
|
||||
const char HTTP_ITEM_QI[] PROGMEM = "<div role='img' aria-label='{r}%' title='{r}%' class='q q-{q} {i} {h}'></div>"; // rssi icons
|
||||
const char HTTP_ITEM_QP[] PROGMEM = "<div class='q {h}'>{r}%</div>"; // rssi percentage {h} = hidden showperc pref
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a>{qi}{qp}</div>"; // {q} = HTTP_ITEM_QI, {r} = HTTP_ITEM_QP
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)' data-ssid='{V}'>{v}</a>{qi}{qp}</div>"; // {q} = HTTP_ITEM_QI, {r} = HTTP_ITEM_QP
|
||||
// const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> {R} {r}% {q} {e}</div>"; // test all tokens
|
||||
|
||||
const char HTTP_FORM_START[] PROGMEM = "<form method='POST' action='{v}'>";
|
||||
@@ -301,6 +302,7 @@ const char T_1[] PROGMEM = "{1}"; // @token 1
|
||||
const char T_2[] PROGMEM = "{2}"; // @token 2
|
||||
const char T_3[] PROGMEM = "{3}"; // @token 2
|
||||
const char T_v[] PROGMEM = "{v}"; // @token v
|
||||
const char T_V[] PROGMEM = "{V}"; // @token v
|
||||
const char T_I[] PROGMEM = "{I}"; // @token I
|
||||
const char T_i[] PROGMEM = "{i}"; // @token i
|
||||
const char T_n[] PROGMEM = "{n}"; // @token n
|
||||
|
||||
Reference in New Issue
Block a user