@@ -37,10 +37,11 @@ import {
37
37
import { isEncryptionAvailable , startCore } from '../core/manager'
38
38
import { triggerSysProxy } from '../resolve/sysproxy'
39
39
import { checkUpdate } from '../resolve/autoUpdater'
40
- import { exePath , mihomoCorePath , mihomoWorkConfigPath } from './dirs'
41
- import { execSync } from 'child_process'
40
+ import { exePath , mihomoCorePath , mihomoWorkConfigPath , resourcesDir } from './dirs'
41
+ import { execFile , execSync } from 'child_process'
42
42
import yaml from 'yaml'
43
43
import fs from 'fs'
44
+ import path from 'path'
44
45
45
46
export function registerIpcMainHandlers ( ) : void {
46
47
ipcMain . handle ( 'mihomoVersion' , mihomoVersion )
@@ -87,6 +88,7 @@ export function registerIpcMainHandlers(): void {
87
88
ipcMain . handle ( 'checkUpdate' , ( ) => checkUpdate ( ) )
88
89
ipcMain . handle ( 'getVersion' , ( ) => app . getVersion ( ) )
89
90
ipcMain . handle ( 'platform' , ( ) => process . platform )
91
+ ipcMain . handle ( 'openUWPTool' , openUWPTool )
90
92
ipcMain . handle ( 'setupFirewall' , setupFirewall )
91
93
ipcMain . handle ( 'quitApp' , ( ) => app . quit ( ) )
92
94
}
@@ -111,6 +113,12 @@ function getRuntimeConfig(): Record<string, unknown> {
111
113
return yaml . parse ( getRuntimeConfigStr ( ) )
112
114
}
113
115
116
+ function openUWPTool ( ) : void {
117
+ const uwpToolPath = path . join ( resourcesDir ( ) , 'files' , 'enableLoopback.exe' )
118
+ const child = execFile ( uwpToolPath )
119
+ child . unref ( )
120
+ }
121
+
114
122
async function setupFirewall ( ) : Promise < void > {
115
123
return new Promise ( ( resolve , reject ) => {
116
124
const removeCommand = `
0 commit comments