mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
optimized tun enable logic
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
253e2f20df
commit
8341588a08
|
@ -8,8 +8,13 @@ import {
|
|||
mihomoWorkDir
|
||||
} from '../utils/dirs'
|
||||
import { generateProfile } from './factory'
|
||||
import { getAppConfig, getControledMihomoConfig, patchAppConfig } from '../config'
|
||||
import { dialog, safeStorage } from 'electron'
|
||||
import {
|
||||
getAppConfig,
|
||||
getControledMihomoConfig,
|
||||
patchAppConfig,
|
||||
patchControledMihomoConfig
|
||||
} from '../config'
|
||||
import { dialog, ipcMain, safeStorage } from 'electron'
|
||||
import {
|
||||
startMihomoTraffic,
|
||||
startMihomoConnections,
|
||||
|
@ -74,6 +79,9 @@ export async function startCore(): Promise<Promise<void>[]> {
|
|||
return new Promise((resolve, reject) => {
|
||||
child.stdout?.on('data', async (data) => {
|
||||
if (data.toString().includes('configure tun interface: operation not permitted')) {
|
||||
patchControledMihomoConfig({ tun: { enable: false } })
|
||||
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
||||
ipcMain.emit('updateTrayMenu')
|
||||
reject('虚拟网卡启动失败, 请尝试手动授予内核权限')
|
||||
}
|
||||
if (data.toString().includes('External controller listen error')) {
|
||||
|
|
|
@ -71,7 +71,9 @@ const TunSwitcher: React.FC = () => {
|
|||
try {
|
||||
const encrypted = await encryptString(password)
|
||||
await patchAppConfig({ encryptedPassword: encrypted })
|
||||
await patchControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
||||
await restartCore()
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
setOpenPasswordModal(false)
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user