修改版本信息获取

This commit is contained in:
whyour 2022-11-05 12:14:46 +08:00
parent 23bda39812
commit 7b2c54f6a6

View File

@ -9,6 +9,7 @@ import ScheduleService from './schedule';
import { spawn } from 'child_process';
import SockService from './sock';
import got from 'got';
import { promiseExec } from '../config/util';
@Service()
export default class SystemService {
@ -87,10 +88,9 @@ export default class SystemService {
let lastVersion = '';
let lastLog = '';
try {
const result = await got.get(config.lastVersionFile, {
timeout: 30000,
});
const lastVersionFileContent = result.body;
const lastVersionFileContent = await promiseExec(
`curl ${config.lastVersionFile}`,
);
lastVersion = lastVersionFileContent.match(versionRegx)![1];
lastLog = lastVersionFileContent.match(logRegx)
? lastVersionFileContent.match(logRegx)![1]