notifyEvenLatest

This commit is contained in:
josc146 2023-05-21 09:48:10 +08:00
parent b8f7582513
commit 82775deacb
3 changed files with 8 additions and 3 deletions

View File

@ -93,5 +93,6 @@
"Can not find download url": "找不到下载地址",
"Python target not found, would you like to download it?": "没有找到目标Python, 是否下载?",
"Python dependencies are incomplete, would you like to install them?": "Python依赖缺失, 是否安装?",
"Install": "安装"
"Install": "安装",
"This is the latest version": "已是最新版"
}

View File

@ -60,7 +60,7 @@ export const Settings: FC = observer(() => {
autoUpdatesCheck: data.checked
});
if (data.checked)
checkUpdate();
checkUpdate(true);
}}/>
}/>
</div>

View File

@ -208,7 +208,7 @@ export function bytesToKb(size: number) {
return (size / 1024).toFixed(2);
}
export async function checkUpdate() {
export async function checkUpdate(notifyEvenLatest: boolean = false) {
let updateUrl = '';
await fetch('https://api.github.com/repos/josstorer/RWKV-Runner/releases/latest').then((r) => {
if (r.ok) {
@ -232,6 +232,10 @@ export async function checkUpdate() {
autoClose: false,
position: 'bottom-left'
});
} else {
if (notifyEvenLatest) {
toast(t('This is the latest version'), {type: 'success', position: 'bottom-left', autoClose: 2000});
}
}
} else {
throw new Error('Invalid response.');