mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-23 13:06:47 +01:00
@@ -506,6 +506,7 @@
|
||||
<button id="cfgscan">scan</button>
|
||||
<button id="cfgdeepsleep">deep sleep</button>
|
||||
<button id="cfgreset">reset settings</button>
|
||||
<button id="cfgautoupdate">auto update</button>
|
||||
<button id="cfgdelete" title="remove"><img
|
||||
src="data:image/gif;base64,R0lGODlhEAAQAPMAANXV1e3t7d/f39HR0dvb2/Hx8dTU1OLi4urq6mZmZpmZmf///wAAAAAAAAAAAAAAACH5BAEAAAwALAAAAAAQABAAAARBkMlJq71Yrp3ZXkr4WWCYnOZSgQVyEMYwJCq1nHhe20qgCAoA7QLyAYU7njE4JPV+zOSkCEUSFbmTVPPpbjvgTAQAOw== "></button>
|
||||
</p>
|
||||
@@ -524,4 +525,4 @@
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -469,44 +469,43 @@ $('#cfgmore').onclick = function () {
|
||||
$('#advancedoptions').style.height = $('#advancedoptions').style.height == '0px' ? $('#advancedoptions').scrollHeight + 'px' : '0px';
|
||||
};
|
||||
|
||||
$('#cfgsave').onclick = function () {
|
||||
let contentMode = $('#cfgcontent').value;
|
||||
let contentDef = getContentDefById(contentMode);
|
||||
let extraoptions = contentDef?.param ?? null;
|
||||
let obj = {};
|
||||
$('#cfgsave').onclick = function() {
|
||||
let contentMode = $('#cfgcontent').value;
|
||||
let contentDef = getContentDefById(contentMode);
|
||||
let extraoptions = contentDef?.param ?? null;
|
||||
let obj = {};
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append("mac", $('#cfgmac').dataset.mac);
|
||||
formData.append("alias", $('#cfgalias').value);
|
||||
let formData = new FormData();
|
||||
formData.append("mac", $('#cfgmac').dataset.mac);
|
||||
formData.append("alias", $('#cfgalias').value);
|
||||
|
||||
if (contentMode) {
|
||||
extraoptions?.forEach(element => {
|
||||
if ($('#opt' + element.key)) {
|
||||
obj[element.key] = $('#opt' + element.key).value;
|
||||
}
|
||||
});
|
||||
if (contentMode) {
|
||||
extraoptions?.forEach(element => {
|
||||
if ($('#opt' + element.key)) {
|
||||
obj[element.key] = $('#opt' + element.key).value;
|
||||
}
|
||||
});
|
||||
formData.append("contentmode", contentMode);
|
||||
formData.append("modecfgjson", JSON.stringify(obj));
|
||||
} else {
|
||||
formData.append("contentmode", "0");
|
||||
formData.append("modecfgjson", String());
|
||||
}
|
||||
|
||||
formData.append("contentmode", contentMode);
|
||||
formData.append("modecfgjson", JSON.stringify(obj));
|
||||
} else {
|
||||
formData.append("contentmode", "0");
|
||||
formData.append("modecfgjson", String());
|
||||
}
|
||||
formData.append("rotate", $('#cfgrotate').value);
|
||||
formData.append("lut", $('#cfglut').value);
|
||||
formData.append("invert", $('#cfginvert').value);
|
||||
|
||||
formData.append("rotate", $('#cfgrotate').value);
|
||||
formData.append("lut", $('#cfglut').value);
|
||||
formData.append("invert", $('#cfginvert').value);
|
||||
fetch("/save_cfg", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => showMessage(data))
|
||||
.catch(error => showMessage('Error: ' + error));
|
||||
|
||||
fetch("/save_cfg", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => showMessage(data))
|
||||
.catch(error => showMessage('Error: ' + error));
|
||||
|
||||
$('#advancedoptions').style.height = '0px';
|
||||
$('#configbox').close();
|
||||
$('#advancedoptions').style.height = '0px';
|
||||
$('#configbox').close();
|
||||
}
|
||||
|
||||
function sendCmd(mac, cmd) {
|
||||
@@ -556,6 +555,80 @@ $('#cfgreset').onclick = function () {
|
||||
sendCmd($('#cfgmac').dataset.mac, "reset");
|
||||
}
|
||||
|
||||
$('#cfgautoupdate').onclick = async function() {
|
||||
|
||||
let obj = {};
|
||||
let formData = new FormData();
|
||||
formData.append("mac", $('#cfgmac').dataset.mac);
|
||||
formData.append("alias", $('#cfgalias').value);
|
||||
|
||||
var repo = apConfig.repo || 'jjwbruijn/OpenEPaperLink';
|
||||
var infourl = "https://raw.githubusercontent.com/" + repo + "/master/binaries/Tag/info.json";
|
||||
var info = "";
|
||||
await fetch(infourl, {
|
||||
method: 'GET'
|
||||
})
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(json) {
|
||||
info = json;
|
||||
});
|
||||
var mac = $('#cfgmac').dataset.mac;
|
||||
var tagtype = ("0" + (Number($('#tag' + mac).dataset.hwtype).toString(16))).slice(-2).toUpperCase();
|
||||
var name = info[0].types[tagtype];
|
||||
var version = info[0].version[tagtype];
|
||||
var md5 = info[0].md5[tagtype];
|
||||
var fullFilename = name + "_" + version + ".bin";
|
||||
var filepath = "/" + fullFilename;
|
||||
var binurl = "https://raw.githubusercontent.com/" + repo + "/master/binaries/Tag/" + filepath;
|
||||
var url = "/check_file?path=" + encodeURIComponent(filepath);
|
||||
var response = await fetch(url);
|
||||
if (response.ok) {
|
||||
var data = await response.json();
|
||||
if (data.filesize == 0 || data.md5 != md5) {
|
||||
try {
|
||||
var response = await fetch(binurl);
|
||||
var fileContent = await response.blob();
|
||||
var formData2 = new FormData();
|
||||
formData2.append('path', filepath);
|
||||
formData2.append('file', fileContent, fullFilename);
|
||||
var uploadResponse = await fetch('/littlefs_put', {
|
||||
method: 'POST',
|
||||
body: formData2
|
||||
});
|
||||
if (!uploadResponse.ok) {
|
||||
showMessage('Error: auto update failed to upload');
|
||||
}
|
||||
} catch (error) {
|
||||
showMessage('Error: ' + error);
|
||||
}
|
||||
}
|
||||
} else showMessage('Error: auto update failed');
|
||||
var response = await fetch(url);
|
||||
if (response.ok) {
|
||||
var data = await response.json();
|
||||
if (data.filesize == 0 || data.md5 != md5) {
|
||||
showMessage('Error: auto update failed to download');
|
||||
}
|
||||
//sucess
|
||||
else obj["filename"] = filepath;
|
||||
}
|
||||
else showMessage('Error: auto update failed');
|
||||
formData.append("contentmode", 5);
|
||||
formData.append("modecfgjson", JSON.stringify(obj));
|
||||
formData.append("rotate", $('#cfgrotate').value);
|
||||
formData.append("lut", $('#cfglut').value);
|
||||
formData.append("invert", $('#cfginvert').value);
|
||||
fetch("/save_cfg", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => showMessage(data))
|
||||
.catch(error => showMessage('Error: ' + error));
|
||||
}
|
||||
|
||||
$('#rebootbutton').onclick = function (event) {
|
||||
event.preventDefault();
|
||||
if (!confirm('Reboot AP now?')) return;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
46
binaries/Tag/info.json
Normal file
46
binaries/Tag/info.json
Normal file
@@ -0,0 +1,46 @@
|
||||
[
|
||||
{
|
||||
"types": {
|
||||
"00": "SOL_M2_154_SSD",
|
||||
"01": "SOL_M2_29_SSD",
|
||||
"02": "SOL_M2_42_SSD",
|
||||
"05": "SOL_M2_75_ota",
|
||||
"11": "SOL_M2_29_UC",
|
||||
"21": "SOL_M2_29_LT",
|
||||
"2E": "SOL_M3_Uni_ota",
|
||||
"2F": "SOL_M3_Uni_ota",
|
||||
"31": "SOL_M3_Uni_ota",
|
||||
"33": "SOL_M3_Uni_ota",
|
||||
"35": "SOL_M3_Uni_ota",
|
||||
"36": "SOL_M3_Uni_ota"
|
||||
},
|
||||
"version": {
|
||||
"00": "25",
|
||||
"01": "25",
|
||||
"02": "25",
|
||||
"05": "04",
|
||||
"11": "25",
|
||||
"21": "25",
|
||||
"2E": "26",
|
||||
"2F": "26",
|
||||
"31": "26",
|
||||
"33": "26",
|
||||
"35": "26",
|
||||
"36": "26"
|
||||
},
|
||||
"md5": {
|
||||
"00": "57e02f80c9f2581be0a140979b1124e1",
|
||||
"01": "bed1a20ca6af04e29e5aabce480c1e9d",
|
||||
"02": "80e36c7d4d08beaca8ad2f00f42923d0",
|
||||
"05": "26c058db1f14c7ee2f301283bcbe7c9d",
|
||||
"11": "0c692cfca683948efeb3501a00c8f8bd",
|
||||
"21": "8ebc88f2a8de187a81d2f7c4c39b0d8e",
|
||||
"2E": "d234e395a8441779caa2df75ca9a508d",
|
||||
"2F": "d234e395a8441779caa2df75ca9a508d",
|
||||
"31": "d234e395a8441779caa2df75ca9a508d",
|
||||
"33": "d234e395a8441779caa2df75ca9a508d",
|
||||
"35": "d234e395a8441779caa2df75ca9a508d",
|
||||
"36": "d234e395a8441779caa2df75ca9a508d"
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user