From 82775deacb4a728005abedda2b863e576735d427 Mon Sep 17 00:00:00 2001 From: josc146 Date: Sun, 21 May 2023 09:48:10 +0800 Subject: [PATCH] notifyEvenLatest --- frontend/src/_locales/zh-hans/main.json | 3 ++- frontend/src/pages/Settings.tsx | 2 +- frontend/src/utils/index.tsx | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/_locales/zh-hans/main.json b/frontend/src/_locales/zh-hans/main.json index 82051df..1ad989f 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -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": "已是最新版" } \ No newline at end of file diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index 6f9207f..70a4c8a 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -60,7 +60,7 @@ export const Settings: FC = observer(() => { autoUpdatesCheck: data.checked }); if (data.checked) - checkUpdate(); + checkUpdate(true); }}/> }/> diff --git a/frontend/src/utils/index.tsx b/frontend/src/utils/index.tsx index 7e9b8f7..255754b 100644 --- a/frontend/src/utils/index.tsx +++ b/frontend/src/utils/index.tsx @@ -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.');