mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 19:56:10 +08:00
try to fix sysproxy
This commit is contained in:
parent
54306ee64b
commit
2429a5f189
|
@ -63,10 +63,14 @@ export async function enableSysProxy(): Promise<void> {
|
|||
switch (mode || 'manual') {
|
||||
case 'auto': {
|
||||
if (process.platform === 'win32') {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), [
|
||||
'pac',
|
||||
`http://${host || '127.0.0.1'}:${pacPort}/pac`
|
||||
])
|
||||
try {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), [
|
||||
'pac',
|
||||
`http://${host || '127.0.0.1'}:${pacPort}/pac`
|
||||
])
|
||||
} catch {
|
||||
triggerAutoProxy(true, `http://${host || '127.0.0.1'}:${pacPort}/pac`)
|
||||
}
|
||||
} else {
|
||||
triggerAutoProxy(true, `http://${host || '127.0.0.1'}:${pacPort}/pac`)
|
||||
}
|
||||
|
@ -76,11 +80,15 @@ export async function enableSysProxy(): Promise<void> {
|
|||
|
||||
case 'manual': {
|
||||
if (process.platform === 'win32') {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), [
|
||||
'global',
|
||||
`${host || '127.0.0.1'}:${port}`,
|
||||
bypass.join(';')
|
||||
])
|
||||
try {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), [
|
||||
'global',
|
||||
`${host || '127.0.0.1'}:${port}`,
|
||||
bypass.join(';')
|
||||
])
|
||||
} catch {
|
||||
triggerManualProxy(true, host || '127.0.0.1', port, bypass.join(','))
|
||||
}
|
||||
} else {
|
||||
triggerManualProxy(true, host || '127.0.0.1', port, bypass.join(','))
|
||||
}
|
||||
|
|
|
@ -27,9 +27,13 @@ const SysproxySwitcher: React.FC = () => {
|
|||
})
|
||||
const transform = tf ? { x: tf.x, y: tf.y, scaleX: 1, scaleY: 1 } : null
|
||||
const onChange = async (enable: boolean): Promise<void> => {
|
||||
await triggerSysProxy(enable)
|
||||
await patchAppConfig({ sysProxy: { enable } })
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
try {
|
||||
await triggerSysProxy(enable)
|
||||
await patchAppConfig({ sysProxy: { enable } })
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue
Block a user