fix(striker-ui-api): include timestamp in server ss response

main
Tsu-ba-me 1 year ago
parent a0b188ffbd
commit 3cb1b2fa55
  1. 5
      striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts
  2. 1
      striker-ui-api/src/types/ApiServer.d.ts

@ -57,7 +57,7 @@ export const getServerDetail: RequestHandler<
} }
if (ss) { if (ss) {
const rsBody: ServerDetailScreenshot = { screenshot: '' }; const rsBody: ServerDetailScreenshot = { screenshot: '', timestamp: 0 };
const ssDir = SERVER_PATHS.opt.alteeve.screenshots.self; const ssDir = SERVER_PATHS.opt.alteeve.screenshots.self;
let ssNames: string[]; let ssNames: string[];
@ -95,13 +95,14 @@ export const getServerDetail: RequestHandler<
stdoutVar(ssMetaLatest, `Latest server screenshot: `); stdoutVar(ssMetaLatest, `Latest server screenshot: `);
if (ssMetaLatest) { if (ssMetaLatest) {
const { name } = ssMetaLatest; const { name, timestamp } = ssMetaLatest;
const ssLatest = readFileSync(path.join(ssDir, name), { const ssLatest = readFileSync(path.join(ssDir, name), {
encoding: 'base64', encoding: 'base64',
}); });
rsBody.screenshot = ssLatest; rsBody.screenshot = ssLatest;
rsBody.timestamp = timestamp;
} }
return response.send(rsBody); return response.send(rsBody);

@ -19,6 +19,7 @@ type ServerDetailParsedQs = {
type ServerDetailScreenshot = { type ServerDetailScreenshot = {
screenshot: string; screenshot: string;
timestamp: number;
}; };
type ServerDetailVncInfo = { type ServerDetailVncInfo = {

Loading…
Cancel
Save