create function sendDeviceInfor to mail

This commit is contained in:
joseph le 2023-10-09 16:26:22 +07:00
parent f941cc615b
commit ce04061029
1 changed files with 29 additions and 44 deletions

View File

@ -122,73 +122,58 @@ export const sendDeviceInfora = async () => {
// let memory =
if (index > 0) {
if (PID !== "" && SN !== "") {
let RAM =
showVersion
.filter((line) => line.includes("bytes of memory"))
.join("<br>")
.match(regexMemory) !== null
? (
parseInt(
showVersion
.filter((line) =>
line.includes("bytes of memory")
)
.join("<br>")
.match(regexMemory)[0]
) /
1024 /
1024
).toFixed(2) + "G"
: "";
// let RAM =
// showVersion
// .filter((line) => line.includes("bytes of memory"))
// .join("<br>")
// .match(regexMemory) !== null
// ? (
// parseInt(
// showVersion
// .filter((line) =>
// line.includes("bytes of memory")
// )
// .join("<br>")
// .match(regexMemory)[0]
// ) /
// 1024 /
// 1024
// ).toFixed(2) + "G"
// : "";
let flash = showVersion
.filter((line) =>
line.toLocaleLowerCase().includes("compactflash")
)
.join("<br>");
// let flash = showVersion
// .filter((line) =>
// line.toLocaleLowerCase().includes("compactflash")
// )
// .join("<br>");
listInformation.push({
PID: PID,
VID: VID,
SN: SN,
RAM: RAM,
flash:
flash.match(regexMemory) !== null
? (
parseInt(flash.match(regexMemory)[0]) /
1024 /
1024
).toFixed(2) + "G"
: "",
RAM: "",
flash: "",
extraItem: "yes",
});
html += `<tr><td>${PID}</td>
<td>${VID}</td>
<td>${SN}</td>
<td>${RAM}</td>
<td>${
flash.match(regexMemory) !== null
? (
parseInt(flash.match(regexMemory)[0]) /
1024 /
1024
).toFixed(2) + "G"
: ""
}</td>
<td></td>
<td></td>
<td>yes</td></tr>`;
}
} else {
if (PID !== "" && SN !== "") {
let RAM =
showVersion
.filter((line) => line.includes("bytes of memory"))
.filter((line) => line.includes("bytes of memory") || line.includes("bytes of physical memory"))
.join("<br>")
.match(regexMemory) !== null
? (
parseInt(
showVersion
.filter((line) =>
line.includes("bytes of memory")
line.includes("bytes of memory") || line.includes("bytes of physical memory")
)
.join("<br>")
.match(regexMemory)[0]