mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +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> {
|
export async function triggerSysProxy(enable: boolean): Promise<void> {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
disableSysProxy()
|
await disableSysProxy()
|
||||||
await enableSysProxy()
|
await enableSysProxy()
|
||||||
} else {
|
} 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)
|
const execFilePromise = promisify(execFile)
|
||||||
if (process.platform === 'win32') {
|
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 {
|
} else {
|
||||||
triggerAutoProxy(false, '')
|
triggerAutoProxy(false, '')
|
||||||
triggerManualProxy(false, '', 0, '')
|
triggerManualProxy(false, '', 0, '')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user