修改系统更新时间和版本获取

This commit is contained in:
whyour
2023-07-12 00:05:46 +08:00
parent b69ff2895e
commit 936b565fb1
6 changed files with 9 additions and 25 deletions
+3 -17
View File
@@ -25,22 +25,9 @@ export default (app: Router) => {
try {
const userService = Container.get(UserService);
const authInfo = await userService.getUserInfo();
const { version, changeLog, changeLogLink } = await parseVersion(
const { version, changeLog, changeLogLink, publishTime } = await parseVersion(
config.versionFile,
);
const lastCommitTime = (
await promiseExec(
`cd ${config.rootPath} && git show -s --format=%ai | head -1`,
)
).replace('\n', '');
const lastCommitId = (
await promiseExec(`cd ${config.rootPath} && git rev-parse --short HEAD`)
).replace('\n', '');
const branch = (
await promiseExec(
`cd ${config.rootPath} && git symbolic-ref --short HEAD`,
)
).replace('\n', '');
let isInitialized = true;
if (
@@ -55,9 +42,8 @@ export default (app: Router) => {
data: {
isInitialized,
version,
lastCommitTime: dayjs(lastCommitTime).unix(),
lastCommitId,
branch,
publishTime: dayjs(publishTime).unix(),
branch: process.env.QL_BRANCH || 'master',
changeLog,
changeLogLink,
},
+1
View File
@@ -517,6 +517,7 @@ interface IVersion {
version: string;
changeLogLink: string;
changeLog: string;
publishTime: string;
}
export async function parseVersion(path: string): Promise<IVersion> {
+1 -1
View File
@@ -48,7 +48,7 @@ export enum InstallDependenceCommandTypes {
export enum GetDependenceCommandTypes {
'pnpm ls -g ',
'pip3 list --disable-pip-version-check --root-user-action=ignore',
'pip3 list --disable-pip-version-check',
'apk info',
}