mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Desktop update downloads currently depend on the updater HTTP stack and can miss the proxy users already rely on for GitHub access. The change enables OS proxy discovery in the native updater client and adds a narrow manual proxy fallback scoped only to update checks and package downloads. Constraint: Tauri updater carries the proxy from check through download, so changing proxy settings after a check must discard the pending update and re-check before install Rejected: Reuse provider proxy settings | provider traffic and updater traffic have different scope and persistence risks Confidence: high Scope-risk: moderate Directive: Keep update proxy settings scoped to app updates; do not mix them with model/provider proxy configuration without a separate migration decision Tested: cd desktop && bun run test -- --run src/__tests__/generalSettings.test.tsx src/stores/updateStore.test.ts src/stores/settingsStore.test.ts src-tauri/tauri-config.test.ts Tested: bun run check:desktop Tested: bun run check:native Not-tested: Full coverage gate intentionally skipped after maintainer said it was not needed
34 lines
1018 B
TypeScript
34 lines
1018 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { readFileSync } from 'node:fs'
|
|
import { dirname } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { join } from 'node:path'
|
|
|
|
const currentDir = dirname(fileURLToPath(import.meta.url))
|
|
|
|
describe('tauri security config', () => {
|
|
it('allows desktop sidecar image URLs for opener icons', () => {
|
|
const config = JSON.parse(
|
|
readFileSync(join(currentDir, 'tauri.conf.json'), 'utf8'),
|
|
) as {
|
|
app?: {
|
|
security?: {
|
|
csp?: string
|
|
}
|
|
}
|
|
}
|
|
|
|
const csp = config.app?.security?.csp ?? ''
|
|
expect(csp).toContain('img-src')
|
|
expect(csp).toContain('http://127.0.0.1:*')
|
|
expect(csp).toContain('http://localhost:*')
|
|
})
|
|
|
|
it('enables OS proxy discovery for updater downloads', () => {
|
|
const cargoToml = readFileSync(join(currentDir, 'Cargo.toml'), 'utf8')
|
|
|
|
expect(cargoToml).toContain('reqwest = { version = "0.13"')
|
|
expect(cargoToml).toContain('features = ["system-proxy"]')
|
|
})
|
|
})
|