mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-28 13:40:29 +08:00
Compare commits
No commits in common. "7743097b51dad8a55973e1d3dc76a4c259cc05d8" and "84c89105b47882979a27935e5d29ade407bd1740" have entirely different histories.
7743097b51
...
84c89105b4
@ -10,7 +10,6 @@ import { triggerSysProxy } from '../sys/sysproxy'
|
|||||||
import { patchMihomoConfig } from '../core/mihomoApi'
|
import { patchMihomoConfig } from '../core/mihomoApi'
|
||||||
import { quitWithoutCore, restartCore } from '../core/manager'
|
import { quitWithoutCore, restartCore } from '../core/manager'
|
||||||
import { floatingWindow, triggerFloatingWindow } from './floatingWindow'
|
import { floatingWindow, triggerFloatingWindow } from './floatingWindow'
|
||||||
import { updateTrayIcon } from './tray'
|
|
||||||
import i18next from '../../shared/i18n'
|
import i18next from '../../shared/i18n'
|
||||||
|
|
||||||
export async function registerShortcut(
|
export async function registerShortcut(
|
||||||
@ -52,7 +51,6 @@ export async function registerShortcut(
|
|||||||
// ignore
|
// ignore
|
||||||
} finally {
|
} finally {
|
||||||
ipcMain.emit('updateTrayMenu')
|
ipcMain.emit('updateTrayMenu')
|
||||||
await updateTrayIcon()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -76,7 +74,6 @@ export async function registerShortcut(
|
|||||||
// ignore
|
// ignore
|
||||||
} finally {
|
} finally {
|
||||||
ipcMain.emit('updateTrayMenu')
|
ipcMain.emit('updateTrayMenu')
|
||||||
await updateTrayIcon()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -89,7 +86,6 @@ export async function registerShortcut(
|
|||||||
}).show()
|
}).show()
|
||||||
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
||||||
ipcMain.emit('updateTrayMenu')
|
ipcMain.emit('updateTrayMenu')
|
||||||
await updateTrayIcon()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
case 'globalModeShortcut': {
|
case 'globalModeShortcut': {
|
||||||
@ -101,7 +97,6 @@ export async function registerShortcut(
|
|||||||
}).show()
|
}).show()
|
||||||
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
||||||
ipcMain.emit('updateTrayMenu')
|
ipcMain.emit('updateTrayMenu')
|
||||||
await updateTrayIcon()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
case 'directModeShortcut': {
|
case 'directModeShortcut': {
|
||||||
@ -113,7 +108,6 @@ export async function registerShortcut(
|
|||||||
}).show()
|
}).show()
|
||||||
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
mainWindow?.webContents.send('controledMihomoConfigUpdated')
|
||||||
ipcMain.emit('updateTrayMenu')
|
ipcMain.emit('updateTrayMenu')
|
||||||
await updateTrayIcon()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
case 'quitWithoutCoreShortcut': {
|
case 'quitWithoutCoreShortcut': {
|
||||||
|
|||||||
@ -34,20 +34,8 @@ export function openFile(type: 'profile' | 'override', id: string, ext?: 'yaml'
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function openUWPTool(): Promise<void> {
|
export async function openUWPTool(): Promise<void> {
|
||||||
const execPromise = promisify(exec)
|
|
||||||
const execFilePromise = promisify(execFile)
|
const execFilePromise = promisify(execFile)
|
||||||
const uwpToolPath = path.join(resourcesDir(), 'files', 'enableLoopback.exe')
|
const uwpToolPath = path.join(resourcesDir(), 'files', 'enableLoopback.exe')
|
||||||
|
|
||||||
const { checkAdminPrivileges } = await import('../core/manager')
|
|
||||||
const isAdmin = await checkAdminPrivileges()
|
|
||||||
|
|
||||||
if (!isAdmin) {
|
|
||||||
const escapedPath = uwpToolPath.replace(/'/g, "''")
|
|
||||||
const command = `powershell -Command "Start-Process -FilePath '${escapedPath}' -Verb RunAs -Wait"`
|
|
||||||
|
|
||||||
await execPromise(command, { windowsHide: true })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
await execFilePromise(uwpToolPath)
|
await execFilePromise(uwpToolPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -272,13 +272,7 @@ async function migration(): Promise<void> {
|
|||||||
}
|
}
|
||||||
// add default skip auth prefix
|
// add default skip auth prefix
|
||||||
if (!skipAuthPrefixes) {
|
if (!skipAuthPrefixes) {
|
||||||
await patchControledMihomoConfig({ 'skip-auth-prefixes': ['127.0.0.1/32', '::1/128'] })
|
await patchControledMihomoConfig({ 'skip-auth-prefixes': ['127.0.0.1/32'] })
|
||||||
} else if (skipAuthPrefixes.length >= 1 && skipAuthPrefixes[0] === '127.0.0.1/32') {
|
|
||||||
const filteredPrefixes = skipAuthPrefixes.filter(ip => ip !== '::1/128')
|
|
||||||
const newPrefixes = [filteredPrefixes[0], '::1/128', ...filteredPrefixes.slice(1)]
|
|
||||||
if (JSON.stringify(newPrefixes) !== JSON.stringify(skipAuthPrefixes)) {
|
|
||||||
await patchControledMihomoConfig({ 'skip-auth-prefixes': newPrefixes })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// add default authentication
|
// add default authentication
|
||||||
if (!authentication) {
|
if (!authentication) {
|
||||||
|
|||||||
@ -65,7 +65,7 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||||||
'lan-allowed-ips': ['0.0.0.0/0', '::/0'],
|
'lan-allowed-ips': ['0.0.0.0/0', '::/0'],
|
||||||
'lan-disallowed-ips': [],
|
'lan-disallowed-ips': [],
|
||||||
authentication: [],
|
authentication: [],
|
||||||
'skip-auth-prefixes': ['127.0.0.1/32', '::1/128'],
|
'skip-auth-prefixes': ['127.0.0.1/32'],
|
||||||
tun: {
|
tun: {
|
||||||
enable: false,
|
enable: false,
|
||||||
device: process.platform === 'darwin' ? 'utun1500' : 'Mihomo',
|
device: process.platform === 'darwin' ? 'utun1500' : 'Mihomo',
|
||||||
|
|||||||
@ -48,7 +48,7 @@ const Mihomo: React.FC = () => {
|
|||||||
'external-controller': externalController = '',
|
'external-controller': externalController = '',
|
||||||
secret,
|
secret,
|
||||||
authentication = [],
|
authentication = [],
|
||||||
'skip-auth-prefixes': skipAuthPrefixes = ['127.0.0.1/32', '::1/128'],
|
'skip-auth-prefixes': skipAuthPrefixes = ['127.0.0.1/32'],
|
||||||
'log-level': logLevel = 'info',
|
'log-level': logLevel = 'info',
|
||||||
'find-process-mode': findProcessMode = 'strict',
|
'find-process-mode': findProcessMode = 'strict',
|
||||||
'allow-lan': allowLan,
|
'allow-lan': allowLan,
|
||||||
@ -743,7 +743,7 @@ const Mihomo: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<div key={index} className="flex mb-2">
|
<div key={index} className="flex mb-2">
|
||||||
<Input
|
<Input
|
||||||
disabled={index === 0 || index === 1}
|
disabled={index === 0}
|
||||||
size="sm"
|
size="sm"
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder={t('mihomo.ipSegment.placeholder')}
|
placeholder={t('mihomo.ipSegment.placeholder')}
|
||||||
@ -758,7 +758,7 @@ const Mihomo: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{index < skipAuthPrefixesInput.length && index !== 0 && index !== 1 && (
|
{index < skipAuthPrefixesInput.length && index !== 0 && (
|
||||||
<Button
|
<Button
|
||||||
className="ml-2"
|
className="ml-2"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user