mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 02:09:03 +08:00
refactor(proxy): update proxy handling logic in useAppInit and GeneralSettings (#9081)
- Simplified proxy setting logic by removing unnecessary dispatches for 'system' and 'none' modes. - Updated useAppInit to set proxy to undefined for 'system' mode and clarified direct mode handling with comments.
This commit is contained in:
parent
4fd00af273
commit
207f2e1689
@ -86,11 +86,12 @@ export function useAppInit() {
|
||||
|
||||
useEffect(() => {
|
||||
if (proxyMode === 'system') {
|
||||
window.api.setProxy('system', proxyBypassRules)
|
||||
window.api.setProxy('system', undefined)
|
||||
} else if (proxyMode === 'custom') {
|
||||
proxyUrl && window.api.setProxy(proxyUrl, proxyBypassRules)
|
||||
} else {
|
||||
window.api.setProxy('')
|
||||
// set proxy to none for direct mode
|
||||
window.api.setProxy('', undefined)
|
||||
}
|
||||
}, [proxyUrl, proxyMode, proxyBypassRules])
|
||||
|
||||
|
||||
@ -113,12 +113,6 @@ const GeneralSettings: FC = () => {
|
||||
|
||||
const onProxyModeChange = (mode: 'system' | 'custom' | 'none') => {
|
||||
dispatch(setProxyMode(mode))
|
||||
if (mode === 'system') {
|
||||
dispatch(_setProxyUrl(undefined))
|
||||
} else if (mode === 'none') {
|
||||
dispatch(_setProxyUrl(undefined))
|
||||
dispatch(_setProxyBypassRules(undefined))
|
||||
}
|
||||
}
|
||||
|
||||
const languagesOptions: { value: LanguageVarious; label: string; flag: string }[] = [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user