feat: add CheckUpdate
parent
3b36a6b7d8
commit
8a913e35aa
|
|
@ -13,7 +13,7 @@ edition = "2021"
|
||||||
tauri-build = { version = "1.2", features = [] }
|
tauri-build = { version = "1.2", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "1.2", features = ["fs-all", "path-all", "shell-execute", "shell-open", "shell-sidecar", "updater", "window-all"] }
|
tauri = { version = "1.2", features = ["fs-all", "path-all", "process-relaunch", "shell-execute", "shell-open", "shell-sidecar", "updater", "window-all"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
tokio = { version = "1.0", features = ["time"] }
|
tokio = { version = "1.0", features = ["time"] }
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "s3si-ts",
|
"productName": "s3si-ts",
|
||||||
"version": "0.3.3"
|
"version": "0.3.2"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|
@ -47,6 +47,10 @@
|
||||||
},
|
},
|
||||||
"path": {
|
"path": {
|
||||||
"all": true
|
"all": true
|
||||||
|
},
|
||||||
|
"process": {
|
||||||
|
"all": false,
|
||||||
|
"relaunch": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { ReactNode } from "react";
|
||||||
|
import { checkUpdate } from '@tauri-apps/api/updater'
|
||||||
|
|
||||||
|
export const CheckUpdate: React.FC<{ className?: string, children?: ReactNode }> = ({ className, children }) => {
|
||||||
|
const onClick = async () => {
|
||||||
|
try {
|
||||||
|
await checkUpdate()
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<button className={className} onClick={onClick}>{children}</button>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { CheckUpdate } from 'components/CheckUpdate';
|
||||||
import { ErrorContent } from 'components/ErrorContent';
|
import { ErrorContent } from 'components/ErrorContent';
|
||||||
import { Loading } from 'components/Loading';
|
import { Loading } from 'components/Loading';
|
||||||
import { STAT_INK } from 'constant';
|
import { STAT_INK } from 'constant';
|
||||||
|
|
@ -33,6 +34,7 @@ export const Home: React.FC = () => {
|
||||||
<div className='flex flex-col gap-2'>
|
<div className='flex flex-col gap-2'>
|
||||||
<Link to='/settings' className='btn btn-primary'>{t('配置')}</Link>
|
<Link to='/settings' className='btn btn-primary'>{t('配置')}</Link>
|
||||||
<a className='btn' href={STAT_INK} target='_blank' rel='noreferrer'>{t('前往 stat.ink')}</a>
|
<a className='btn' href={STAT_INK} target='_blank' rel='noreferrer'>{t('前往 stat.ink')}</a>
|
||||||
|
<CheckUpdate className='btn'>{t('检查更新')}</CheckUpdate>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue