diff --git a/app/utils/sendDeviceInfor.ts b/app/utils/sendDeviceInfor.ts
index 5a27219..ca36569 100644
--- a/app/utils/sendDeviceInfor.ts
+++ b/app/utils/sendDeviceInfor.ts
@@ -1,12 +1,10 @@
import Env from "@ioc:Adonis/Core/Env";
import fs from "fs";
import moment from "moment/moment";
-import dotenv from "dotenv";
import nodeMailer from "nodemailer";
import LogDetectFile from "App/Models/LogDetectFile";
import InfoDevice from "App/Models/InfoDevice";
import KeyValue from "App/Models/KeyValue";
-dotenv.config();
export const sendDeviceInfora = async () => {
try {
@@ -21,12 +19,12 @@ export const sendDeviceInfora = async () => {
.map((obj) => obj.$attributes.value);
const listInformation = [];
let dataFile = await LogDetectFile.all();
- // console.log(dataFile)
- // console.log(dataFile)
+
let html = "";
//List file today
- const listFile = fs.readdirSync(Env.get("FOLDER_LOGS"));
-
+ const listFile = fs
+ .readdirSync(Env.get("FOLDER_LOGS"))
+ .filter((f) => f.includes(date) && f.split(".")[f.split(".").length - 1]);
//Configure mail
const transporter = nodeMailer.createTransport({
pool: true,
@@ -167,30 +165,6 @@ export const sendDeviceInfora = async () => {
// let memory =
if (index > 0) {
if (PID !== "" && SN !== "") {
- // let RAM =
- // showVersion
- // .filter((line) => line.includes("bytes of memory"))
- // .join("
")
- // .match(regexMemory) !== null
- // ? (
- // parseInt(
- // showVersion
- // .filter((line) =>
- // line.includes("bytes of memory")
- // )
- // .join("
")
- // .match(regexMemory)[0]
- // ) /
- // 1024 /
- // 1024
- // ).toFixed(2) + "G"
- // : "";
-
- // let flash = showVersion
- // .filter((line) =>
- // line.toLocaleLowerCase().includes("compactflash")
- // )
- // .join("
");
listInformation.push({
PID: PID,
VID: VID,
@@ -378,9 +352,6 @@ export const sendDeviceInfora = async () => {
await InfoDevice.createMany(listInformation);
}
}, 5000);
- // const match = "show inventory".match(regexInventory);
-
- // console.log(match)
} catch (error) {
console.log(error);
}