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

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

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,
},

View File

@ -517,6 +517,7 @@ interface IVersion {
version: string;
changeLogLink: string;
changeLog: string;
publishTime: string;
}
export async function parseVersion(path: string): Promise<IVersion> {

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',
}

View File

@ -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;

View File

@ -31,13 +31,10 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
{TVersion[systemInfo.branch]} v{systemInfo.version}
</Descriptions.Item>
<Descriptions.Item label="更新时间" span={3}>
{dayjs(systemInfo.lastCommitTime * 1000).format(
'YYYY-MM-DD HH:mm:ss',
{dayjs(systemInfo.publishTime * 1000).format(
'YYYY-MM-DD HH:mm',
)}
</Descriptions.Item>
<Descriptions.Item label="更新ID" span={3}>
{systemInfo.lastCommitId}
</Descriptions.Item>
<Descriptions.Item label="更新日志" span={3}>
<Link
href={`https://qn.whyour.cn/version.yaml?t=${Date.now()}`}

View File

@ -1,5 +1,6 @@
version: 2.15.17
changeLogLink: https://t.me/jiao_long/383
publishTime: 2023-07-11 23:51
changeLog: |
1. 系统设置增加定时任务并发数设置
2. 修改默认并发数