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