mirror of
https://gh-proxy.org/https://github.com/klinsmaya/workdsh.git
synced 2026-11-10 18:36:56 +08:00
feat(desktop): wire crash dumps into diagnostic export
This commit is contained in:
@@ -268,6 +268,7 @@ export class ElectronDesktopRuntime implements DesktopRuntime {
|
||||
const path = await exportDiagnosticsZip(
|
||||
join(app.getPath('userData'), 'logs'),
|
||||
app.getPath('userData'),
|
||||
{ crashDumpsDir: app.getPath('crashDumps') },
|
||||
)
|
||||
shell.showItemInFolder(path)
|
||||
} catch (cause) {
|
||||
|
||||
@@ -59,14 +59,14 @@ const diagnosticsPrivacyCopy: Record<DesktopLocale, DesktopDiagnosticsPrivacyCop
|
||||
en: {
|
||||
title: 'Export Diagnostics',
|
||||
message: 'Review the diagnostic archive before sharing it.',
|
||||
detail: 'The archive contains recent application logs and system information. Logs may contain local paths, workspace IDs, and session IDs. Authentication credentials are masked when recognized, but you should still review the archive before uploading it publicly.',
|
||||
detail: 'The archive contains recent application logs, local crash dumps, and system information. Logs may contain local paths, workspace IDs, and session IDs. Crash dumps may contain fragments of process memory. Authentication credentials are masked in logs when recognized, but you should still review the archive before uploading it publicly.',
|
||||
confirm: 'Export',
|
||||
cancel: 'Cancel',
|
||||
},
|
||||
zh: {
|
||||
title: '导出诊断信息',
|
||||
message: '分享诊断包前请先检查其中的内容。',
|
||||
detail: '诊断包包含最近的应用日志和系统信息。日志可能包含本地路径、工作区 ID 和会话 ID。系统会对可识别的认证凭据进行脱敏,但公开上传前仍应检查诊断包。',
|
||||
detail: '诊断包包含最近的应用日志、本地崩溃转储和系统信息。日志可能包含本地路径、工作区 ID 和会话 ID,崩溃转储可能包含进程内存片段。系统会对日志中可识别的认证凭据进行脱敏,但公开上传前仍应检查诊断包。',
|
||||
confirm: '导出',
|
||||
cancel: '取消',
|
||||
},
|
||||
|
||||
@@ -140,7 +140,9 @@ const electron = vi.hoisted(() => {
|
||||
app: {
|
||||
dock: { setIcon: vi.fn() },
|
||||
getLocale: vi.fn(() => 'en-US'),
|
||||
getPath: vi.fn(() => '/tmp/dsh-desktop-user-data'),
|
||||
getPath: vi.fn((name: string) => name === 'crashDumps'
|
||||
? '/tmp/dsh-desktop-user-data/Crashpad'
|
||||
: '/tmp/dsh-desktop-user-data'),
|
||||
getVersion: vi.fn(() => '43.4.0'),
|
||||
isPackaged: false,
|
||||
on: vi.fn(),
|
||||
@@ -620,6 +622,11 @@ describe('Electron compatibility runtime', () => {
|
||||
await Promise.all([first, second])
|
||||
|
||||
expect(diagnostics.export).toHaveBeenCalledOnce()
|
||||
expect(diagnostics.export).toHaveBeenCalledWith(
|
||||
join('/tmp/dsh-desktop-user-data', 'logs'),
|
||||
'/tmp/dsh-desktop-user-data',
|
||||
{ crashDumpsDir: '/tmp/dsh-desktop-user-data/Crashpad' },
|
||||
)
|
||||
expect(electron.shell.showItemInFolder).toHaveBeenCalledOnce()
|
||||
expect(electron.shell.showItemInFolder).toHaveBeenCalledWith('C:\\Users\\Example\\diagnostics.zip')
|
||||
})
|
||||
@@ -640,6 +647,9 @@ describe('Electron compatibility runtime', () => {
|
||||
buttons: ['Export', 'Cancel'],
|
||||
detail: expect.stringContaining('local paths, workspace IDs, and session IDs'),
|
||||
}))
|
||||
expect(electron.dialog.showMessageBox).toHaveBeenCalledWith(expect.objectContaining({
|
||||
detail: expect.stringContaining('process memory'),
|
||||
}))
|
||||
})
|
||||
|
||||
it('localizes the diagnostics privacy confirmation', async () => {
|
||||
@@ -654,6 +664,9 @@ describe('Electron compatibility runtime', () => {
|
||||
buttons: ['导出', '取消'],
|
||||
detail: expect.stringContaining('本地路径、工作区 ID 和会话 ID'),
|
||||
}))
|
||||
expect(electron.dialog.showMessageBox).toHaveBeenCalledWith(expect.objectContaining({
|
||||
detail: expect.stringContaining('进程内存'),
|
||||
}))
|
||||
})
|
||||
|
||||
it('shows a native error when diagnostic export fails', async () => {
|
||||
|
||||
Reference in New Issue
Block a user