From 380bfd2216aae94a59cb3893a6bf4b488d71cd35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Mon, 13 Jul 2026 22:32:09 +0800 Subject: [PATCH] feat: add Tolaria ice-lake UI patch set --- apps/README.md | 3 + apps/tolaria/README.md | 41 ++ ...at-add-Guanghu-ice-lake-visual-layer.patch | 242 ++++++++++ ...updater-coverage-with-Guanghu-policy.patch | 442 ++++++++++++++++++ 4 files changed, 728 insertions(+) create mode 100644 apps/tolaria/README.md create mode 100644 apps/tolaria/patches/0001-feat-add-Guanghu-ice-lake-visual-layer.patch create mode 100644 apps/tolaria/patches/0002-test-align-updater-coverage-with-Guanghu-policy.patch diff --git a/apps/README.md b/apps/README.md index 424bb4a..3b93b65 100644 --- a/apps/README.md +++ b/apps/README.md @@ -6,3 +6,6 @@ Tolaria / 光湖 App 的产品边界、授权模型和版本路线见 [`../architecture/TOLARIA-DESKTOP-ARCHITECTURE.md`](../architecture/TOLARIA-DESKTOP-ARCHITECTURE.md)。 + +当前可编译基线、光湖定制补丁与验证入口见 +[`tolaria/README.md`](tolaria/README.md)。 diff --git a/apps/tolaria/README.md b/apps/tolaria/README.md new file mode 100644 index 0000000..339eb73 --- /dev/null +++ b/apps/tolaria/README.md @@ -0,0 +1,41 @@ +# Tolaria / 光湖 App · 研发入口 + +> 产品名:冰朔通感语言核操作系统的人类协作界面 +> +> 研发主仓:HoloLake Platform +> +> 源码基线:`bingshuo/guanghu`(上游 Tolaria 兼容零件基线) + +这里是 Tolaria / 光湖 App 的研发入口,不把整份第三方上游源码复制进 +平台仓。平台仓保存产品边界、可审计的定制补丁、验证约定与发布说明; +`guanghu` 仅承担上游兼容与零件基线的职责。 + +## 当前界面迭代 · 冰湖视觉层 + +`patches/` 中的补丁按编号顺序应用: + +1. `0001-feat-add-Guanghu-ice-lake-visual-layer.patch` + - 为浅色与深色模式增加冰湖光层、网格层和语义颜色; + - 升级侧栏、文档面与编辑区的视觉层次; + - 将 HLDP 光湖入口渲染为有状态、可聚焦的路径卡片。 +2. `0002-test-align-updater-coverage-with-Guanghu-policy.patch` + - 固化“光湖不使用 Tolaria 上游应用更新源”的既有策略; + - 使更新器测试验证不联网、不下载、不重启的安全边界。 + +## 恢复与验证 + +```bash +git clone https://guanghubingshuo.com/code/bingshuo/guanghu.git +cd guanghu +git am /path/to/0001-feat-add-Guanghu-ice-lake-visual-layer.patch +git am /path/to/0002-test-align-updater-coverage-with-Guanghu-policy.patch +pnpm build +pnpm lint +``` + +## 研发规则 + +- 新的页面、渲染模块和交互协议先在本目录登记,再以独立补丁落到可编译基线; +- 知识库、仓库路径、关系和编号以仓库文件为事实源,界面只做可读转译; +- UI 不保存服务器 token、密码、验证码或私钥;现实操作仍须走工单、授权、回执闭环; +- 后续模块以可安装/可移除包发布,并声明依赖、权限与兼容版本。 diff --git a/apps/tolaria/patches/0001-feat-add-Guanghu-ice-lake-visual-layer.patch b/apps/tolaria/patches/0001-feat-add-Guanghu-ice-lake-visual-layer.patch new file mode 100644 index 0000000..1c73ee7 --- /dev/null +++ b/apps/tolaria/patches/0001-feat-add-Guanghu-ice-lake-visual-layer.patch @@ -0,0 +1,242 @@ +From 7124ee354529adc521cd88c2636b303e4b06572b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> +Date: Mon, 13 Jul 2026 22:10:51 +0800 +Subject: [PATCH 1/2] feat: add Guanghu ice-lake visual layer + + +diff --git a/src/App.css b/src/App.css +index 9567c88ea05326be90cfc8ac186e4d63915ae926..6fda5f493429d1ad1d80eaeb52c0695178d64d22 100644 +--- a/src/App.css ++++ b/src/App.css +@@ -5,7 +5,11 @@ + height: 100%; + width: 100%; + overflow: hidden; +- box-shadow: inset 0 0 0 1px var(--border-primary); ++ background: ++ radial-gradient(58rem 35rem at 82% -16%, var(--guanghu-aurora), transparent 62%), ++ radial-gradient(42rem 30rem at -12% 112%, var(--guanghu-glow), transparent 65%), ++ var(--surface-app); ++ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border-primary) 82%, var(--accent-blue)); + } + + .app { +@@ -20,6 +24,7 @@ + min-width: 220px; + display: flex; + flex-direction: column; ++ background: linear-gradient(180deg, color-mix(in srgb, var(--surface-sidebar) 92%, var(--guanghu-glow)), var(--surface-sidebar)); + } + + .app__sidebar > * { +@@ -37,7 +42,9 @@ + flex-direction: column; + position: relative; + z-index: 20; +- background: var(--surface-sidebar); ++ background: ++ linear-gradient(180deg, color-mix(in srgb, var(--surface-sidebar) 94%, var(--guanghu-glow)), var(--surface-sidebar)); ++ box-shadow: 14px 0 30px color-mix(in srgb, var(--surface-app) 60%, transparent); + } + + .app__note-list > * { +@@ -54,6 +61,26 @@ + flex-direction: column; + container-type: inline-size; + container-name: editor; ++ position: relative; ++ background: ++ linear-gradient(var(--guanghu-grid) 1px, transparent 1px), ++ linear-gradient(90deg, var(--guanghu-grid) 1px, transparent 1px), ++ color-mix(in srgb, var(--surface-editor) 94%, var(--guanghu-glow)); ++ background-size: 32px 32px, 32px 32px, auto; ++} ++ ++.app__editor::before { ++ content: ''; ++ position: absolute; ++ inset: 0; ++ pointer-events: none; ++ background: linear-gradient(180deg, color-mix(in srgb, var(--surface-editor) 28%, transparent), transparent 13rem); ++ z-index: 0; ++} ++ ++.app__editor > * { ++ position: relative; ++ z-index: 1; + } + + .app__editor > * { +diff --git a/src/components/Editor.css b/src/components/Editor.css +index 499b72fa1f58e39317a74c1515a6d073bffa04d3..132fc3fc5c6e2cfb3a85ac5263f18ce0e6697bd9 100644 +--- a/src/components/Editor.css ++++ b/src/components/Editor.css +@@ -24,14 +24,36 @@ + + .guanghu-portal-card { + width: 100%; +- margin: 0.5rem 0; +- padding: 1rem 1.1rem; +- border: 1px solid color-mix(in srgb, var(--colors-accent) 38%, var(--colors-border)); +- border-radius: 0.85rem; ++ margin: 1.1rem 0; ++ padding: 1.15rem 1.25rem 1.2rem; ++ border: 1px solid color-mix(in srgb, var(--colors-accent) 46%, var(--colors-border)); ++ border-radius: 1rem; + background: +- radial-gradient(circle at top right, color-mix(in srgb, var(--colors-accent) 16%, transparent), transparent 48%), +- var(--colors-surface); +- box-shadow: 0 0.35rem 1.25rem color-mix(in srgb, black 10%, transparent); ++ linear-gradient(135deg, color-mix(in srgb, var(--colors-accent) 16%, transparent), transparent 42%), ++ radial-gradient(circle at 92% 16%, color-mix(in srgb, var(--colors-accent) 25%, transparent), transparent 36%), ++ var(--guanghu-card-highlight, var(--colors-surface)); ++ box-shadow: ++ 0 0.8rem 2.2rem color-mix(in srgb, black 14%, transparent), ++ inset 0 1px 0 color-mix(in srgb, white 28%, transparent); ++ overflow: hidden; ++ position: relative; ++ transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease; ++} ++ ++.guanghu-portal-card::before { ++ content: ''; ++ position: absolute; ++ inset: 0 auto 0 0; ++ width: 3px; ++ background: linear-gradient(var(--colors-accent), color-mix(in srgb, var(--colors-accent) 12%, transparent)); ++} ++ ++.guanghu-portal-card:hover { ++ border-color: color-mix(in srgb, var(--colors-accent) 72%, var(--colors-border)); ++ box-shadow: ++ 0 1rem 2.6rem color-mix(in srgb, var(--colors-accent) 18%, transparent), ++ inset 0 1px 0 color-mix(in srgb, white 32%, transparent); ++ transform: translateY(-1px); + } + + .guanghu-portal-card__eyebrow { +@@ -39,31 +61,36 @@ + align-items: center; + justify-content: space-between; + gap: 0.75rem; +- margin-bottom: 0.55rem; ++ margin-bottom: 0.7rem; + color: var(--colors-text-muted); + font-size: 0.72rem; +- letter-spacing: 0.08em; ++ font-weight: 650; ++ letter-spacing: 0.1em; ++ text-transform: uppercase; + } + + .guanghu-portal-card__status { +- padding: 0.18rem 0.55rem; ++ padding: 0.22rem 0.6rem; + border-radius: 999px; +- background: color-mix(in srgb, var(--colors-accent) 18%, transparent); ++ border: 1px solid color-mix(in srgb, var(--colors-accent) 28%, transparent); ++ background: color-mix(in srgb, var(--colors-accent) 16%, transparent); + color: var(--colors-text); + letter-spacing: normal; + } + + .guanghu-portal-card__title { + display: inline-flex; +- font-size: 1.08rem; +- font-weight: 650; ++ font-size: 1.15rem; ++ font-weight: 720; ++ letter-spacing: -0.015em; + } + + .guanghu-portal-card__description { +- margin: 0.45rem 0 0; ++ max-width: 68ch; ++ margin: 0.55rem 0 0; + color: var(--colors-text-muted); + font-size: 0.9rem; +- line-height: 1.55; ++ line-height: 1.65; + } + + /* Breadcrumb bar: border can still react to the data attribute, but the +@@ -116,6 +143,7 @@ body.mac-chrome .app:not(:has(.app__sidebar)):not(:has(.app__note-list)) .breadc + overflow-anchor: none; + display: flex; + flex-direction: column; ++ scrollbar-color: color-mix(in srgb, var(--accent-blue) 42%, transparent) transparent; + } + + .editor-scroll-area--sheet { +@@ -165,7 +193,7 @@ body.mac-chrome .app:not(:has(.app__sidebar)):not(:has(.app__note-list)) .breadc + .editor__blocknote-container .bn-container { + width: 100%; + height: 100%; +- background: var(--bg-primary); ++ background: color-mix(in srgb, var(--bg-primary) 92%, transparent); + color: var(--text-primary); + font-size: 15px; + /* Override BlockNote's internal color variables so .bn-editor background +@@ -187,7 +215,28 @@ body.mac-chrome .app:not(:has(.app__sidebar)):not(:has(.app__note-list)) .breadc + + .editor__blocknote-container .bn-editor { + width: 100%; +- padding: 20px 0; ++ padding: 36px 0 72px; ++} ++ ++.editor__blocknote-container .bn-editor > .bn-block-group { ++ padding: 1.25rem clamp(1rem, 3vw, 2.25rem) 3rem; ++ border: 1px solid color-mix(in srgb, var(--border-primary) 82%, transparent); ++ border-radius: 1.25rem; ++ background: color-mix(in srgb, var(--surface-editor) 86%, transparent); ++ box-shadow: 0 1.3rem 3.5rem color-mix(in srgb, black 8%, transparent); ++ backdrop-filter: blur(16px); ++} ++ ++@media (max-width: 720px) { ++ .app__editor { ++ background-size: 22px 22px, 22px 22px, auto; ++ } ++ ++ .editor__blocknote-container .bn-editor > .bn-block-group { ++ border-inline: 0; ++ border-radius: 0; ++ box-shadow: none; ++ } + } + + .editor__blocknote-container .bn-suggestion-menu { +diff --git a/src/index.css b/src/index.css +index 9cbf80a57238229b320ffb779703f5ef4e129839..7bbaa4c5260d434a23997eedc54430f71acde88e 100644 +--- a/src/index.css ++++ b/src/index.css +@@ -179,6 +179,12 @@ + --hover: var(--state-hover); + --link-color: var(--accent-blue); + --link-hover: var(--accent-blue-hover); ++ ++ /* Guanghu visual layer — an app-owned, ice-lake palette. */ ++ --guanghu-aurora: rgba(91, 181, 255, 0.2); ++ --guanghu-glow: rgba(38, 131, 235, 0.15); ++ --guanghu-grid: rgba(42, 113, 188, 0.06); ++ --guanghu-card-highlight: rgba(255, 255, 255, 0.76); + } + + :root.dark, +@@ -330,6 +336,12 @@ + --hover: var(--state-hover); + --link-color: var(--accent-blue); + --link-hover: var(--accent-blue-hover); ++ ++ /* Guanghu visual layer — deep lake, not a flat black canvas. */ ++ --guanghu-aurora: rgba(76, 174, 255, 0.2); ++ --guanghu-glow: rgba(20, 118, 214, 0.24); ++ --guanghu-grid: rgba(126, 202, 255, 0.055); ++ --guanghu-card-highlight: rgba(28, 54, 80, 0.72); + } + + /* --- Tailwind v4 theme inline: register colors + radii --- */ +-- +2.50.1 (Apple Git-155) + diff --git a/apps/tolaria/patches/0002-test-align-updater-coverage-with-Guanghu-policy.patch b/apps/tolaria/patches/0002-test-align-updater-coverage-with-Guanghu-policy.patch new file mode 100644 index 0000000..f246aab --- /dev/null +++ b/apps/tolaria/patches/0002-test-align-updater-coverage-with-Guanghu-policy.patch @@ -0,0 +1,442 @@ +From 831c82f7a89d2a7865cd28a9ddf1fc71807f002c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> +Date: Mon, 13 Jul 2026 22:15:22 +0800 +Subject: [PATCH 2/2] test: align updater coverage with Guanghu policy + + +diff --git a/src/hooks/useUpdater.test.ts b/src/hooks/useUpdater.test.ts +index ad1a70fe0c54acf8f78aa9eeb5e00d07c5fd585d..cada95a14349a130cf4dd0dde01815bb7f088d4a 100644 +--- a/src/hooks/useUpdater.test.ts ++++ b/src/hooks/useUpdater.test.ts +@@ -1,10 +1,6 @@ +-import { renderHook, act } from '@testing-library/react' +-import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest' ++import { act, renderHook } from '@testing-library/react' ++import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + import { useUpdater } from './useUpdater' +-import { +- clearRestartRequiredAfterUpdate, +- isRestartRequiredAfterUpdate, +-} from '../lib/appUpdater' + + vi.mock('../mock-tauri', () => ({ + isTauri: vi.fn(() => false), +@@ -16,278 +12,68 @@ vi.mock('../utils/url', () => ({ + })) + + const mockInvoke = vi.fn() +- + vi.mock('@tauri-apps/api/core', () => ({ + invoke: (...args: unknown[]) => mockInvoke(...args), +- Channel: class { +- onmessage: (response: unknown) => void +- +- constructor(onmessage?: (response: unknown) => void) { +- this.onmessage = onmessage ?? (() => {}) +- } +- }, + })) + + import { isTauri } from '../mock-tauri' + +-interface AppUpdateMetadata { +- currentVersion: string +- version: string +- date?: string +- body?: string +-} +- +-type DownloadArgs = { +- releaseChannel: string +- expectedVersion: string +- onEvent: { +- onmessage: ( +- response: +- | { event: 'Started'; data: { contentLength?: number } } +- | { event: 'Progress'; data: { chunkLength: number } } +- | { event: 'Finished' }, +- ) => void +- } +-} +- +-function makeUpdate(overrides: Partial = {}): AppUpdateMetadata { +- return { +- currentVersion: '2026.4.15', +- version: '2026.4.16', +- body: 'Bug fixes and improvements', +- ...overrides, +- } +-} +- +-function installInvokeHandlers({ +- checkResult = null, +- downloadImpl, +-}: { +- checkResult?: AppUpdateMetadata | null | Error +- downloadImpl?: (args: DownloadArgs) => Promise +-}) { +- mockInvoke.mockImplementation((command: string, args?: unknown) => { +- if (command === 'check_for_app_update') { +- if (checkResult instanceof Error) return Promise.reject(checkResult) +- return Promise.resolve(checkResult) +- } +- +- if (command === 'download_and_install_app_update') { +- if (downloadImpl) return downloadImpl(args as DownloadArgs) +- return Promise.resolve(null) +- } +- +- return Promise.resolve(null) +- }) +-} +- +-function renderUpdater(releaseChannel: string, automaticChecksEnabled = true) { +- return renderHook(() => useUpdater(releaseChannel, automaticChecksEnabled)) +-} +- +-async function performManualCheck( +- releaseChannel: string, +- checkResult: AppUpdateMetadata | null | Error, +-) { +- vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ checkResult }) +- +- const hook = renderUpdater(releaseChannel) +- let outcome: string | undefined +- +- await act(async () => { +- outcome = await hook.result.current.actions.checkForUpdates() +- }) +- +- return { result: hook.result, outcome } +-} +- +-async function advanceAutoCheck() { +- await act(async () => { +- await vi.advanceTimersByTimeAsync(3500) +- }) ++function renderUpdater(automaticChecksEnabled = true) { ++ return renderHook(() => useUpdater('stable', automaticChecksEnabled)) + } + + describe('useUpdater', () => { + beforeEach(() => { + vi.useFakeTimers() + vi.clearAllMocks() +- clearRestartRequiredAfterUpdate() +- vi.spyOn(console, 'warn').mockImplementation(() => {}) + }) + + afterEach(() => { + vi.useRealTimers() +- vi.restoreAllMocks() +- }) +- +- it('starts in idle state', () => { +- vi.mocked(isTauri).mockReturnValue(false) +- +- const { result } = renderUpdater('stable') +- +- expect(result.current.status).toEqual({ state: 'idle' }) + }) + +- it('does not check for updates when not running in Tauri', async () => { +- vi.mocked(isTauri).mockReturnValue(false) +- +- renderUpdater('stable') +- await advanceAutoCheck() +- +- expect(mockInvoke).not.toHaveBeenCalled() ++ it('starts in an idle state', () => { ++ expect(renderUpdater().result.current.status).toEqual({ state: 'idle' }) + }) + +- it('checks for stable updates after the startup delay', async () => { ++ it('never schedules an updater request in the Guanghu distribution', async () => { + vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ checkResult: null }) + +- renderUpdater('stable') +- await advanceAutoCheck() +- +- expect(mockInvoke).toHaveBeenCalledWith('check_for_app_update', { +- releaseChannel: 'stable', ++ renderUpdater() ++ await act(async () => { ++ await vi.advanceTimersByTimeAsync(3500) + }) +- }) +- +- it('does not automatically check for updates when automatic checks are disabled', async () => { +- vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ checkResult: makeUpdate() }) +- +- renderUpdater('stable', false) +- await advanceAutoCheck() + + expect(mockInvoke).not.toHaveBeenCalled() + }) + +- it('keeps manual update checks available when automatic checks are disabled', async () => { ++ it('keeps a manual check local and idle', async () => { + vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ checkResult: null }) +- +- const { result } = renderUpdater('stable', false) ++ const { result } = renderUpdater(false) + + let outcome: unknown + await act(async () => { + outcome = await result.current.actions.checkForUpdates() + }) + +- expect(outcome).toEqual({ kind: 'up-to-date' }) +- expect(mockInvoke).toHaveBeenCalledWith('check_for_app_update', { +- releaseChannel: 'stable', +- }) +- }) +- +- it('transitions to available when an alpha update is found', async () => { +- const { result } = await performManualCheck( +- 'alpha', +- makeUpdate({ version: '2026.4.16-alpha.3' }), +- ) +- +- expect(result.current.status).toEqual({ +- state: 'available', +- version: '2026.4.16-alpha.3', +- displayVersion: 'Alpha 2026.4.16.3', +- notes: 'Bug fixes and improvements', +- }) +- +- expect(mockInvoke).toHaveBeenCalledWith('check_for_app_update', { +- releaseChannel: 'alpha', +- }) +- }) +- +- it('returns up-to-date when no update is available', async () => { +- const { result, outcome } = await performManualCheck('stable', null) +- + expect(outcome).toEqual({ kind: 'up-to-date' }) + expect(result.current.status).toEqual({ state: 'idle' }) ++ expect(mockInvoke).not.toHaveBeenCalled() + }) + +- it('shows checking state while a manual update check is in flight', async () => { +- vi.mocked(isTauri).mockReturnValue(true) +- let resolveCheck: (value: AppUpdateMetadata | null) => void = () => {} +- mockInvoke.mockImplementation((command: string) => { +- if (command === 'check_for_app_update') { +- return new Promise((resolve) => { +- resolveCheck = resolve +- }) +- } +- return Promise.resolve(null) +- }) +- +- const { result } = renderUpdater('stable') ++ it('does not download or restart from a disabled update channel', async () => { ++ const { result } = renderUpdater() + +- let checkPromise: Promise | null = null + await act(async () => { +- checkPromise = result.current.actions.checkForUpdates() +- await Promise.resolve() +- }) +- +- expect(result.current.status).toEqual({ state: 'checking' }) +- +- await act(async () => { +- resolveCheck(null) +- expect(await checkPromise).toEqual({ kind: 'up-to-date' }) ++ await result.current.actions.startDownload() + }) + + expect(result.current.status).toEqual({ state: 'idle' }) ++ expect(mockInvoke).not.toHaveBeenCalled() + }) + +- it('returns available and sets status when an update exists', async () => { +- const { result, outcome } = await performManualCheck( +- 'stable', +- makeUpdate({ body: undefined }), +- ) +- +- expect(outcome).toEqual({ +- kind: 'available', +- version: '2026.4.16', +- displayVersion: '2026.4.16', +- }) +- expect(result.current.status).toEqual({ +- state: 'available', +- version: '2026.4.16', +- displayVersion: '2026.4.16', +- notes: undefined, +- }) +- }) +- +- it('strips stable prerelease suffixes from the display version', async () => { +- const { result } = await performManualCheck( +- 'stable', +- makeUpdate({ version: '2026.4.16-stable.1' }), +- ) +- +- expect(result.current.status).toEqual({ +- state: 'available', +- version: '2026.4.16-stable.1', +- displayVersion: '2026.4.16', +- notes: 'Bug fixes and improvements', +- }) +- }) +- +- it('returns error when the update check fails', async () => { +- const { result, outcome } = await performManualCheck( +- 'stable', +- new Error('network error'), +- ) +- +- expect(outcome).toEqual({ +- kind: 'error', +- message: 'Could not check for updates: network error', +- }) +- expect(console.warn).toHaveBeenCalledWith('[updater] Failed to check for updates') +- expect(result.current.status).toEqual({ state: 'error' }) +- }) +- +- it('dismiss resets the banner state', async () => { +- vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ checkResult: makeUpdate() }) +- +- const { result } = renderUpdater('stable') +- +- await act(async () => { +- await result.current.actions.checkForUpdates() +- }) ++ it('keeps dismiss as a safe idle-state reset', () => { ++ const { result } = renderUpdater() + + act(() => { + result.current.actions.dismiss() +@@ -296,72 +82,13 @@ describe('useUpdater', () => { + expect(result.current.status).toEqual({ state: 'idle' }) + }) + +- it('openReleaseNotes opens the release notes page', () => { +- vi.mocked(isTauri).mockReturnValue(false) +- +- const { result } = renderUpdater('stable') ++ it('opens release notes without enabling application updates', () => { ++ const { result } = renderUpdater() + + act(() => { + result.current.actions.openReleaseNotes() + }) + +- expect(mockOpenExternalUrl).toHaveBeenCalledWith( +- 'https://tolaria.md/releases/' +- ) +- }) +- +- it('downloads and installs the available update with progress', async () => { +- vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ +- checkResult: makeUpdate(), +- downloadImpl: async (args) => { +- expect(args.releaseChannel).toBe('stable') +- expect(args.expectedVersion).toBe('2026.4.16') +- args.onEvent.onmessage({ event: 'Started', data: { contentLength: 1000 } }) +- args.onEvent.onmessage({ event: 'Progress', data: { chunkLength: 500 } }) +- args.onEvent.onmessage({ event: 'Progress', data: { chunkLength: 500 } }) +- args.onEvent.onmessage({ event: 'Finished' }) +- }, +- }) +- +- const { result } = renderUpdater('stable') +- +- await act(async () => { +- await result.current.actions.checkForUpdates() +- }) +- +- await act(async () => { +- await result.current.actions.startDownload() +- }) +- +- expect(result.current.status).toEqual({ +- state: 'ready', +- version: '2026.4.16', +- displayVersion: '2026.4.16', +- }) +- expect(isRestartRequiredAfterUpdate()).toBe(true) +- }) +- +- it('transitions to error when download fails', async () => { +- vi.mocked(isTauri).mockReturnValue(true) +- installInvokeHandlers({ +- checkResult: makeUpdate(), +- downloadImpl: async () => { +- throw new Error('download failed') +- }, +- }) +- +- const { result } = renderUpdater('stable') +- +- await act(async () => { +- await result.current.actions.checkForUpdates() +- }) +- +- await act(async () => { +- await result.current.actions.startDownload() +- }) +- +- expect(console.warn).toHaveBeenCalledWith('[updater] Download failed') +- expect(result.current.status).toEqual({ state: 'error' }) ++ expect(mockOpenExternalUrl).toHaveBeenCalledWith('https://tolaria.md/releases/') + }) + }) +diff --git a/src/hooks/useUpdater.ts b/src/hooks/useUpdater.ts +index c99843b66cc82d282ae96fee4b5b2115c7a6197b..f6bb8796f59995dc6417652f7a6206b89a03c2ea 100644 +--- a/src/hooks/useUpdater.ts ++++ b/src/hooks/useUpdater.ts +@@ -10,6 +10,7 @@ import { formatCalendarVersionForDisplay } from '../utils/calendarVersion' + import { openExternalUrl } from '../utils/url' + + const RELEASE_NOTES_URL = 'https://tolaria.md/releases/' ++const GUANGHU_UPDATES_ENABLED = false + + interface UpdateVersionInfo { + version: string +@@ -99,12 +100,11 @@ export function useUpdater( + ): { status: UpdateStatus; actions: UpdateActions } { + // Guanghu is an independent open-source fork. Until Guanghu has its own + // signed release feed, never contact or install from Tolaria's updater. +- const updatesEnabled = false + const [status, setStatus] = useState({ state: 'idle' }) + const updateRef = useRef(null) + + const checkForUpdates = useCallback(async (): Promise => { +- if (!updatesEnabled) return { kind: 'up-to-date' } ++ if (!GUANGHU_UPDATES_ENABLED) return { kind: 'up-to-date' } + if (!isTauri()) return { kind: 'up-to-date' } + + setStatus({ state: 'checking' }) +@@ -129,7 +129,7 @@ export function useUpdater( + }, [releaseChannel]) + + useEffect(() => { +- if (!updatesEnabled) return ++ if (!GUANGHU_UPDATES_ENABLED) return + if (!automaticChecksEnabled) return + if (!isTauri()) return + const timer = setTimeout(() => { checkForUpdates() }, 3000) +@@ -137,7 +137,7 @@ export function useUpdater( + }, [automaticChecksEnabled, checkForUpdates]) + + const startDownload = useCallback(async () => { +- if (!updatesEnabled) return ++ if (!GUANGHU_UPDATES_ENABLED) return + const update = updateRef.current + if (!update) return + +-- +2.50.1 (Apple Git-155) +