mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
update common options (#2)
This commit is contained in:
parent
179a87d4bf
commit
951cd85c12
@ -75,7 +75,7 @@ export function grantCorePermition(corePath: string): void {
|
|||||||
try {
|
try {
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
execSync(
|
execSync(
|
||||||
`echo "${password}" | sudo -S setcap cap_net_bind_service,cap_net_admin,cap_dac_override,cap_net_raw=+ep ${corePath}`
|
`echo "${password}" | sudo -S setcap cap_net_bind_service,cap_net_admin,cap_sys_ptrace,cap_dac_read_search,cap_dac_override,cap_net_raw=+ep ${corePath}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
|
|||||||
@ -12,12 +12,15 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||||||
mode: 'rule',
|
mode: 'rule',
|
||||||
'mixed-port': 7890,
|
'mixed-port': 7890,
|
||||||
'allow-lan': false,
|
'allow-lan': false,
|
||||||
|
'unified-delay': false,
|
||||||
'log-level': 'info',
|
'log-level': 'info',
|
||||||
|
'find-process-mode': 'strict',
|
||||||
tun: {
|
tun: {
|
||||||
enable: false,
|
enable: false,
|
||||||
device: 'Mihomo',
|
device: 'Mihomo',
|
||||||
stack: 'mixed',
|
stack: 'mixed',
|
||||||
'auto-route': true,
|
'auto-route': true,
|
||||||
|
'auto-redirect': false,
|
||||||
'auto-detect-interface': true,
|
'auto-detect-interface': true,
|
||||||
'dns-hijack': ['any:53'],
|
'dns-hijack': ['any:53'],
|
||||||
mtu: 1500
|
mtu: 1500
|
||||||
|
|||||||
@ -21,7 +21,9 @@ const Mihomo: React.FC = () => {
|
|||||||
'external-controller': externalController,
|
'external-controller': externalController,
|
||||||
secret,
|
secret,
|
||||||
'log-level': level = 'info',
|
'log-level': level = 'info',
|
||||||
|
'find-process-mode': mode = 'strict',
|
||||||
'allow-lan': lan,
|
'allow-lan': lan,
|
||||||
|
'unified-delay': delay,
|
||||||
'mixed-port': mixedPort = 7890
|
'mixed-port': mixedPort = 7890
|
||||||
} = controledMihomoConfig || {}
|
} = controledMihomoConfig || {}
|
||||||
|
|
||||||
@ -150,7 +152,16 @@ const Mihomo: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
<SettingItem title="日志等级">
|
<SettingItem title="使用RTT延迟测试" divider>
|
||||||
|
<Switch
|
||||||
|
size="sm"
|
||||||
|
isSelected={delay}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
onChange({ 'unified-delay': v })
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem title="日志等级" divider>
|
||||||
<Select
|
<Select
|
||||||
className="w-[100px]"
|
className="w-[100px]"
|
||||||
size="sm"
|
size="sm"
|
||||||
@ -166,6 +177,20 @@ const Mihomo: React.FC = () => {
|
|||||||
<SelectItem key="debug">调试</SelectItem>
|
<SelectItem key="debug">调试</SelectItem>
|
||||||
</Select>
|
</Select>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
<SettingItem title="查找进程">
|
||||||
|
<Select
|
||||||
|
className="w-[100px]"
|
||||||
|
size="sm"
|
||||||
|
selectedKeys={new Set([mode])}
|
||||||
|
onSelectionChange={(v) => {
|
||||||
|
onChange({ 'find-process-mode': v.currentKey as FindProcessMode })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SelectItem key="strict">自动</SelectItem>
|
||||||
|
<SelectItem key="off">关闭</SelectItem>
|
||||||
|
<SelectItem key="always">开启</SelectItem>
|
||||||
|
</Select>
|
||||||
|
</SettingItem>
|
||||||
</SettingCard>
|
</SettingCard>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import SettingCard from '@renderer/components/base/base-setting-card'
|
|||||||
import SettingItem from '@renderer/components/base/base-setting-item'
|
import SettingItem from '@renderer/components/base/base-setting-item'
|
||||||
import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config'
|
import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config'
|
||||||
import { restartCore } from '@renderer/utils/ipc'
|
import { restartCore } from '@renderer/utils/ipc'
|
||||||
|
import { platform } from '@renderer/utils/init'
|
||||||
import React, { Key, useState } from 'react'
|
import React, { Key, useState } from 'react'
|
||||||
|
|
||||||
const Tun: React.FC = () => {
|
const Tun: React.FC = () => {
|
||||||
@ -13,6 +14,7 @@ const Tun: React.FC = () => {
|
|||||||
device = 'Mihomo',
|
device = 'Mihomo',
|
||||||
stack = 'mixed',
|
stack = 'mixed',
|
||||||
'auto-route': autoRoute = true,
|
'auto-route': autoRoute = true,
|
||||||
|
'auto-redirect': autoRedirect = false,
|
||||||
'auto-detect-interface': autoDetectInterface = true,
|
'auto-detect-interface': autoDetectInterface = true,
|
||||||
'dns-hijack': dnsHijack = ['any:53'],
|
'dns-hijack': dnsHijack = ['any:53'],
|
||||||
'strict-route': strictRoute = false,
|
'strict-route': strictRoute = false,
|
||||||
@ -23,6 +25,7 @@ const Tun: React.FC = () => {
|
|||||||
device,
|
device,
|
||||||
stack,
|
stack,
|
||||||
autoRoute,
|
autoRoute,
|
||||||
|
autoRedirect,
|
||||||
autoDetectInterface,
|
autoDetectInterface,
|
||||||
dnsHijack,
|
dnsHijack,
|
||||||
strictRoute,
|
strictRoute,
|
||||||
@ -47,6 +50,7 @@ const Tun: React.FC = () => {
|
|||||||
device: values.device,
|
device: values.device,
|
||||||
stack: values.stack,
|
stack: values.stack,
|
||||||
'auto-route': values.autoRoute,
|
'auto-route': values.autoRoute,
|
||||||
|
'auto-redirect': values.autoRedirect,
|
||||||
'auto-detect-interface': values.autoDetectInterface,
|
'auto-detect-interface': values.autoDetectInterface,
|
||||||
'dns-hijack': values.dnsHijack,
|
'dns-hijack': values.dnsHijack,
|
||||||
'strict-route': values.strictRoute,
|
'strict-route': values.strictRoute,
|
||||||
@ -100,6 +104,17 @@ const Tun: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
{platform === 'linux' && (
|
||||||
|
<SettingItem title="自动设置TCP重定向" divider>
|
||||||
|
<Switch
|
||||||
|
size="sm"
|
||||||
|
isSelected={values.autoRedirect}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setValues({ ...values, autoRedirect: v })
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
|
)}
|
||||||
<SettingItem title="自动选择流量出口接口" divider>
|
<SettingItem title="自动选择流量出口接口" divider>
|
||||||
<Switch
|
<Switch
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
3
src/shared/types.d.ts
vendored
3
src/shared/types.d.ts
vendored
@ -4,6 +4,7 @@ type SysProxyMode = 'auto' | 'manual'
|
|||||||
type MihomoGroupType = 'Selector'
|
type MihomoGroupType = 'Selector'
|
||||||
type MihomoProxyType = 'Shadowsocks'
|
type MihomoProxyType = 'Shadowsocks'
|
||||||
type TunStack = 'gvisor' | 'mixed' | 'system'
|
type TunStack = 'gvisor' | 'mixed' | 'system'
|
||||||
|
type FindProcessMode = 'off' | 'strict' | 'always'
|
||||||
|
|
||||||
interface IMihomoVersion {
|
interface IMihomoVersion {
|
||||||
version: string
|
version: string
|
||||||
@ -177,7 +178,9 @@ interface IMihomoConfig {
|
|||||||
mode: OutboundMode
|
mode: OutboundMode
|
||||||
'mixed-port': number
|
'mixed-port': number
|
||||||
'allow-lan': boolean
|
'allow-lan': boolean
|
||||||
|
'unified-delay': boolean
|
||||||
'log-level': LogLevel
|
'log-level': LogLevel
|
||||||
|
'find-process-mode': FindProcessMode
|
||||||
'socks-port'?: number
|
'socks-port'?: number
|
||||||
port?: number
|
port?: number
|
||||||
proxies?: []
|
proxies?: []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user