fix(desktop): reconcile welcome startup with current update lifecycle
This commit is contained in:
1 parent
fe6702cb20
commit
d58c8cfcde
7 files changed
+27
-9
No files matched your search
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write apps/desktop/README.md
|
||||
README.md: 531c168c0d3fc3091a330f5350d0a85ac3009f08
|
||||
README.zh.md: 6a20f83623a54e8f87d05104280b97ddfb2a796a
|
||||
README.md: 29d8a04b6fb39757893e37547fc8a541aecb993f
|
||||
README.zh.md: cf6cc0fa88fe0f14d32c38cf777fcf82677b942e
|
||||
@@ -87,6 +87,7 @@ export function createElectronBuilderConfig(
|
||||
if (preparedRuntime !== undefined) buildPaths.dsh = preparedRuntime
|
||||
return {
|
||||
appId,
|
||||
protocols: [{ name: 'DeepSeek Harness', schemes: ['dsh'] }],
|
||||
extraMetadata: { dshDesktopAppId: appId, dshMandatoryUpdatePolicy: policy },
|
||||
productName: 'DeepSeek Harness',
|
||||
artifactName: 'deepseek-harness-${version}-${os}-${arch}.${ext}',
|
||||
|
||||
@@ -131,6 +131,8 @@ function createWindow(preload: string, show = false, primary = false): BrowserWi
|
||||
titleBarStyle: 'hiddenInset' as const,
|
||||
trafficLightPosition: { x: 16, y: 18 },
|
||||
vibrancy: 'sidebar' as const,
|
||||
// 'active' keeps the vibrancy material stable when the window blurs;
|
||||
// 'followWindow' washes the sidebar out behind an unfocused window.
|
||||
visualEffectState: 'active' as const,
|
||||
backgroundColor: '#00000000',
|
||||
} : {}),
|
||||
|
||||
@@ -351,6 +351,7 @@ describe('desktop main startup', () => {
|
||||
vi.stubGlobal('process', { ...process, platform })
|
||||
harness.app.isPackaged = packaged
|
||||
vi.spyOn(harness.app, 'getLocale').mockReturnValue(locale)
|
||||
vi.spyOn(harness.app, 'getPreferredSystemLanguages').mockReturnValue([locale])
|
||||
await readyForUpdate()
|
||||
const submenu = applicationMenuItems()
|
||||
const options = harness.app.setAboutPanelOptions.mock.calls[0]![0]
|
||||
|
||||
@@ -7,7 +7,7 @@ import { describe, expect, it, vi } from 'vitest'
|
||||
const preload = (name: string): string => fileURLToPath(new URL(`../lib/${name}.cjs`, import.meta.url))
|
||||
|
||||
describe.skipIf(!existsSync(preload('preload-app')))('built sandboxed Desktop preloads', () => {
|
||||
it.each(['preload', 'preload-app', 'preload-welcome'])('%s loads without filesystem module access', (name) => {
|
||||
it.each(['preload-app', 'preload-welcome'])('%s loads without filesystem module access', (name) => {
|
||||
const exposed = new Map<string, Record<string, unknown>>()
|
||||
const invoke = vi.fn(() => Promise.resolve({ languages: ['en-US'], preference: 'zh' }))
|
||||
const send = vi.fn()
|
||||
@@ -21,7 +21,8 @@ describe.skipIf(!existsSync(preload('preload-app')))('built sandboxed Desktop pr
|
||||
return electron
|
||||
},
|
||||
process: { argv: ['electron', '--dsh-welcome-locale=en'] },
|
||||
location: new URL('http://127.0.0.1:3080/'),
|
||||
location: new URL('dsh-app://app/'),
|
||||
document: { documentElement: { dataset: {} } },
|
||||
exports: {},
|
||||
})
|
||||
if (name === 'preload-app') {
|
||||
@@ -31,7 +32,7 @@ describe.skipIf(!existsSync(preload('preload-app')))('built sandboxed Desktop pr
|
||||
bridge.onChange('zh')
|
||||
expect(send).toHaveBeenCalledWith('dsh-desktop:locale-changed', 'zh')
|
||||
} else {
|
||||
expect(exposed.has(name === 'preload' ? 'dshDesktop' : 'dshWelcome')).toBe(true)
|
||||
expect(exposed.has('dshWelcome')).toBe(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -101,7 +101,7 @@ describe.skipIf(!existsSync(builtHost))('built Desktop welcome flow', () => {
|
||||
cpSync(join(repository, 'packages/skill/skill-office/assets'), join(root, 'runtime/office-skills'), { recursive: true })
|
||||
const paths = resolveDesktopPaths(home)
|
||||
const manager = new DesktopProjectManager(paths, {
|
||||
node: process.execPath, pnpm: join(repository, 'apps/desktop/node_modules/pnpm/bin/pnpm.mjs'), dsh: project,
|
||||
dsh: project,
|
||||
})
|
||||
await manager.applyRelease()
|
||||
writeFileSync(join(paths.profile, 'cordis.patch.yml'), `- id: webserver\n config:\n host: 127.0.0.1\n port: 0\n- id: deepseek-account\n config:\n platformOrigin: ${platform.origin}\n allowLoopbackHttp: true\n requestHeaders:\n Cookie: test_gate=synthetic\n`)
|
||||
|
||||
@@ -30,12 +30,15 @@ vi.mock('electron', () => ({
|
||||
setAsDefaultProtocolClient: vi.fn(),
|
||||
whenReady: () => Promise.resolve(),
|
||||
getLocale: () => 'en',
|
||||
getVersion: () => '1.0.0',
|
||||
setAboutPanelOptions: vi.fn(),
|
||||
getAppPath: () => '/development-app',
|
||||
getPreferredSystemLanguages: () => ['en-US'],
|
||||
on: vi.fn(),
|
||||
quit: state.quit,
|
||||
exit: vi.fn(),
|
||||
},
|
||||
powerMonitor: { on: vi.fn(), off: vi.fn() },
|
||||
BrowserWindow: class {
|
||||
constructor(options: unknown) { state.windowOptions = options }
|
||||
private ready: (() => void) | undefined
|
||||
@@ -79,7 +82,16 @@ vi.mock('../src/welcome-backend.ts', () => ({
|
||||
account: { watch: () => () => {}, state: async () => ({ status: 'signed-out', attempt: null }) },
|
||||
}),
|
||||
}))
|
||||
vi.mock('../src/update-coordinator.ts', () => ({ DesktopUpdateCoordinator: vi.fn() }))
|
||||
vi.mock('node:fs/promises', async importOriginal => ({
|
||||
...await importOriginal<typeof import('node:fs/promises')>(),
|
||||
readFile: vi.fn(async () => '{}'),
|
||||
}))
|
||||
vi.mock('../src/update-dialog.ts', () => ({ DesktopUpdateDialog: class { dispose() {} } }))
|
||||
vi.mock('../src/update-coordinator.ts', () => ({ DesktopUpdateCoordinator: class {
|
||||
state = { phase: 'idle' }
|
||||
check = vi.fn(async () => this.state)
|
||||
dispose = vi.fn()
|
||||
} }))
|
||||
vi.mock('../src/welcome-window.ts', () => ({
|
||||
openWelcomeWindow: (locale: unknown, operations: WelcomeOperations) => {
|
||||
state.welcomeLocale = locale
|
||||
@@ -104,6 +116,8 @@ it('starts the Host for a forced welcome preview and opens the workspace on skip
|
||||
vi.stubEnv('DSH_DESKTOP_DSH_DIR', '/runtime/dsh')
|
||||
vi.stubEnv('DSH_DESKTOP_HOST_INSPECT_PORT', undefined)
|
||||
vi.stubEnv('DSH_DESKTOP_OPEN_DEVTOOLS', '0')
|
||||
vi.stubEnv('DSH_DESKTOP_MANDATORY_UPDATE_CONFIG', undefined)
|
||||
vi.stubEnv('DSH_DESKTOP_UPDATE_JOURNAL_DIR', undefined)
|
||||
await import('../src/main.ts')
|
||||
await vi.waitFor(() => { expect(state.operations).toBeDefined() })
|
||||
expect(state.startHost).toHaveBeenCalledOnce()
|
||||
@@ -134,6 +148,5 @@ it('starts the Host for a forced welcome preview and opens the workspace on skip
|
||||
expect(state.menu).toHaveBeenCalledTimes(initialMenus)
|
||||
changed(event, 'en')
|
||||
expect(state.menu).toHaveBeenCalledTimes(initialMenus + 1)
|
||||
const shell = { senderFrame: { url: 'dsh-app://shell/plugin-manager.html' } }
|
||||
expect(await state.handlers.get(DESKTOP_IPC.localeGet)!(shell)).toMatchObject({ id: 'en' })
|
||||
expect(await bootstrap(event)).toEqual({ languages: ['en-US'], preference: 'en' })
|
||||
})
|
||||
Reference in new issue
Block a user