Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(update): surface no-op installs and unify update toasts in the UI

hairyfe3f4bad9fef0
diff --git a/src/components/debug-sidebar.tsx b/src/components/debug-sidebar.tsx
index 8b509819..232d2fb3 100644
--- a/src/components/debug-sidebar.tsx
+++ b/src/components/debug-sidebar.tsx
@@ -1,6 +1,6 @@
import type { PropsWithChildren, ReactNode } from 'react'
-import { ArrowRotateRight, ArrowUpRightFromSquare, CircleInfo, Copy, Folder, Power, TrashBin } from '@gravity-ui/icons'
-import { Button, Chip, Description, Drawer, Input, ListBox, Select, Spinner, Surface, Switch, Tooltip } from '@heroui/react'
+import { ArrowRotateRight, ArrowUpRightFromSquare, ChevronRight, CircleInfo, Copy, Folder, Power, TrashBin } from '@gravity-ui/icons'
+import { Button, Chip, Description, Drawer, Input, Link, ListBox, Select, Spinner, Surface, Switch, Tooltip } from '@heroui/react'
import { useMutation, useQuery } from '@tanstack/react-query'
import { invoke } from '@tauri-apps/api/core'
import { useState } from 'react'
@@ -38,6 +38,7 @@ export interface AppConfig {
export function DebugSidebar(props: PropsWithChildren) {
const { t, i18n } = useTranslation()
const { serviceRunning, busyAction, preinstall } = useStore(store.harness)
+ const { updateInfo } = useStore(store.updater)
const [port, setPort] = useState<number>(3080)
@@ -193,7 +194,16 @@ export function DebugSidebar(props: PropsWithChildren) {
<div>
<dl className="space-y-1">
<InfoRow term={t('ui.current_version')}>{info?.app_version ?? '-'}</InfoRow>
- <InfoRow term={t('ui.dsh_version')}>{info?.dsh_version ?? '-'}</InfoRow>
+ <InfoRow term={t('ui.dsh_version')}>
+ <span>{info?.dsh_version ?? '-'}</span>
+ <If cond={updateInfo}>
+ <Link className="ml-2 text-[10px] text-[rgb(65,118,230)]" onClick={store.updater.showToast}>
+ 存在新版本
+ <ChevronRight className="scale-75" />
+ </Link>
+ </If>
+
+ </InfoRow>
<InfoRow term={t('ui.node_version')}>{info?.node_version ? `v${info.node_version}` : '-'}</InfoRow>
<InfoRow term="Platform">
{info ? `${info.platform} / ${info.arch}` : '-'}
diff --git a/src/components/desktop-updater.tsx b/src/components/desktop-updater.tsx
index 14d990e8..f831a486 100644
--- a/src/components/desktop-updater.tsx
+++ b/src/components/desktop-updater.tsx
@@ -45,6 +45,7 @@ export default function DesktopUpdater() {
},
variant: 'tertiary',
},
+ timeout: 0,
placement: 'bottom end',
description: t('update.desktop_new'),
variant: 'default',
diff --git a/src/components/harness-updater.tsx b/src/components/harness-updater.tsx
index ec00a490..4c0bfb1d 100644
--- a/src/components/harness-updater.tsx
+++ b/src/components/harness-updater.tsx
@@ -1,29 +1,14 @@
import { useWatch } from '@hairy/react-lib'
-import { useTranslation } from 'react-i18next'
import { useStore } from 'valtio-define'
-import { toast } from '@/utils'
import { updater } from '../store/modules/updater'
/** 右下角"发现新版本"提示条:状态与操作直接来自 updater store */
export default function HarnessUpdater() {
- const { t } = useTranslation()
const { updateInfo, updating } = useStore(updater)
useWatch([updateInfo, updating], () => {
if (!updateInfo || updating)
return null
- toast(t('update.available', { tag: updateInfo.tag }), {
- actionProps: {
- children: t('update.now'),
- onPress: () => {
- toast.clear()
- void updater.handleUpdate()
- },
- variant: 'tertiary',
- },
- placement: 'bottom end',
- description: updateInfo.commit.slice(0, 7),
- variant: 'default',
- })
+ updater.showToast()
}, { immediate: true })
return null
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 4df64c53..05fad938 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -43,11 +43,12 @@
"plugins.loading": "Loading plugins…",
"plugins.error": "Failed to load plugins",
"plugins.bundled": "Loaded",
- "update.available": "A new version {{tag}} is available. Update now?",
+ "update.available": "A new DSH version {{tag}} is available. Update now?",
"update.now": "Update Now",
"update.later": "Later",
"update.up_to_date": "You're up to date",
"update.check_failed": "Failed to check for updates — check your network and try again later",
+ "update.verify_failed": "Couldn't update right now: GitHub is rate-limited, so the new build couldn't be verified. Please try again later",
"update.desktop_title": "New version available",
"update.new_version_label": "New version",
"update.desktop_downloaded": "Installer already downloaded — ready to open",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index a3868829..64249c7e 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -43,11 +43,12 @@
"plugins.loading": "正在读取插件…",
"plugins.error": "插件读取失败",
"plugins.bundled": "已加载",
- "update.available": "发现新版本 {{tag}},是否立即更新?",
+ "update.available": "发现 DSH 新版本 {{tag}},是否立即更新?",
"update.now": "立即更新",
"update.later": "稍后",
"update.up_to_date": "已是最新版本",
"update.check_failed": "检查更新失败,请检查网络后重试",
+ "update.verify_failed": "暂时无法更新:GitHub 限流,未能校验新版完整性,请稍后重试",
"update.desktop_title": "发现新版本",
"update.new_version_label": "新版本",
"update.desktop_downloaded": "安装包已下载,可直接打开",
diff --git a/src/store/modules/updater/store.ts b/src/store/modules/updater/store.ts
index 826e5e07..6646fcb7 100644
--- a/src/store/modules/updater/store.ts
+++ b/src/store/modules/updater/store.ts
@@ -1,8 +1,9 @@
import type { UnlistenFn } from '@tauri-apps/api/event'
import type { DshUpdateInfo } from './types'
import { invoke } from '@tauri-apps/api/core'
-import i18next from 'i18next'
+import i18next, { t } from 'i18next'
import { defineStore } from 'valtio-define'
+import { toast } from '@/utils'
import { harness } from '../harness'
/**
@@ -35,12 +36,31 @@ export const updater = defineStore({
if (this.updating)
return
this.updating = true
- this.updateInfo = null
let unlistenInstall: UnlistenFn | null = null
try {
unlistenInstall = await harness.listenInstallProgress()
harness.prepareInstall(i18next.t('status.updating'))
- await invoke('install_dependencies')
+ // 返回是否真正落盘更新:false 表示未发生安装(已是最新,或 GitHub
+ // 限流拿不到可信摘要而保持本地安装)。此时绝不重启页面、也不丢弃
+ // “有新版本”提示——否则用户会看到“页面刷新了、版本却没变、提示也没了”。
+ const changed = await invoke<boolean>('install_dependencies')
+ if (!changed) {
+ // 回到就绪态(若当前停在安装/更新界面,则恢复到原 iframe 视图)
+ harness.status = 'ready'
+ // 重新核对一次:若确有新版,恢复“存在新版本”的提示并明确告知无法校验,
+ // 而非静默当作“已更新”成功。
+ this.updateInfo = null
+ try {
+ await this.checkForUpdate()
+ }
+ catch {
+ /* 核对失败保持 updateInfo 为空,交由下次轮询恢复 */
+ }
+ if (this.updateInfo) {
+ toast(i18next.t('update.verify_failed'), { variant: 'danger' })
+ }
+ return
+ }
await harness.launchAndWait()
this.updateInfo = null
}
@@ -58,5 +78,23 @@ export const updater = defineStore({
dismissUpdate() {
this.updateInfo = null
},
+
+ showToast() {
+ if (!this.updateInfo)
+ return
+ toast(t('update.available', { tag: this.updateInfo.tag }), {
+ actionProps: {
+ children: t('update.now'),
+ onPress: () => {
+ toast.clear()
+ void updater.handleUpdate()
+ },
+ variant: 'tertiary',
+ },
+ placement: 'bottom end',
+ description: this.updateInfo.commit.slice(0, 7),
+ variant: 'default',
+ })
+ },
},
})