mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
add more mihomo config
This commit is contained in:
parent
71aedc1b70
commit
82edf850b8
|
@ -1,7 +1,7 @@
|
|||
### New Features
|
||||
|
||||
- 支持应用内自动更新
|
||||
- 支持设置是否存储选择节点
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- 修复某些Mac设备无法开启虚拟网卡的问题
|
||||
- 修复单例检测与一键导入冲突的问题
|
||||
|
|
|
@ -40,6 +40,7 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||
'tproxy-port': 0,
|
||||
'allow-lan': false,
|
||||
'unified-delay': false,
|
||||
'tcp-concurrent': false,
|
||||
'log-level': 'info',
|
||||
'find-process-mode': 'strict',
|
||||
tun: {
|
||||
|
@ -82,6 +83,10 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||
},
|
||||
'skip-domain': ['+.push.apple.com']
|
||||
},
|
||||
profile: {
|
||||
'store-selected': true,
|
||||
'store-fake-ip': true
|
||||
},
|
||||
'geo-auto-update': false,
|
||||
'geo-update-interval': 24,
|
||||
'geodata-mode': false,
|
||||
|
|
|
@ -5,7 +5,7 @@ import SettingItem from '@renderer/components/base/base-setting-item'
|
|||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||
import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config'
|
||||
import { platform } from '@renderer/utils/init'
|
||||
import { patchMihomoConfig, restartCore } from '@renderer/utils/ipc'
|
||||
import { restartCore } from '@renderer/utils/ipc'
|
||||
import React, { useState } from 'react'
|
||||
|
||||
const CoreMap = {
|
||||
|
@ -21,16 +21,19 @@ const Mihomo: React.FC = () => {
|
|||
ipv6,
|
||||
'external-controller': externalController,
|
||||
secret,
|
||||
'log-level': level = 'info',
|
||||
'find-process-mode': mode = 'strict',
|
||||
'allow-lan': lan,
|
||||
'unified-delay': delay,
|
||||
'log-level': logLevel = 'info',
|
||||
'find-process-mode': findProcessMode = 'strict',
|
||||
'allow-lan': allowLan,
|
||||
'unified-delay': unifiedDelay,
|
||||
'tcp-concurrent': tcpConcurrent,
|
||||
'mixed-port': mixedPort = 7890,
|
||||
'socks-port': socksPort = 7891,
|
||||
port: httpPort = 7892,
|
||||
'redir-port': redirPort = 0,
|
||||
'tproxy-port': tproxyPort = 0
|
||||
'tproxy-port': tproxyPort = 0,
|
||||
profile = {}
|
||||
} = controledMihomoConfig || {}
|
||||
const { 'store-selected': storeSelected, 'store-fake-ip': storeFakeIp } = profile
|
||||
|
||||
const [mixedPortInput, setMixedPortInput] = useState(mixedPort)
|
||||
const [socksPortInput, setSocksPortInput] = useState(socksPort)
|
||||
|
@ -40,11 +43,6 @@ const Mihomo: React.FC = () => {
|
|||
const [externalControllerInput, setExternalControllerInput] = useState(externalController)
|
||||
const [secretInput, setSecretInput] = useState(secret)
|
||||
|
||||
const onChange = async (patch: Partial<IMihomoConfig>): Promise<void> => {
|
||||
await patchControledMihomoConfig(patch)
|
||||
await patchMihomoConfig(patch)
|
||||
}
|
||||
|
||||
const onChangeNeedRestart = async (patch: Partial<IMihomoConfig>): Promise<void> => {
|
||||
await patchControledMihomoConfig(patch)
|
||||
await restartCore()
|
||||
|
@ -271,25 +269,52 @@ const Mihomo: React.FC = () => {
|
|||
size="sm"
|
||||
isSelected={ipv6}
|
||||
onValueChange={(v) => {
|
||||
onChange({ ipv6: v })
|
||||
onChangeNeedRestart({ ipv6: v })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem title="允许局域网连接" divider>
|
||||
<Switch
|
||||
size="sm"
|
||||
isSelected={lan}
|
||||
isSelected={allowLan}
|
||||
onValueChange={(v) => {
|
||||
onChange({ 'allow-lan': v })
|
||||
onChangeNeedRestart({ 'allow-lan': v })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem title="使用RTT延迟测试" divider>
|
||||
<Switch
|
||||
size="sm"
|
||||
isSelected={delay}
|
||||
isSelected={unifiedDelay}
|
||||
onValueChange={(v) => {
|
||||
onChange({ 'unified-delay': v })
|
||||
onChangeNeedRestart({ 'unified-delay': v })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem title="TCP并发" divider>
|
||||
<Switch
|
||||
size="sm"
|
||||
isSelected={tcpConcurrent}
|
||||
onValueChange={(v) => {
|
||||
onChangeNeedRestart({ 'tcp-concurrent': v })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem title="存储选择节点" divider>
|
||||
<Switch
|
||||
size="sm"
|
||||
isSelected={storeSelected}
|
||||
onValueChange={(v) => {
|
||||
onChangeNeedRestart({ profile: { 'store-selected': v } })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem title="存储FakeIP" divider>
|
||||
<Switch
|
||||
size="sm"
|
||||
isSelected={storeFakeIp}
|
||||
onValueChange={(v) => {
|
||||
onChangeNeedRestart({ profile: { 'store-fake-ip': v } })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
@ -297,9 +322,9 @@ const Mihomo: React.FC = () => {
|
|||
<Select
|
||||
className="w-[100px]"
|
||||
size="sm"
|
||||
selectedKeys={new Set([level])}
|
||||
selectedKeys={new Set([logLevel])}
|
||||
onSelectionChange={(v) => {
|
||||
onChange({ 'log-level': v.currentKey as LogLevel })
|
||||
onChangeNeedRestart({ 'log-level': v.currentKey as LogLevel })
|
||||
}}
|
||||
>
|
||||
<SelectItem key="silent">静默</SelectItem>
|
||||
|
@ -313,9 +338,9 @@ const Mihomo: React.FC = () => {
|
|||
<Select
|
||||
className="w-[100px]"
|
||||
size="sm"
|
||||
selectedKeys={new Set([mode])}
|
||||
selectedKeys={new Set([findProcessMode])}
|
||||
onSelectionChange={(v) => {
|
||||
onChange({ 'find-process-mode': v.currentKey as FindProcessMode })
|
||||
onChangeNeedRestart({ 'find-process-mode': v.currentKey as FindProcessMode })
|
||||
}}
|
||||
>
|
||||
<SelectItem key="strict">自动</SelectItem>
|
||||
|
|
8
src/shared/types.d.ts
vendored
8
src/shared/types.d.ts
vendored
|
@ -296,6 +296,12 @@ interface IMihomoSnifferConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface IMihomoProfileConfig {
|
||||
'store-selected'?: boolean
|
||||
'store-fake-ip'?: boolean
|
||||
}
|
||||
|
||||
interface IMihomoConfig {
|
||||
'external-controller': string
|
||||
secret?: string
|
||||
|
@ -304,6 +310,7 @@ interface IMihomoConfig {
|
|||
'mixed-port': number
|
||||
'allow-lan': boolean
|
||||
'unified-delay': boolean
|
||||
'tcp-concurrent': boolean
|
||||
'log-level': LogLevel
|
||||
'find-process-mode': FindProcessMode
|
||||
'socks-port'?: number
|
||||
|
@ -326,6 +333,7 @@ interface IMihomoConfig {
|
|||
tun: IMihomoTunConfig
|
||||
dns: IMihomoDNSConfig
|
||||
sniffer: IMihomoSnifferConfig
|
||||
profile: IMihomoProfileConfig
|
||||
}
|
||||
|
||||
interface IProfileConfig {
|
||||
|
|
Loading…
Reference in New Issue
Block a user