From 3cb1b2fa55602e2377fb33b0f7d53a138f4ecb02 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Mon, 25 Sep 2023 20:13:23 -0400 Subject: [PATCH] fix(striker-ui-api): include timestamp in server ss response --- .../src/lib/request_handlers/server/getServerDetail.ts | 5 +++-- striker-ui-api/src/types/ApiServer.d.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts b/striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts index c0f5e069..263c5629 100644 --- a/striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts @@ -57,7 +57,7 @@ export const getServerDetail: RequestHandler< } if (ss) { - const rsBody: ServerDetailScreenshot = { screenshot: '' }; + const rsBody: ServerDetailScreenshot = { screenshot: '', timestamp: 0 }; const ssDir = SERVER_PATHS.opt.alteeve.screenshots.self; let ssNames: string[]; @@ -95,13 +95,14 @@ export const getServerDetail: RequestHandler< stdoutVar(ssMetaLatest, `Latest server screenshot: `); if (ssMetaLatest) { - const { name } = ssMetaLatest; + const { name, timestamp } = ssMetaLatest; const ssLatest = readFileSync(path.join(ssDir, name), { encoding: 'base64', }); rsBody.screenshot = ssLatest; + rsBody.timestamp = timestamp; } return response.send(rsBody); diff --git a/striker-ui-api/src/types/ApiServer.d.ts b/striker-ui-api/src/types/ApiServer.d.ts index c7ba1850..d4d0d360 100644 --- a/striker-ui-api/src/types/ApiServer.d.ts +++ b/striker-ui-api/src/types/ApiServer.d.ts @@ -19,6 +19,7 @@ type ServerDetailParsedQs = { type ServerDetailScreenshot = { screenshot: string; + timestamp: number; }; type ServerDetailVncInfo = {