mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-18 13:23:33 +08:00
Allow desktop confirm dialogs to reach Tauri
Superpowers can trigger plan approval or browser confirm flows inside the desktop shell. Tauri's dialog plugin shims window.confirm through the message command, but the desktop capability only allowed file open/save dialogs, so Windows rejected confirm with an ACL error and left the flow blocked. Constraint: Tauri plugin-dialog 2.7 routes alert/confirm through the message permission. Rejected: Grant dialog:default | broader than needed for this bugfix. Confidence: high Scope-risk: narrow Directive: Keep dialog message permission whenever browser confirm or alert shims are available in desktop. Tested: cd desktop && bun run test -- --run src/__tests__/tauriCapabilities.test.ts Tested: bun run check:native Tested: bun run check:desktop
This commit is contained in:
parent
08747bfdd2
commit
a54e97d532
@ -100,6 +100,7 @@
|
||||
},
|
||||
"dialog:allow-open",
|
||||
"dialog:allow-save",
|
||||
"dialog:allow-message",
|
||||
"notification:default",
|
||||
"process:allow-exit",
|
||||
"process:allow-restart",
|
||||
|
||||
31
desktop/src/__tests__/tauriCapabilities.test.ts
Normal file
31
desktop/src/__tests__/tauriCapabilities.test.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import defaultCapabilityJson from '../../src-tauri/capabilities/default.json?raw'
|
||||
|
||||
function readDefaultCapabilityPermissions(): string[] {
|
||||
const capability = JSON.parse(defaultCapabilityJson) as {
|
||||
permissions?: unknown[]
|
||||
}
|
||||
|
||||
return (capability.permissions ?? []).filter((permission): permission is string =>
|
||||
typeof permission === 'string'
|
||||
)
|
||||
}
|
||||
|
||||
describe('Tauri default capability', () => {
|
||||
it('allows the dialog message API used by Tauri alert/confirm shims', () => {
|
||||
const permissions = readDefaultCapabilityPermissions()
|
||||
|
||||
expect(
|
||||
permissions.some(permission =>
|
||||
permission === 'dialog:default' || permission === 'dialog:allow-message'
|
||||
)
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps file dialog access enabled', () => {
|
||||
const permissions = readDefaultCapabilityPermissions()
|
||||
|
||||
expect(permissions).toContain('dialog:allow-open')
|
||||
expect(permissions).toContain('dialog:allow-save')
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user