mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
try fix sysproxy
Some checks are pending
Build / windows (arm64) (push) Waiting to run
Build / windows (ia32) (push) Waiting to run
Build / windows (x64) (push) Waiting to run
Build / linux (arm64) (push) Waiting to run
Build / linux (x64) (push) Waiting to run
Build / macos (arm64) (push) Waiting to run
Build / macos (x64) (push) Waiting to run
Build / updater (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-bin) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron-bin) (push) Blocked by required conditions
Build / aur-git-updater (push) Waiting to run
Some checks are pending
Build / windows (arm64) (push) Waiting to run
Build / windows (ia32) (push) Waiting to run
Build / windows (x64) (push) Waiting to run
Build / linux (arm64) (push) Waiting to run
Build / linux (x64) (push) Waiting to run
Build / macos (arm64) (push) Waiting to run
Build / macos (x64) (push) Waiting to run
Build / updater (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-bin) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron-bin) (push) Blocked by required conditions
Build / aur-git-updater (push) Waiting to run
This commit is contained in:
parent
19cfb2d25d
commit
e4ec90e73a
|
@ -1,8 +1,3 @@
|
|||
### New Features
|
||||
|
||||
- 支持创建没有UAC弹窗的启动快捷方式
|
||||
- 显示订阅过期时间
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- 修复节点排序无法恢复默认的问题
|
||||
- 修复拨号网络系统代理问题
|
||||
|
|
|
@ -261,6 +261,11 @@ const resolveEnableLoopback = () =>
|
|||
file: 'enableLoopback.exe',
|
||||
downloadURL: `https://github.com/Kuingsmile/uwp-tool/releases/download/latest/enableLoopback.exe`
|
||||
})
|
||||
const resolveSysproxy = () =>
|
||||
resolveResource({
|
||||
file: 'sysproxy.exe',
|
||||
downloadURL: `https://github.com/pompurin404/sysproxy/releases/download/${arch}/sysproxy.exe`
|
||||
})
|
||||
|
||||
const resolveFont = async () => {
|
||||
const targetPath = path.join(cwd, 'src', 'renderer', 'src', 'assets', 'NotoColorEmoji.ttf')
|
||||
|
@ -301,6 +306,12 @@ const tasks = [
|
|||
func: resolveEnableLoopback,
|
||||
retry: 5,
|
||||
winOnly: true
|
||||
},
|
||||
{
|
||||
name: 'sysproxy',
|
||||
func: resolveSysproxy,
|
||||
retry: 5,
|
||||
winOnly: true
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { triggerAutoProxy, triggerManualProxy } from '@mihomo-party/sysproxy'
|
||||
import { getAppConfig, getControledMihomoConfig } from '../config'
|
||||
import { pacPort } from '../resolve/server'
|
||||
import { promisify } from 'util'
|
||||
import { execFile } from 'child_process'
|
||||
import path from 'path'
|
||||
import { resourcesFilesDir } from '../utils/dirs'
|
||||
|
||||
let defaultBypass: string[]
|
||||
|
||||
|
@ -55,26 +59,42 @@ export async function enableSysProxy(): Promise<void> {
|
|||
const { sysProxy } = await getAppConfig()
|
||||
const { mode, host, bypass = defaultBypass } = sysProxy
|
||||
const { 'mixed-port': port = 7890 } = await getControledMihomoConfig()
|
||||
|
||||
const execFilePromise = promisify(execFile)
|
||||
switch (mode || 'manual') {
|
||||
case 'auto': {
|
||||
triggerAutoProxy(true, `http://${host || '127.0.0.1'}:${pacPort}/pac`)
|
||||
if (process.platform === 'win32') {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), [
|
||||
'pac',
|
||||
`http://${host || '127.0.0.1'}:${pacPort}/pac`
|
||||
])
|
||||
} else {
|
||||
triggerAutoProxy(true, `http://${host || '127.0.0.1'}:${pacPort}/pac`)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case 'manual': {
|
||||
triggerManualProxy(
|
||||
true,
|
||||
host || '127.0.0.1',
|
||||
port,
|
||||
bypass.join(process.platform === 'win32' ? ';' : ',')
|
||||
)
|
||||
if (process.platform === 'win32') {
|
||||
await execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), [
|
||||
'global',
|
||||
`${host || '127.0.0.1'}:${port}`,
|
||||
bypass.join(';')
|
||||
])
|
||||
} else {
|
||||
triggerManualProxy(true, host || '127.0.0.1', port, bypass.join(','))
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function disableSysProxy(): void {
|
||||
triggerAutoProxy(false, '')
|
||||
triggerManualProxy(false, '', 0, '')
|
||||
const execFilePromise = promisify(execFile)
|
||||
if (process.platform === 'win32') {
|
||||
execFilePromise(path.join(resourcesFilesDir(), 'sysproxy.exe'), ['set', '1'])
|
||||
} else {
|
||||
triggerAutoProxy(false, '')
|
||||
triggerManualProxy(false, '', 0, '')
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user