Attempt at forcing Save dialog on preset backup.
Random BG image replaced by holiday BG.
This commit is contained in:
parent
c1a1fb8d87
commit
dbd3bd50df
@ -156,7 +156,7 @@ function loadBg(iUrl)
|
|||||||
let bg = document.getElementById('bg');
|
let bg = document.getElementById('bg');
|
||||||
let img = document.createElement("img");
|
let img = document.createElement("img");
|
||||||
img.src = iUrl;
|
img.src = iUrl;
|
||||||
if (iUrl == "") {
|
if (iUrl == "" || iUrl === "https://picsum.photos/1920/1080") {
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
for (var i=0; i<hol.length; i++) {
|
for (var i=0; i<hol.length; i++) {
|
||||||
var yr = hol[i][0]==0 ? today.getFullYear() : hol[i][0];
|
var yr = hol[i][0]==0 ? today.getFullYear() : hol[i][0];
|
||||||
|
@ -35,15 +35,15 @@
|
|||||||
x.style.animation = 'none';
|
x.style.animation = 'none';
|
||||||
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900);
|
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900);
|
||||||
}
|
}
|
||||||
function uploadFile(name) {
|
function uploadFile(fO,name) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.addEventListener('load', function(){showToast(this.responseText)});
|
req.addEventListener('load', function(){showToast(this.responseText)});
|
||||||
req.addEventListener('error', function(e){showToast(e.stack,true);});
|
req.addEventListener('error', function(e){showToast(e.stack,true);});
|
||||||
req.open("POST", "/upload");
|
req.open("POST", "/upload");
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append("data", d.Sf.data.files[0], name);
|
formData.append("data", fO.files[0], name);
|
||||||
req.send(formData);
|
req.send(formData);
|
||||||
d.Sf.data.value = '';
|
fO.value = '';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function GetV()
|
function GetV()
|
||||||
@ -74,8 +74,8 @@
|
|||||||
All settings and presets will be erased.<br><br>
|
All settings and presets will be erased.<br><br>
|
||||||
HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
|
HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
|
||||||
<hr>
|
<hr>
|
||||||
<a class="btn" href="/presets.json" target="_blank">Backup presets</a><br>
|
<a class="btn" href="/presets.json?download" target="download-frame">Backup presets</a><br>
|
||||||
<div id="presets">Restore presets:<input type="file" name="data" accept=".json"> <input type="button" value="Upload" onclick="uploadFile('/presets.json');"><br></div>
|
<div id="presets">Restore presets:<input type="file" name="data" accept=".json"> <input type="button" value="Upload" onclick="uploadFile(d.Sf.data,'/presets.json');"><br></div>
|
||||||
<hr>
|
<hr>
|
||||||
<h3>Software Update</h3>
|
<h3>Software Update</h3>
|
||||||
<button type="button" onclick="U()">Manual OTA Update</button><br>
|
<button type="button" onclick="U()">Manual OTA Update</button><br>
|
||||||
@ -90,5 +90,6 @@
|
|||||||
<div id="toast"></div>
|
<div id="toast"></div>
|
||||||
<button type="button" onclick="B()">Back</button><button type="submit">Save & Reboot</button>
|
<button type="button" onclick="B()">Back</button><button type="submit">Save & Reboot</button>
|
||||||
</form>
|
</form>
|
||||||
|
<iframe name=download-frame style='display:none;'></iframe>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -376,7 +376,10 @@ void updateFSInfo() {
|
|||||||
|
|
||||||
//Un-comment any file types you need
|
//Un-comment any file types you need
|
||||||
String getContentType(AsyncWebServerRequest* request, String filename){
|
String getContentType(AsyncWebServerRequest* request, String filename){
|
||||||
if(request->hasArg("download")) return "application/octet-stream";
|
if(request->hasArg("download")) {
|
||||||
|
request->addHeader(F("Content-Disposition"), F("Attachment"));
|
||||||
|
return "application/octet-stream";
|
||||||
|
}
|
||||||
else if(filename.endsWith(".htm")) return "text/html";
|
else if(filename.endsWith(".htm")) return "text/html";
|
||||||
else if(filename.endsWith(".html")) return "text/html";
|
else if(filename.endsWith(".html")) return "text/html";
|
||||||
else if(filename.endsWith(".css")) return "text/css";
|
else if(filename.endsWith(".css")) return "text/css";
|
||||||
|
@ -377,7 +377,7 @@ type="button" onclick="B()">Back</button><button type="submit">Save</button>
|
|||||||
// Autogenerated from wled00/data/settings_sec.htm, do not edit!!
|
// Autogenerated from wled00/data/settings_sec.htm, do not edit!!
|
||||||
const char PAGE_settings_sec[] PROGMEM = R"=====(<!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=500">
|
const char PAGE_settings_sec[] PROGMEM = R"=====(<!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=500">
|
||||||
<meta charset="utf-8"><title>Misc Settings</title><script>
|
<meta charset="utf-8"><title>Misc Settings</title><script>
|
||||||
var timeout,d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings")}function B(){window.open("/settings","_self")}function U(){window.open("/update","_self")}function gId(t){return d.getElementById(t)}function isObject(t){return t&&"object"==typeof t&&!Array.isArray(t)}function showToast(t,e=!1){var n=gId("toast");n.innerHTML=t,n.className=e?"error":"show",clearTimeout(timeout),n.style.animation="none",timeout=setTimeout((function(){n.className=n.className.replace("show","")}),2900)}function uploadFile(t){var e=new XMLHttpRequest;e.addEventListener("load",(function(){showToast(this.responseText)})),e.addEventListener("error",(function(t){showToast(t.stack,!0)})),e.open("POST","/upload");var n=new FormData;return n.append("data",d.Sf.data.files[0],t),e.send(n),d.Sf.data.value="",!1}function GetV() {var d=document;
|
var timeout,d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings")}function B(){window.open("/settings","_self")}function U(){window.open("/update","_self")}function gId(t){return d.getElementById(t)}function isObject(t){return t&&"object"==typeof t&&!Array.isArray(t)}function showToast(t,e=!1){var n=gId("toast");n.innerHTML=t,n.className=e?"error":"show",clearTimeout(timeout),n.style.animation="none",timeout=setTimeout((function(){n.className=n.className.replace("show","")}),2900)}function uploadFile(t,e){var n=new XMLHttpRequest;n.addEventListener("load",(function(){showToast(this.responseText)})),n.addEventListener("error",(function(t){showToast(t.stack,!0)})),n.open("POST","/upload");var o=new FormData;return o.append("data",t.files[0],e),n.send(o),t.value="",!1}function GetV() {var d=document;
|
||||||
%CSS%%SCSS%<link href="/skin.css"
|
%CSS%%SCSS%<link href="/skin.css"
|
||||||
rel="stylesheet"></head><body onload="GetV()"><form id="form_s" name="Sf"
|
rel="stylesheet"></head><body onload="GetV()"><form id="form_s" name="Sf"
|
||||||
method="post"><div class="toprow"><div class="helpB"><button type="button"
|
method="post"><div class="toprow"><div class="helpB"><button type="button"
|
||||||
@ -394,13 +394,14 @@ Disable OTA when not in use, otherwise an attacker can reflash device software!
|
|||||||
<br><br>Factory reset: <input type="checkbox" name="RS"><br>
|
<br><br>Factory reset: <input type="checkbox" name="RS"><br>
|
||||||
All settings and presets will be erased.<br><br>
|
All settings and presets will be erased.<br><br>
|
||||||
HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
|
HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
|
||||||
<hr><a class="btn" href="/presets.json" target="_blank">Backup presets</a><br>
|
<hr><a class="btn" href="/presets.json?download" target="download-frame">
|
||||||
<div id="presets">Restore presets:<input type="file" name="data" accept=".json">
|
Backup presets</a><br><div id="presets">Restore presets:<input type="file"
|
||||||
<input type="button" value="Upload" onclick='uploadFile("/presets.json")'><br>
|
name="data" accept=".json"> <input type="button" value="Upload"
|
||||||
</div><hr><h3>Software Update</h3><button type="button" onclick="U()">
|
onclick='uploadFile(d.Sf.data,"/presets.json")'><br></div><hr><h3>
|
||||||
Manual OTA Update</button><br>Enable ArduinoOTA: <input type="checkbox"
|
Software Update</h3><button type="button" onclick="U()">Manual OTA Update
|
||||||
name="AO"><br><h3>About</h3><a href="https://github.com/Aircoookie/WLED/"
|
</button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About
|
||||||
target="_blank">WLED</a> version 0.13.0-bl2<br><br><a
|
</h3><a href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a>
|
||||||
|
version 0.13.0-bl2<br><br><a
|
||||||
href="https://github.com/Aircoookie/WLED/wiki/Contributors-and-credits"
|
href="https://github.com/Aircoookie/WLED/wiki/Contributors-and-credits"
|
||||||
target="_blank">Contributors, dependencies and special thanks</a><br>
|
target="_blank">Contributors, dependencies and special thanks</a><br>
|
||||||
A huge thank you to everyone who helped me create WLED!<br><br>
|
A huge thank you to everyone who helped me create WLED!<br><br>
|
||||||
@ -408,7 +409,8 @@ A huge thank you to everyone who helped me create WLED!<br><br>
|
|||||||
href="https://github.com/Aircoookie/WLED/blob/master/LICENSE" target="_blank">
|
href="https://github.com/Aircoookie/WLED/blob/master/LICENSE" target="_blank">
|
||||||
MIT license</a></i><br><br>Server message: <span class="sip">Response error!
|
MIT license</a></i><br><br>Server message: <span class="sip">Response error!
|
||||||
</span><hr><div id="toast"></div><button type="button" onclick="B()">Back
|
</span><hr><div id="toast"></div><button type="button" onclick="B()">Back
|
||||||
</button><button type="submit">Save & Reboot</button></form></body></html>)=====";
|
</button><button type="submit">Save & Reboot</button></form><iframe
|
||||||
|
name="download-frame" style="display:none"></iframe></body></html>)=====";
|
||||||
|
|
||||||
|
|
||||||
// Autogenerated from wled00/data/settings_um.htm, do not edit!!
|
// Autogenerated from wled00/data/settings_um.htm, do not edit!!
|
||||||
|
1619
wled00/html_ui.h
1619
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2107141
|
#define VERSION 2107151
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
Loading…
Reference in New Issue
Block a user