mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 15:06:38 +01:00
Download template tag json file when needed. (#298)
This commit is contained in:
@@ -64,9 +64,9 @@ window.addEventListener("loadConfig", function () {
|
||||
if (data.hasBLE == 0) {
|
||||
$("#apcfgble").parentNode.style.display = 'none';
|
||||
}
|
||||
if (data.hasSubGhz == 0) {
|
||||
$("#apcfgsubgigchid").parentNode.style.display = 'none';
|
||||
}
|
||||
if (data.hasSubGhz == 0) {
|
||||
$("#apcfgsubgigchid").parentNode.style.display = 'none';
|
||||
}
|
||||
if (data.savespace) {
|
||||
}
|
||||
if (data.apstate) {
|
||||
@@ -297,6 +297,9 @@ function processTags(tagArray) {
|
||||
(async () => {
|
||||
const localTagmac = tagmac;
|
||||
const data = await getTagtype(element.hwType);
|
||||
if (data.usetemplate != 0) {
|
||||
const template = await getTagtype(data.usetemplate);
|
||||
}
|
||||
$('#tag' + localTagmac + ' .model').innerHTML = data.name;
|
||||
$('#tag' + localTagmac + ' .resolution').innerHTML = data.width + "x" + data.height;
|
||||
if (element.ver != 0 && element.ver != 1) {
|
||||
@@ -1408,6 +1411,7 @@ async function getTagtype(hwtype) {
|
||||
return data;
|
||||
}
|
||||
const jsonData = await response.json();
|
||||
|
||||
let data = {
|
||||
name: jsonData.name,
|
||||
width: parseInt(jsonData.width),
|
||||
@@ -1419,11 +1423,13 @@ async function getTagtype(hwtype) {
|
||||
options: Object.values(jsonData.options ?? []),
|
||||
zlib: parseInt(jsonData.zlib_compression || "0", 16),
|
||||
shortlut: parseInt(jsonData.shortlut),
|
||||
busy: false
|
||||
busy: false,
|
||||
usetemplate:parseInt(jsonData.usetemplate || "0",10)
|
||||
};
|
||||
tagTypes[hwtype] = data;
|
||||
localStorage.setItem("tagTypes", JSON.stringify(tagTypes));
|
||||
getTagtypeBusy = false;
|
||||
|
||||
return data;
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@@ -595,9 +595,14 @@ async function fetchAndCheckTagtypes(cleanup) {
|
||||
const filename = file.name;
|
||||
print(filename, "green");
|
||||
let check = true;
|
||||
let hwtype = parseInt(filename, 16);
|
||||
|
||||
if (cleanup) {
|
||||
let isInUse = Array.from(gridItems).some(element => element.dataset.hwtype == parseInt(filename, 16));
|
||||
let isInUse = Array.from(gridItems).some(element => element.dataset.hwtype == hwtype);
|
||||
if (!isInUse) {
|
||||
|
||||
isInUse = Array.from(gridItems).some(element => element.dataset.usetemplate == hwtype);
|
||||
}
|
||||
if (!isInUse) {
|
||||
print("not in use, deleting", "yellow");
|
||||
const formData = new FormData();
|
||||
|
||||
Reference in New Issue
Block a user