mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-15 19:22:31 +08:00
fix sysproxy
This commit is contained in:
parent
3eabb15efb
commit
1ef2595de3
|
@ -48,10 +48,10 @@ if (process.platform === 'win32')
|
|||
|
||||
export async function triggerSysProxy(enable: boolean): Promise<void> {
|
||||
if (enable) {
|
||||
disableSysProxy()
|
||||
await disableSysProxy()
|
||||
await enableSysProxy()
|
||||
} else {
|
||||
disableSysProxy()
|
||||
await disableSysProxy()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,10 +97,15 @@ export async function enableSysProxy(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
export function disableSysProxy(): void {
|
||||
export async function disableSysProxy(): Promise<void> {
|
||||
const execFilePromise = promisify(execFile)
|
||||
if (process.platform === 'win32') {
|
||||
execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), ['set', '1'])
|
||||
try {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), ['set', '1'])
|
||||
} catch {
|
||||
triggerAutoProxy(false, '')
|
||||
triggerManualProxy(false, '', 0, '')
|
||||
}
|
||||
} else {
|
||||
triggerAutoProxy(false, '')
|
||||
triggerManualProxy(false, '', 0, '')
|
||||
|
|
Loading…
Reference in New Issue
Block a user