mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
complete auto update
This commit is contained in:
parent
5fc26d2249
commit
cd3c032723
|
@ -62,6 +62,7 @@
|
|||
"react-dom": "^18.3.1",
|
||||
"react-error-boundary": "^4.0.13",
|
||||
"react-icons": "^5.2.1",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-monaco-editor": "^0.56.0",
|
||||
"react-router-dom": "^6.26.0",
|
||||
"react-virtuoso": "^4.9.0",
|
||||
|
|
1303
pnpm-lock.yaml
1303
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -36,7 +36,19 @@ const UpdaterModal: React.FC<Props> = (props) => {
|
|||
scrollBehavior="inside"
|
||||
>
|
||||
<ModalContent className="h-full w-[calc(100%-100px)]">
|
||||
<ModalHeader className="flex">v{version} 版本就绪</ModalHeader>
|
||||
<ModalHeader className="flex justify-between">
|
||||
<div>v{version} 版本就绪</div>
|
||||
<Button
|
||||
color="primary"
|
||||
size="sm"
|
||||
className="flex"
|
||||
onPress={() => {
|
||||
open(`https://github.com/pompurin404/mihomo-party/releases/tag/v${version}`)
|
||||
}}
|
||||
>
|
||||
前往下载
|
||||
</Button>
|
||||
</ModalHeader>
|
||||
<ModalBody className="h-full">
|
||||
<ReactMarkdown
|
||||
className="markdown-body select-text"
|
||||
|
|
|
@ -3,6 +3,7 @@ import BasePage from '@renderer/components/base/base-page'
|
|||
import SettingCard from '@renderer/components/base/base-setting-card'
|
||||
import SettingItem from '@renderer/components/base/base-setting-item'
|
||||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||
import UpdaterModal from '@renderer/components/updater/updater-modal'
|
||||
import {
|
||||
checkAutoRun,
|
||||
enableAutoRun,
|
||||
|
@ -45,6 +46,10 @@ const Settings: React.FC = () => {
|
|||
webdavUsername,
|
||||
webdavPassword
|
||||
} = appConfig || {}
|
||||
const [newVersion, setNewVersion] = useState('')
|
||||
const [changelog, setChangelog] = useState('')
|
||||
const [openUpdate, setOpenUpdate] = useState(false)
|
||||
const [checkingUpdate, setCheckingUpdate] = useState(false)
|
||||
const [backuping, setBackuping] = useState(false)
|
||||
const [restoring, setRestoring] = useState(false)
|
||||
const [filenames, setFilenames] = useState<string[]>([])
|
||||
|
@ -114,6 +119,13 @@ const Settings: React.FC = () => {
|
|||
{restoreOpen && (
|
||||
<WebdavRestoreModal filenames={filenames} onClose={() => setRestoreOpen(false)} />
|
||||
)}
|
||||
{openUpdate && (
|
||||
<UpdaterModal
|
||||
onClose={() => setOpenUpdate(false)}
|
||||
version={newVersion}
|
||||
changelog={changelog}
|
||||
/>
|
||||
)}
|
||||
|
||||
<BasePage
|
||||
title="应用设置"
|
||||
|
@ -370,21 +382,22 @@ const Settings: React.FC = () => {
|
|||
<SettingItem title="检查更新" divider>
|
||||
<Button
|
||||
size="sm"
|
||||
isLoading={checkingUpdate}
|
||||
onPress={async () => {
|
||||
try {
|
||||
setCheckingUpdate(true)
|
||||
const version = await checkUpdate()
|
||||
|
||||
if (version) {
|
||||
new window.Notification(`v${version}版本已发布`, {
|
||||
body: '点击前往下载'
|
||||
}).onclick = (): void => {
|
||||
open(`https://github.com/pompurin404/mihomo-party/releases/tag/v${version}`)
|
||||
}
|
||||
setNewVersion(version.version)
|
||||
setChangelog(version.changelog)
|
||||
setOpenUpdate(true)
|
||||
} else {
|
||||
new window.Notification('当前已是最新版本', { body: '无需更新' })
|
||||
}
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
} finally {
|
||||
setCheckingUpdate(false)
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue
Block a user