From d4ffdfd1b7c928ae6e8859c57ef2227ebefefe08 Mon Sep 17 00:00:00 2001 From: joseph le Date: Fri, 15 Sep 2023 14:12:49 +0700 Subject: [PATCH] pdate screenshot --- app/utils/runtimeCheckLogs.ts | 2 +- app/utils/screenShot.ts | 2 +- app/utils/uploadFileZulip.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/utils/runtimeCheckLogs.ts b/app/utils/runtimeCheckLogs.ts index e749312..abd8ddd 100644 --- a/app/utils/runtimeCheckLogs.ts +++ b/app/utils/runtimeCheckLogs.ts @@ -178,7 +178,7 @@ export async function runtimeCheckLogs(folderPath) { ); const timeImage = Date.now() await screenShot(fileName, timeImage); - const uriImage = await uploadFileToZulip(fileName, timeImage); + const uriImage = await uploadFileToZulip(timeImage); let listReport = await getListLineByItem( logsDetect[0].filter((l) => l.line > lastLine) ); diff --git a/app/utils/screenShot.ts b/app/utils/screenShot.ts index 6beb9fb..778f90e 100644 --- a/app/utils/screenShot.ts +++ b/app/utils/screenShot.ts @@ -15,7 +15,7 @@ export const screenShot = async (filename, time) => { await bodyHandle.dispose(); await page.setViewport({ width: 1920, height: 500 }); setTimeout(async () => { - await page.screenshot({ path: "/home/screenshot/"+time+"_"+filename+".png" }); + await page.screenshot({ path: "/home/screenshot/"+time+".png" }); browser.close(); }, 5000); } catch (error) { diff --git a/app/utils/uploadFileZulip.ts b/app/utils/uploadFileZulip.ts index 1b96026..6bed904 100644 --- a/app/utils/uploadFileZulip.ts +++ b/app/utils/uploadFileZulip.ts @@ -2,7 +2,7 @@ import { FormData } from "zulip-js/lib/helper"; import axios from "axios"; import fs from "fs"; -export const uploadFileToZulip = async (filename, time) => { +export const uploadFileToZulip = async (filename) => { // try { const ZULIP_API_URL = "https://zulip.ipsupply.com.au/api/v1"; const ZULIP_API_KEY = "0jMAmOuhfLvBqKJikv5oAkyNM4RIEoAM"; @@ -13,7 +13,7 @@ export const uploadFileToZulip = async (filename, time) => { try { - const fileStream = fs.createReadStream("/home/screenshot/"+time+"_"+filename+".png"); + const fileStream = fs.createReadStream("/home/screenshot/"+filename+".png"); const formData = new FormData(); formData.append("file", fileStream);