mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
优化 Cookie 存储类型;更新登录状态判断逻辑;添加 Tauri 环境判断以支持版本更新处理
This commit is contained in:
61
src/main.ts
61
src/main.ts
@@ -1,5 +1,5 @@
|
||||
import { QueryGetAPI } from '@/api/query'
|
||||
import { apiFail, BASE_API_URL } from '@/data/constants'
|
||||
import { apiFail, BASE_API_URL, isTauri } from '@/data/constants'
|
||||
import HyperDX from '@hyperdx/browser'
|
||||
import EasySpeech from 'easy-speech'
|
||||
import { createDiscreteApi, NButton, NFlex, NText } from 'naive-ui'
|
||||
@@ -55,33 +55,38 @@ QueryGetAPI<string>(`${BASE_API_URL}vtsuru/version`)
|
||||
const path = url.pathname
|
||||
|
||||
if (!path.startsWith('/obs')) {
|
||||
const n = notification.info({
|
||||
title: '发现新的版本更新',
|
||||
content: '是否现在刷新?',
|
||||
meta: () => h(NText, { depth: 3 }, () => currentVersion),
|
||||
action: () =>
|
||||
h(NFlex, null, () => [
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
type: 'primary',
|
||||
onClick: () => location.reload(),
|
||||
size: 'small',
|
||||
},
|
||||
{ default: () => '刷新' },
|
||||
),
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
onClick: () => n.destroy(),
|
||||
size: 'small',
|
||||
},
|
||||
{ default: () => '稍后' },
|
||||
),
|
||||
]),
|
||||
})
|
||||
if (isTauri) {
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
const n = notification.info({
|
||||
title: '发现新的版本更新',
|
||||
content: '是否现在刷新?',
|
||||
meta: () => h(NText, { depth: 3 }, () => currentVersion),
|
||||
action: () =>
|
||||
h(NFlex, null, () => [
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
type: 'primary',
|
||||
onClick: () => location.reload(),
|
||||
size: 'small',
|
||||
},
|
||||
{ default: () => '刷新' },
|
||||
),
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
onClick: () => n.destroy(),
|
||||
size: 'small',
|
||||
},
|
||||
{ default: () => '稍后' },
|
||||
),
|
||||
]),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user