mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-04-18 08:00:31 +08:00
fix: silently disable tun on startup instead of showing dialog
This commit is contained in:
parent
9e0f27aea3
commit
4a868e53ae
@ -348,21 +348,15 @@ export async function validateTunPermissionsOnStartup(_restartCore: () => Promis
|
|||||||
const hasPermissions = await checkMihomoCorePermissions()
|
const hasPermissions = await checkMihomoCorePermissions()
|
||||||
|
|
||||||
if (!hasPermissions) {
|
if (!hasPermissions) {
|
||||||
managerLogger.warn('TUN is enabled but insufficient permissions detected, prompting user...')
|
// 启动时没有权限,静默禁用 TUN,不弹窗打扰用户
|
||||||
const confirmed = await showTunPermissionDialog()
|
managerLogger.warn('TUN is enabled but insufficient permissions detected, auto-disabling TUN...')
|
||||||
if (confirmed) {
|
|
||||||
await restartAsAdmin()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
managerLogger.warn('User declined admin restart, auto-disabling TUN...')
|
|
||||||
await patchControledMihomoConfig({ tun: { enable: false } })
|
await patchControledMihomoConfig({ tun: { enable: false } })
|
||||||
|
|
||||||
const { mainWindow } = await import('../index')
|
const { mainWindow } = await import('../index')
|
||||||
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
||||||
ipcMain.emit('updateTrayMenu')
|
ipcMain.emit('updateTrayMenu')
|
||||||
|
|
||||||
managerLogger.info('TUN auto-disabled due to insufficient permissions')
|
managerLogger.info('TUN auto-disabled due to insufficient permissions on startup')
|
||||||
} else {
|
} else {
|
||||||
managerLogger.info('TUN permissions validated successfully')
|
managerLogger.info('TUN permissions validated successfully')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user