add giteeUpdatesSource
This commit is contained in:
parent
b2960052d9
commit
c98c32f2f6
@ -96,5 +96,6 @@
|
||||
"Install": "安装",
|
||||
"This is the latest version": "已是最新版",
|
||||
"Use Tsinghua Pip Mirrors": "使用清华大学Pip镜像源",
|
||||
"Model Config Exception": "模型配置异常"
|
||||
"Model Config Exception": "模型配置异常",
|
||||
"Use Gitee Updates Source": "使用Gitee更新源"
|
||||
}
|
@ -18,6 +18,7 @@ export type SettingsType = {
|
||||
language: Language,
|
||||
darkMode: boolean
|
||||
autoUpdatesCheck: boolean
|
||||
giteeUpdatesSource: boolean
|
||||
cnMirror: boolean
|
||||
}
|
||||
|
||||
@ -64,6 +65,17 @@ export const Settings: FC = observer(() => {
|
||||
checkUpdate(true);
|
||||
}} />
|
||||
} />
|
||||
{
|
||||
commonStore.settings.language === 'zh' &&
|
||||
<Labeled label={t('Use Gitee Updates Source')} flex spaceBetween content={
|
||||
<Switch checked={commonStore.settings.giteeUpdatesSource}
|
||||
onChange={(e, data) => {
|
||||
commonStore.setSettings({
|
||||
giteeUpdatesSource: data.checked
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
{
|
||||
commonStore.settings.language === 'zh' &&
|
||||
<Labeled label={t('Use Tsinghua Pip Mirrors')} flex spaceBetween content={
|
||||
|
@ -50,6 +50,7 @@ class CommonStore {
|
||||
language: getUserLanguage(),
|
||||
darkMode: !isSystemLightMode(),
|
||||
autoUpdatesCheck: true,
|
||||
giteeUpdatesSource: getUserLanguage() === 'zh',
|
||||
cnMirror: getUserLanguage() === 'zh'
|
||||
};
|
||||
|
||||
|
@ -210,13 +210,18 @@ export function bytesToKb(size: number) {
|
||||
|
||||
export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
||||
let updateUrl = '';
|
||||
await fetch('https://api.github.com/repos/josstorer/RWKV-Runner/releases/latest').then((r) => {
|
||||
await fetch(!commonStore.settings.giteeUpdatesSource ?
|
||||
'https://api.github.com/repos/josstorer/RWKV-Runner/releases/latest' :
|
||||
'https://gitee.com/api/v5/repos/josc146/RWKV-Runner/releases/latest'
|
||||
).then((r) => {
|
||||
if (r.ok) {
|
||||
r.json().then((data) => {
|
||||
if (data.tag_name) {
|
||||
const versionTag = data.tag_name;
|
||||
if (versionTag.replace('v', '') > manifest.version) {
|
||||
updateUrl = `https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`;
|
||||
updateUrl = !commonStore.settings.giteeUpdatesSource ?
|
||||
`https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe` :
|
||||
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`;
|
||||
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
||||
deletePythonProgramFiles();
|
||||
setTimeout(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user