mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
Compare commits
No commits in common. "2ebb5db0550f1f585b21efa96f683fc0a4a5883a" and "71f7b7b3c0408b980b5118c09a7042507d77966d" have entirely different histories.
2ebb5db055
...
71f7b7b3c0
17
changelog.md
17
changelog.md
@ -1,20 +1,3 @@
|
|||||||
## 1.8.5
|
|
||||||
|
|
||||||
### 新功能 (Feat)
|
|
||||||
- 支持 cron 表达式以自定义订阅更新频率(#766)
|
|
||||||
- 修复权限检查并优化TUN与自启联动(#977)
|
|
||||||
### 修复 (Fix)
|
|
||||||
- Windows 下当前运行内核权限检测(之前没有正确检测管理员权限运行的内核)
|
|
||||||
- Windows 下 开机自启 按钮卡顿问题 隐藏运行黑框 现在申请权限会弹通知
|
|
||||||
- 修复 部分情况下 yaml 文件解析错误 (#889)
|
|
||||||
- 修复 系统中已经运行的内核名称检测
|
|
||||||
- 修复 订阅信息中的因格式问题导致的信息缺失(#951)
|
|
||||||
- 修复 轻量模式延迟启动延时输入数值问题(#962)
|
|
||||||
- 修复 轻量模式下轻量模式下规则失效的问题(#963)
|
|
||||||
- 修复 MacOS 下默认虚拟网卡名称没有生效的问题
|
|
||||||
|
|
||||||
### 样式调整 (Sytle)
|
|
||||||
- 部分样式微调
|
|
||||||
## 1.8.4
|
## 1.8.4
|
||||||
|
|
||||||
### 新功能 (Feat)
|
### 新功能 (Feat)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mihomo-party",
|
"name": "mihomo-party",
|
||||||
"version": "1.8.5-dev",
|
"version": "1.8.4",
|
||||||
"description": "Mihomo Party",
|
"description": "Mihomo Party",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "mihomo-party-org",
|
"author": "mihomo-party-org",
|
||||||
|
|||||||
@ -38,6 +38,10 @@ export async function patchControledMihomoConfig(patch: Partial<IMihomoConfig>):
|
|||||||
controledMihomoConfig.sniffer = defaultControledMihomoConfig.sniffer
|
controledMihomoConfig.sniffer = defaultControledMihomoConfig.sniffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
delete controledMihomoConfig?.tun?.device
|
||||||
|
}
|
||||||
|
|
||||||
await generateProfile()
|
await generateProfile()
|
||||||
await writeFile(controledMihomoConfigPath(), yaml.stringify(controledMihomoConfig), 'utf-8')
|
await writeFile(controledMihomoConfigPath(), yaml.stringify(controledMihomoConfig), 'utf-8')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -290,7 +290,13 @@ export async function checkTunPermissions(): Promise<boolean> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
return await checkAdminPrivileges()
|
const execPromise = promisify(exec)
|
||||||
|
try {
|
||||||
|
await execPromise('net session')
|
||||||
|
return true
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'darwin' || process.platform === 'linux') {
|
if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||||
@ -335,27 +341,14 @@ export async function checkAdminPrivileges(): Promise<boolean> {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const execPromise = promisify(exec)
|
const execPromise = promisify(exec)
|
||||||
|
|
||||||
try {
|
|
||||||
// 首先尝试 fltmc 命令检测管理员权限
|
|
||||||
await execPromise('fltmc')
|
|
||||||
await managerLogger.info('Admin privileges confirmed via fltmc')
|
|
||||||
return true
|
|
||||||
} catch (fltmcError) {
|
|
||||||
await managerLogger.info('fltmc failed, trying net session as fallback', fltmcError)
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 如果 fltmc 失败,尝试 net session 命令作为备用检测方法
|
|
||||||
await execPromise('net session')
|
await execPromise('net session')
|
||||||
await managerLogger.info('Admin privileges confirmed via net session')
|
|
||||||
return true
|
return true
|
||||||
} catch (netSessionError) {
|
} catch {
|
||||||
await managerLogger.info('Both fltmc and net session failed, no admin privileges', netSessionError)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// TUN 权限确认框
|
// TUN 权限确认框
|
||||||
export async function showTunPermissionDialog(): Promise<boolean> {
|
export async function showTunPermissionDialog(): Promise<boolean> {
|
||||||
@ -611,13 +604,6 @@ export async function checkAdminRestartForTun(): Promise<void> {
|
|||||||
const hasAdminPrivileges = await checkAdminPrivileges()
|
const hasAdminPrivileges = await checkAdminPrivileges()
|
||||||
if (hasAdminPrivileges) {
|
if (hasAdminPrivileges) {
|
||||||
await patchControledMihomoConfig({ tun: { enable: true }, dns: { enable: true } })
|
await patchControledMihomoConfig({ tun: { enable: true }, dns: { enable: true } })
|
||||||
|
|
||||||
const { checkAutoRun, enableAutoRun } = await import('../sys/autoRun')
|
|
||||||
const autoRunEnabled = await checkAutoRun()
|
|
||||||
if (autoRunEnabled) {
|
|
||||||
await enableAutoRun()
|
|
||||||
}
|
|
||||||
|
|
||||||
await restartCore()
|
await restartCore()
|
||||||
|
|
||||||
await managerLogger.info('TUN mode auto-enabled after admin restart')
|
await managerLogger.info('TUN mode auto-enabled after admin restart')
|
||||||
@ -649,16 +635,8 @@ export async function validateTunPermissionsOnStartup(): Promise<void> {
|
|||||||
const hasPermissions = await checkMihomoCorePermissions()
|
const hasPermissions = await checkMihomoCorePermissions()
|
||||||
|
|
||||||
if (!hasPermissions) {
|
if (!hasPermissions) {
|
||||||
await managerLogger.warn(
|
await managerLogger.warn('TUN is enabled but insufficient permissions detected, auto-disabling TUN...')
|
||||||
'TUN is enabled but insufficient permissions detected, prompting user...'
|
|
||||||
)
|
|
||||||
const confirmed = await showTunPermissionDialog()
|
|
||||||
if (confirmed) {
|
|
||||||
await restartAsAdmin()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await 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')
|
||||||
|
|||||||
@ -9,8 +9,7 @@ import { managerLogger } from '../utils/logger'
|
|||||||
|
|
||||||
const appName = 'mihomo-party'
|
const appName = 'mihomo-party'
|
||||||
|
|
||||||
function getTaskXml(asAdmin: boolean): string {
|
function getTaskXml(): string {
|
||||||
const runLevel = asAdmin ? 'HighestAvailable' : 'LeastPrivilege'
|
|
||||||
return `<?xml version="1.0" encoding="UTF-16"?>
|
return `<?xml version="1.0" encoding="UTF-16"?>
|
||||||
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
||||||
<Triggers>
|
<Triggers>
|
||||||
@ -22,7 +21,7 @@ function getTaskXml(asAdmin: boolean): string {
|
|||||||
<Principals>
|
<Principals>
|
||||||
<Principal id="Author">
|
<Principal id="Author">
|
||||||
<LogonType>InteractiveToken</LogonType>
|
<LogonType>InteractiveToken</LogonType>
|
||||||
<RunLevel>${runLevel}</RunLevel>
|
<RunLevel>LeastPrivilege</RunLevel>
|
||||||
</Principal>
|
</Principal>
|
||||||
</Principals>
|
</Principals>
|
||||||
<Settings>
|
<Settings>
|
||||||
@ -84,9 +83,9 @@ export async function enableAutoRun(): Promise<void> {
|
|||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const execPromise = promisify(exec)
|
const execPromise = promisify(exec)
|
||||||
const taskFilePath = path.join(tmpdir(), `${appName}.xml`)
|
const taskFilePath = path.join(tmpdir(), `${appName}.xml`)
|
||||||
|
await writeFile(taskFilePath, Buffer.from(`\ufeff${getTaskXml()}`, 'utf-16le'))
|
||||||
const { checkAdminPrivileges } = await import('../core/manager')
|
const { checkAdminPrivileges } = await import('../core/manager')
|
||||||
const isAdmin = await checkAdminPrivileges()
|
const isAdmin = await checkAdminPrivileges()
|
||||||
await writeFile(taskFilePath, Buffer.from(`\ufeff${getTaskXml(isAdmin)}`, 'utf-16le'))
|
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
await execPromise(`%SystemRoot%\\System32\\schtasks.exe /create /tn "${appName}" /xml "${taskFilePath}" /f`)
|
await execPromise(`%SystemRoot%\\System32\\schtasks.exe /create /tn "${appName}" /xml "${taskFilePath}" /f`)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -250,8 +250,7 @@ async function migration(): Promise<void> {
|
|||||||
authentication,
|
authentication,
|
||||||
'bind-address': bindAddress,
|
'bind-address': bindAddress,
|
||||||
'lan-allowed-ips': lanAllowedIps,
|
'lan-allowed-ips': lanAllowedIps,
|
||||||
'lan-disallowed-ips': lanDisallowedIps,
|
'lan-disallowed-ips': lanDisallowedIps
|
||||||
tun
|
|
||||||
} = await getControledMihomoConfig()
|
} = await getControledMihomoConfig()
|
||||||
// add substore sider card
|
// add substore sider card
|
||||||
if (useSubStore && !siderOrder.includes('substore')) {
|
if (useSubStore && !siderOrder.includes('substore')) {
|
||||||
@ -277,16 +276,6 @@ async function migration(): Promise<void> {
|
|||||||
if (!lanDisallowedIps) {
|
if (!lanDisallowedIps) {
|
||||||
await patchControledMihomoConfig({ 'lan-disallowed-ips': [] })
|
await patchControledMihomoConfig({ 'lan-disallowed-ips': [] })
|
||||||
}
|
}
|
||||||
// default tun device
|
|
||||||
if (!tun?.device || (process.platform === 'darwin' && tun.device === 'Mihomo')) {
|
|
||||||
const defaultDevice = process.platform === 'darwin' ? 'utun1500' : 'Mihomo'
|
|
||||||
await patchControledMihomoConfig({
|
|
||||||
tun: {
|
|
||||||
...tun,
|
|
||||||
device: defaultDevice
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// remove custom app theme
|
// remove custom app theme
|
||||||
if (!['system', 'light', 'dark'].includes(appTheme)) {
|
if (!['system', 'light', 'dark'].includes(appTheme)) {
|
||||||
await patchAppConfig({ appTheme: 'system' })
|
await patchAppConfig({ appTheme: 'system' })
|
||||||
|
|||||||
@ -75,9 +75,6 @@ const TunSwitcher: React.FC<Props> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await patchControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
await patchControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
||||||
if (enable && appConfig?.silentStart) {
|
|
||||||
await window.electron.ipcRenderer.invoke('enableAutoRun')
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
await patchControledMihomoConfig({ tun: { enable } })
|
await patchControledMihomoConfig({ tun: { enable } })
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user