mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 08:03:33 +00:00
fix(permissions): avoid false Local Network grants
This commit is contained in:
@@ -168,7 +168,7 @@ describe('registerDeveloperPermissionHandlers', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('clears the local-network prompt fallback timer when UDP send settles first', async () => {
|
||||
it('keeps the local-network status unknown when UDP send settles without an error', async () => {
|
||||
registerDeveloperPermissionHandlers()
|
||||
|
||||
const result = getRequestHandler()({}, { id: 'local-network' })
|
||||
@@ -179,7 +179,7 @@ describe('registerDeveloperPermissionHandlers', () => {
|
||||
|
||||
await expect(result).resolves.toEqual({
|
||||
id: 'local-network',
|
||||
status: 'granted',
|
||||
status: 'unknown',
|
||||
openedSystemSettings: false
|
||||
})
|
||||
expect(vi.getTimerCount()).toBe(0)
|
||||
|
||||
@@ -140,7 +140,8 @@ function triggerLocalNetworkPrompt(): Promise<DeveloperPermissionStatus> {
|
||||
}
|
||||
function classify(error: Error | null | undefined): DeveloperPermissionStatus {
|
||||
if (!error) {
|
||||
return 'granted'
|
||||
// A queued UDP datagram does not prove Local Network access was granted.
|
||||
return 'unknown'
|
||||
}
|
||||
const code = (error as NodeJS.ErrnoException).code
|
||||
return code && LOCAL_NETWORK_DENIAL_CODES.has(code) ? 'denied' : 'unknown'
|
||||
|
||||
Reference in New Issue
Block a user