diff --git a/src/main/utils/ipc.ts b/src/main/utils/ipc.ts index 22c48f1..963f4a6 100644 --- a/src/main/utils/ipc.ts +++ b/src/main/utils/ipc.ts @@ -37,10 +37,11 @@ import { import { isEncryptionAvailable, startCore } from '../core/manager' import { triggerSysProxy } from '../resolve/sysproxy' import { checkUpdate } from '../resolve/autoUpdater' -import { exePath, mihomoCorePath, mihomoWorkConfigPath } from './dirs' -import { execSync } from 'child_process' +import { exePath, mihomoCorePath, mihomoWorkConfigPath, resourcesDir } from './dirs' +import { execFile, execSync } from 'child_process' import yaml from 'yaml' import fs from 'fs' +import path from 'path' export function registerIpcMainHandlers(): void { ipcMain.handle('mihomoVersion', mihomoVersion) @@ -87,6 +88,7 @@ export function registerIpcMainHandlers(): void { ipcMain.handle('checkUpdate', () => checkUpdate()) ipcMain.handle('getVersion', () => app.getVersion()) ipcMain.handle('platform', () => process.platform) + ipcMain.handle('openUWPTool', openUWPTool) ipcMain.handle('setupFirewall', setupFirewall) ipcMain.handle('quitApp', () => app.quit()) } @@ -111,6 +113,12 @@ function getRuntimeConfig(): Record { return yaml.parse(getRuntimeConfigStr()) } +function openUWPTool(): void { + const uwpToolPath = path.join(resourcesDir(), 'files', 'enableLoopback.exe') + const child = execFile(uwpToolPath) + child.unref() +} + async function setupFirewall(): Promise { return new Promise((resolve, reject) => { const removeCommand = ` diff --git a/src/renderer/src/pages/syspeoxy.tsx b/src/renderer/src/pages/syspeoxy.tsx index c3ee2b3..ecfb0c6 100644 --- a/src/renderer/src/pages/syspeoxy.tsx +++ b/src/renderer/src/pages/syspeoxy.tsx @@ -138,6 +138,18 @@ const Sysproxy: React.FC = () => { + {platform === 'win32' && ( + + + + )} {values.mode === 'auto' && (