Skip to content

Commit

Permalink
fix: 修复版本信息展示
Browse files Browse the repository at this point in the history
  • Loading branch information
bakashigure committed Oct 23, 2023
1 parent f941f88 commit 3f7ba11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/main/componentManager/components/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import CoreLoader from '@main/coreLoader'
import type { Component } from '@type/componentManager'
import fs from 'fs'
import path from 'path'
import Storage from '@main/storageManager'

import { getComponentBaseDir } from '../utils/path'
import { infoPathOf } from '../utils/update'

const storage = new Storage()

export const getComponentCore = async (): Promise<Component> => {
const coreLoader = new CoreLoader()
const installer = new CoreInstaller()
Expand All @@ -30,6 +33,7 @@ export const getComponentCore = async (): Promise<Component> => {
fs.writeFileSync(ver, coreVersion, 'utf-8') // always check version
const update = await installer.checkUpdate()
if (update.msg === 'haveUpdate') {
storage.set('setting.version.core.latest', update.update.version)
componentCore.status = 'upgradable'
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/renderer/src/assets/icons/new.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion packages/renderer/src/components/Setting/Version/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import IconBinary from '@/assets/icons/binary.svg?component'
import IconFolder from '@/assets/icons/folder.svg?component'
import IconInfo from '@/assets/icons/info.svg?component'
import IconNew from '@/assets/icons/new.svg?component'
import IconWindowUi from '@/assets/icons/window-ui.svg?component'
import useSettingStore from '@/store/settings'
import { NButton, NIcon, NSpace, NText, NTooltip, useThemeVars } from 'naive-ui'
Expand Down Expand Up @@ -78,7 +79,12 @@ onMounted(async () => {
<IconBinary />
</NIcon>
<NText type="info"> Maa Core: </NText>
<span>{{ versionString(versionCore) }}</span>
<span>{{ versionString(versionCore) }} </span>
<span v-if="needUpdate(versionCore)">
<NIcon size="25px" color="#7CFC00">
<IconNew />
</NIcon>
</span>
</NSpace>
</NButton>
</template>
Expand Down Expand Up @@ -106,6 +112,11 @@ onMounted(async () => {
<span>{{
needUpdate(versionUi) ? `UI可更新至${versionUi.latest},点击以更新` : '点击来管理'
}}</span>
<span v-if="needUpdate(versionUi)">
<NIcon size="25px" color="#7CFC00">
<IconNew />
</NIcon>
</span>
</NTooltip>
<NTooltip>
<template #trigger>
Expand Down

0 comments on commit 3f7ba11

Please sign in to comment.