From 936b565fb14002a0e10a617b399847424201b137 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 12 Jul 2023 00:05:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=97=B4=E5=92=8C=E7=89=88=E6=9C=AC=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/api/system.ts | 20 +++----------------- back/config/util.ts | 1 + back/data/dependence.ts | 2 +- src/layouts/index.tsx | 3 +-- src/pages/setting/about.tsx | 7 ++----- version.yaml | 1 + 6 files changed, 9 insertions(+), 25 deletions(-) diff --git a/back/api/system.ts b/back/api/system.ts index 7623ef1f..5b747ab3 100644 --- a/back/api/system.ts +++ b/back/api/system.ts @@ -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, }, diff --git a/back/config/util.ts b/back/config/util.ts index e6588417..6e82ed3a 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -517,6 +517,7 @@ interface IVersion { version: string; changeLogLink: string; changeLog: string; + publishTime: string; } export async function parseVersion(path: string): Promise { diff --git a/back/data/dependence.ts b/back/data/dependence.ts index ae202928..5809e736 100644 --- a/back/data/dependence.ts +++ b/back/data/dependence.ts @@ -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', } diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 3ab72310..0a385d12 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -49,8 +49,7 @@ export interface SharedContext { interface TSystemInfo { branch: 'develop' | 'master'; isInitialized: boolean; - lastCommitId: string; - lastCommitTime: number; + publishTime: number; version: string; changeLog: string; changeLogLink: string; diff --git a/src/pages/setting/about.tsx b/src/pages/setting/about.tsx index 638cedcb..291768ea 100644 --- a/src/pages/setting/about.tsx +++ b/src/pages/setting/about.tsx @@ -31,13 +31,10 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => { {TVersion[systemInfo.branch]} v{systemInfo.version} - {dayjs(systemInfo.lastCommitTime * 1000).format( - 'YYYY-MM-DD HH:mm:ss', + {dayjs(systemInfo.publishTime * 1000).format( + 'YYYY-MM-DD HH:mm', )} - - {systemInfo.lastCommitId} -