Added configuration backup/restore.

Fixed save dialog compile error.
This commit is contained in:
Blaz Kristan 2021-07-15 18:38:42 +02:00
parent dbd3bd50df
commit bf94febb11
5 changed files with 826 additions and 818 deletions

View File

@ -76,10 +76,15 @@
<hr>
<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(d.Sf.data,'/presets.json');"><br></div>
<a class="btn" href="/cfg.json?download" target="download-frame">Backup configuration</a><br>
<div id="presets">Restore configuration:<input type="file" name="data2" accept=".json"> <input type="button" value="Upload" onclick="uploadFile(d.Sf.data2,'/cfg.json');"><br></div>
<div style="color: #f21;">WARNING!<br>Restoring presets/configuration will OVERWRITE current presets/configuration.<br>
Incorrect configuration may require factory reset or re-flashing of ESP.</div>
<hr>
<h3>Software Update</h3>
<button type="button" onclick="U()">Manual OTA Update</button><br>
Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
<hr>
<h3>About</h3>
<a href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a> version ##VERSION##<!-- Autoreplaced from package.json --><br><br>
<a href="https://github.com/Aircoookie/WLED/wiki/Contributors-and-credits" target="_blank">Contributors, dependencies and special thanks</a><br>

View File

@ -376,10 +376,7 @@ void updateFSInfo() {
//Un-comment any file types you need
String getContentType(AsyncWebServerRequest* request, String filename){
if(request->hasArg("download")) {
request->addHeader(F("Content-Disposition"), F("Attachment"));
return "application/octet-stream";
}
if(request->hasArg("download")) return "application/octet-stream";
else if(filename.endsWith(".htm")) return "text/html";
else if(filename.endsWith(".html")) return "text/html";
else if(filename.endsWith(".css")) return "text/css";

View File

@ -397,11 +397,18 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
<hr><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(d.Sf.data,"/presets.json")'><br></div><hr><h3>
Software Update</h3><button type="button" onclick="U()">Manual OTA Update
</button><br>Enable ArduinoOTA: <input type="checkbox" name="AO"><br><h3>About
</h3><a href="https://github.com/Aircoookie/WLED/" target="_blank">WLED</a>
version 0.13.0-bl2<br><br><a
onclick='uploadFile(d.Sf.data,"/presets.json")'><br></div><a class="btn"
href="/cfg.json?download" target="download-frame">Backup configuration</a><br>
<div id="presets">Restore configuration:<input type="file" name="data2"
accept=".json"> <input type="button" value="Upload"
onclick='uploadFile(d.Sf.data2,"/cfg.json")'><br></div><div style="color:#f21">
WARNING!<br>
Restoring presets/configuration will OVERWRITE current presets/configuration.
<br>Incorrect configuration may require factory reset or re-flashing of ESP.
</div><hr><h3>Software Update</h3><button type="button" onclick="U()">
Manual OTA Update</button><br>Enable ArduinoOTA: <input type="checkbox"
name="AO"><br><hr><h3>About</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"
target="_blank">Contributors, dependencies and special thanks</a><br>
A huge thank you to everyone who helped me create WLED!<br><br>

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2107151
#define VERSION 2107152
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG