diff --git a/app/utils/sendDeviceInfor.ts b/app/utils/sendDeviceInfor.ts
index d979624..f8b8859 100644
--- a/app/utils/sendDeviceInfor.ts
+++ b/app/utils/sendDeviceInfor.ts
@@ -154,17 +154,17 @@ export const sendDeviceInfora = async () => {
);
showInventoryContent.map((u, index) => {
- const PID = u
+ let PID = u
?.split("VID:")[0]
?.split("PID:")[1]
?.replace(/,/g, "")
.trim();
- const VID = u
+ let VID = u
?.split("VID:")[1]
?.split("SN:")[0]
?.replace(/,/g, "")
.trim();
- const SN = u?.split("SN:")[1]?.replace(/,/g, "").trim();
+ let SN = u?.split("SN:")[1]?.replace(/,/g, "").trim();
if (index > 0) {
if (PID !== "" && SN !== "") {
listInformation.push({
@@ -186,25 +186,33 @@ export const sendDeviceInfora = async () => {
PID.includes(i.split(":")[0])
)[0]
: PID + ":N/A:N/A";
+
+ const regexSPE = /\S*-SPE\S*(?=\s)/;
+
+ const stringMem = showVersion.filter(
+ (line) =>
+ line.includes("bytes of memory") ||
+ line.includes("bytes of physical memory")
+ )
+ const mathches = stringMem[0].match(regexSPE)
+
+ if(mathches && stringMem[0].includes("CHASSIS")){
+ console.log(mathches)
+ PID = mathches[0].trim();
+ SN = showInventoryContent.filter((i)=>i.includes(mathches[0].trim()))[0]?.split("SN:")[1]?.replace(/,/g, "").trim();
+ VID = showInventoryContent.filter((i)=>i.includes(mathches[0].trim()))[0]?.split("VID:")[1]
+ ?.split("SN:")[0]
+ ?.replace(/,/g, "")
+ .trim();
+ }
+
let RAM =
- showVersion
- .filter(
- (line) =>
- line.includes("bytes of memory") ||
- line.includes("bytes of physical memory")
- )
+ stringMem
.join("
")
.match(regexMemory) !== null
? (
parseInt(
- showVersion
- .filter(
- (line) =>
- line.includes("bytes of memory") ||
- line.includes(
- "bytes of physical memory"
- )
- )
+ stringMem
.join("
")
.match(regexMemory)[0]
) /
@@ -312,8 +320,8 @@ export const sendDeviceInfora = async () => {
});
const options = {
from: "admin@apactech.io",
- // to: "joseph@apactech.io, ips@ipsupply.com.au",
- to: "joseph@apactech.io",
+ to: "joseph@apactech.io, ips@ipsupply.com.au",
+ // to: "joseph@apactech.io",
subject: "(AUTO-REPORT) SERIAL NUMBER",
html:
"