mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-28 05:30:29 +08:00
Compare commits
2 Commits
c73d147938
...
d51d6ed0d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d51d6ed0d7 | ||
|
|
b61d0e68ed |
@ -12,6 +12,9 @@ export async function getControledMihomoConfig(force = false): Promise<Partial<I
|
|||||||
if (force || !controledMihomoConfig) {
|
if (force || !controledMihomoConfig) {
|
||||||
const data = await readFile(controledMihomoConfigPath(), 'utf-8')
|
const data = await readFile(controledMihomoConfigPath(), 'utf-8')
|
||||||
controledMihomoConfig = yaml.parse(data, { merge: true }) || defaultControledMihomoConfig
|
controledMihomoConfig = yaml.parse(data, { merge: true }) || defaultControledMihomoConfig
|
||||||
|
|
||||||
|
// 确保配置包含所有必要的默认字段,处理升级场景
|
||||||
|
controledMihomoConfig = deepMerge(defaultControledMihomoConfig, controledMihomoConfig)
|
||||||
}
|
}
|
||||||
if (typeof controledMihomoConfig !== 'object')
|
if (typeof controledMihomoConfig !== 'object')
|
||||||
controledMihomoConfig = defaultControledMihomoConfig
|
controledMihomoConfig = defaultControledMihomoConfig
|
||||||
@ -31,8 +34,12 @@ export async function patchControledMihomoConfig(patch: Partial<IMihomoConfig>):
|
|||||||
controledMihomoConfig = deepMerge(controledMihomoConfig, patch)
|
controledMihomoConfig = deepMerge(controledMihomoConfig, patch)
|
||||||
|
|
||||||
// 从不接管状态恢复
|
// 从不接管状态恢复
|
||||||
if (controlDns && controledMihomoConfig.dns?.ipv6 === undefined) {
|
if (controlDns) {
|
||||||
controledMihomoConfig.dns = defaultControledMihomoConfig.dns
|
// 确保DNS配置包含所有必要的默认字段,特别是新增的fallback等
|
||||||
|
controledMihomoConfig.dns = deepMerge(
|
||||||
|
defaultControledMihomoConfig.dns || {},
|
||||||
|
controledMihomoConfig.dns || {}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if (controlSniff && !controledMihomoConfig.sniffer) {
|
if (controlSniff && !controledMihomoConfig.sniffer) {
|
||||||
controledMihomoConfig.sniffer = defaultControledMihomoConfig.sniffer
|
controledMihomoConfig.sniffer = defaultControledMihomoConfig.sniffer
|
||||||
|
|||||||
@ -86,10 +86,18 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||||||
'fake-ip-filter': ['*', '+.lan', '+.local', 'time.*.com', 'ntp.*.com', '+.market.xiaomi.com'],
|
'fake-ip-filter': ['*', '+.lan', '+.local', 'time.*.com', 'ntp.*.com', '+.market.xiaomi.com'],
|
||||||
'use-hosts': false,
|
'use-hosts': false,
|
||||||
'use-system-hosts': false,
|
'use-system-hosts': false,
|
||||||
|
'respect-rules': false,
|
||||||
'default-nameserver': ['tls://223.5.5.5'],
|
'default-nameserver': ['tls://223.5.5.5'],
|
||||||
nameserver: ['https://120.53.53.53/dns-query', 'https://223.5.5.5/dns-query'],
|
nameserver: ['https://doh.pub/dns-query', 'https://dns.alidns.com/dns-query'],
|
||||||
'proxy-server-nameserver': ['https://120.53.53.53/dns-query', 'https://223.5.5.5/dns-query'],
|
'proxy-server-nameserver': ['https://doh.pub/dns-query', 'https://dns.alidns.com/dns-query'],
|
||||||
'direct-nameserver': []
|
'direct-nameserver': [],
|
||||||
|
fallback: [],
|
||||||
|
'fallback-filter': {
|
||||||
|
geoip: true,
|
||||||
|
'geoip-code': 'CN',
|
||||||
|
ipcidr: ['240.0.0.0/4', '0.0.0.0/32'],
|
||||||
|
domain: ['+.google.com', '+.facebook.com', '+.youtube.com']
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sniffer: {
|
sniffer: {
|
||||||
enable: true,
|
enable: true,
|
||||||
|
|||||||
@ -51,6 +51,7 @@ const GeneralConfig: React.FC = () => {
|
|||||||
proxyInTray = true,
|
proxyInTray = true,
|
||||||
disableTray = false,
|
disableTray = false,
|
||||||
disableTrayIconColor = false,
|
disableTrayIconColor = false,
|
||||||
|
disableAnimations = false,
|
||||||
showFloatingWindow: showFloating = false,
|
showFloatingWindow: showFloating = false,
|
||||||
spinFloatingIcon = true,
|
spinFloatingIcon = true,
|
||||||
floatingWindowCompatMode = true,
|
floatingWindowCompatMode = true,
|
||||||
@ -388,6 +389,15 @@ const GeneralConfig: React.FC = () => {
|
|||||||
}, 1000)}
|
}, 1000)}
|
||||||
/>
|
/>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
<SettingItem title={t('settings.disableAnimations')} divider>
|
||||||
|
<Switch
|
||||||
|
size="sm"
|
||||||
|
isSelected={disableAnimations}
|
||||||
|
onValueChange={async (v) => {
|
||||||
|
await patchAppConfig({ disableAnimations: v })
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
title={t('settings.disableHardwareAcceleration')}
|
title={t('settings.disableHardwareAcceleration')}
|
||||||
actions={
|
actions={
|
||||||
|
|||||||
@ -36,7 +36,7 @@ interface Props {
|
|||||||
const ConnCard: React.FC<Props> = (props) => {
|
const ConnCard: React.FC<Props> = (props) => {
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { showTraffic = false, connectionCardStatus = 'col-span-2' } = appConfig || {}
|
const { showTraffic = false, connectionCardStatus = 'col-span-2', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/connections')
|
const match = location.pathname.includes('/connections')
|
||||||
@ -187,7 +187,7 @@ const ConnCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
@ -234,7 +234,7 @@ const ConnCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const DNSCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig, patchAppConfig } = useAppConfig()
|
const { appConfig, patchAppConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { dnsCardStatus = 'col-span-1', controlDns = true } = appConfig || {}
|
const { dnsCardStatus = 'col-span-1', controlDns = true, disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/dns')
|
const match = location.pathname.includes('/dns')
|
||||||
@ -78,7 +78,7 @@ const DNSCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const LogCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { logCardStatus = 'col-span-1' } = appConfig || {}
|
const { logCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/logs')
|
const match = location.pathname.includes('/logs')
|
||||||
@ -65,7 +65,7 @@ const LogCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -19,7 +19,7 @@ interface Props {
|
|||||||
const MihomoCoreCard: React.FC<Props> = (props) => {
|
const MihomoCoreCard: React.FC<Props> = (props) => {
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { mihomoCoreCardStatus = 'col-span-2' } = appConfig || {}
|
const { mihomoCoreCardStatus = 'col-span-2', disableAnimations = false } = appConfig || {}
|
||||||
const { data: version, mutate } = useSWR('mihomoVersion', mihomoVersion)
|
const { data: version, mutate } = useSWR('mihomoVersion', mihomoVersion)
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -87,7 +87,7 @@ const MihomoCoreCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<div
|
<div
|
||||||
@ -138,7 +138,7 @@ const MihomoCoreCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const OverrideCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { overrideCardStatus = 'col-span-1' } = appConfig || {}
|
const { overrideCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/override')
|
const match = location.pathname.includes('/override')
|
||||||
@ -64,7 +64,7 @@ const OverrideCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -26,7 +26,7 @@ const ProfileCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig, patchAppConfig } = useAppConfig()
|
const { appConfig, patchAppConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { profileCardStatus = 'col-span-2', profileDisplayDate = 'expire' } = appConfig || {}
|
const { profileCardStatus = 'col-span-2', profileDisplayDate = 'expire', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/profiles')
|
const match = location.pathname.includes('/profiles')
|
||||||
@ -92,7 +92,7 @@ const ProfileCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1">
|
<CardBody className="pb-1">
|
||||||
<div
|
<div
|
||||||
@ -219,7 +219,7 @@ const ProfileCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const ProxyCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { proxyCardStatus = 'col-span-1' } = appConfig || {}
|
const { proxyCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/proxies')
|
const match = location.pathname.includes('/proxies')
|
||||||
@ -67,7 +67,7 @@ const ProxyCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const ResourceCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { resourceCardStatus = 'col-span-1' } = appConfig || {}
|
const { resourceCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/resources')
|
const match = location.pathname.includes('/resources')
|
||||||
@ -65,7 +65,7 @@ const ResourceCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const RuleCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { ruleCardStatus = 'col-span-1' } = appConfig || {}
|
const { ruleCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/rules')
|
const match = location.pathname.includes('/rules')
|
||||||
@ -67,7 +67,7 @@ const RuleCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -17,7 +17,7 @@ const SniffCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig, patchAppConfig } = useAppConfig()
|
const { appConfig, patchAppConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { sniffCardStatus = 'col-span-1', controlSniff = true } = appConfig || {}
|
const { sniffCardStatus = 'col-span-1', controlSniff = true, disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/sniffer')
|
const match = location.pathname.includes('/sniffer')
|
||||||
@ -78,7 +78,7 @@ const SniffCard: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const SubStoreCard: React.FC<Props> = (props) => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { iconOnly } = props
|
const { iconOnly } = props
|
||||||
const { substoreCardStatus = 'col-span-1', useSubStore = true } = appConfig || {}
|
const { substoreCardStatus = 'col-span-1', useSubStore = true, disableAnimations = false } = appConfig || {}
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/substore')
|
const match = location.pathname.includes('/substore')
|
||||||
@ -66,7 +66,7 @@ const SubStoreCard: React.FC<Props> = (props) => {
|
|||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
fullWidth
|
fullWidth
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const SysproxySwitcher: React.FC<Props> = (props) => {
|
|||||||
const match = location.pathname.includes('/sysproxy')
|
const match = location.pathname.includes('/sysproxy')
|
||||||
const { appConfig, patchAppConfig } = useAppConfig()
|
const { appConfig, patchAppConfig } = useAppConfig()
|
||||||
const { controledMihomoConfig } = useControledMihomoConfig()
|
const { controledMihomoConfig } = useControledMihomoConfig()
|
||||||
const { sysProxy, sysproxyCardStatus = 'col-span-1' } = appConfig || {}
|
const { sysProxy, sysproxyCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const { tun } = controledMihomoConfig || {}
|
const { tun } = controledMihomoConfig || {}
|
||||||
const { enable } = sysProxy || {}
|
const { enable } = sysProxy || {}
|
||||||
const {
|
const {
|
||||||
@ -93,7 +93,7 @@ const SysproxySwitcher: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const TunSwitcher: React.FC<Props> = (props) => {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const match = location.pathname.includes('/tun') || false
|
const match = location.pathname.includes('/tun') || false
|
||||||
const { appConfig } = useAppConfig()
|
const { appConfig } = useAppConfig()
|
||||||
const { tunCardStatus = 'col-span-1' } = appConfig || {}
|
const { tunCardStatus = 'col-span-1', disableAnimations = false } = appConfig || {}
|
||||||
const sysProxyEnabled = appConfig?.sysProxy?.enable ?? false
|
const sysProxyEnabled = appConfig?.sysProxy?.enable ?? false
|
||||||
const { controledMihomoConfig, patchControledMihomoConfig } = useControledMihomoConfig()
|
const { controledMihomoConfig, patchControledMihomoConfig } = useControledMihomoConfig()
|
||||||
const { tun } = controledMihomoConfig || {}
|
const { tun } = controledMihomoConfig || {}
|
||||||
@ -127,7 +127,7 @@ const TunSwitcher: React.FC<Props> = (props) => {
|
|||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
{...attributes}
|
{...attributes}
|
||||||
{...listeners}
|
{...listeners}
|
||||||
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
|
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? `${disableAnimations ? '' : 'scale-[0.95] tap-highlight-transparent'}` : ''}`}
|
||||||
>
|
>
|
||||||
<CardBody className="pb-1 pt-0 px-0">
|
<CardBody className="pb-1 pt-0 px-0">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@ -62,6 +62,7 @@
|
|||||||
"settings.disableTray": "Disable Tray Icon",
|
"settings.disableTray": "Disable Tray Icon",
|
||||||
"settings.proxyInTray": "Show Proxy Info in Tray Menu",
|
"settings.proxyInTray": "Show Proxy Info in Tray Menu",
|
||||||
"settings.disableTrayIconColor": "Disable Tray Icon Color Changes",
|
"settings.disableTrayIconColor": "Disable Tray Icon Color Changes",
|
||||||
|
"settings.disableAnimations": "Disable Animation Effects",
|
||||||
"settings.showTraffic_windows": "Show Network Speed in Taskbar",
|
"settings.showTraffic_windows": "Show Network Speed in Taskbar",
|
||||||
"settings.showTraffic_mac": "Show Network Speed in Status Bar",
|
"settings.showTraffic_mac": "Show Network Speed in Status Bar",
|
||||||
"settings.showDockIcon": "Show Dock Icon",
|
"settings.showDockIcon": "Show Dock Icon",
|
||||||
@ -350,6 +351,15 @@
|
|||||||
"dns.nameserverPlaceholder": "Example: tls://dns.alidns.com",
|
"dns.nameserverPlaceholder": "Example: tls://dns.alidns.com",
|
||||||
"dns.directNameserver": "Direct Resolution Server",
|
"dns.directNameserver": "Direct Resolution Server",
|
||||||
"dns.directNameserverPlaceholder": "Example: tls://dns.alidns.com",
|
"dns.directNameserverPlaceholder": "Example: tls://dns.alidns.com",
|
||||||
|
"dns.fallback": "Fallback Servers",
|
||||||
|
"dns.fallbackPlaceholder": "Example: https://dns.alidns.com/dns-query",
|
||||||
|
"dns.fallbackFilter.title": "Fallback Filter Settings",
|
||||||
|
"dns.fallbackFilter.geoip": "GeoIP Filter",
|
||||||
|
"dns.fallbackFilter.geoipCode": "GeoIP Country Code",
|
||||||
|
"dns.fallbackFilter.ipcidr": "Fallback IP CIDR",
|
||||||
|
"dns.fallbackFilter.ipcidrPlaceholder": "Example: 240.0.0.0/4",
|
||||||
|
"dns.fallbackFilter.domain": "Fallback Domains",
|
||||||
|
"dns.fallbackFilter.domainPlaceholder": "Example: +.google.com",
|
||||||
"dns.nameserverPolicy.title": "Override DNS Policy",
|
"dns.nameserverPolicy.title": "Override DNS Policy",
|
||||||
"dns.nameserverPolicy.list": "DNS Policy List",
|
"dns.nameserverPolicy.list": "DNS Policy List",
|
||||||
"dns.nameserverPolicy.domainPlaceholder": "Domain",
|
"dns.nameserverPolicy.domainPlaceholder": "Domain",
|
||||||
|
|||||||
@ -59,6 +59,7 @@
|
|||||||
"settings.disableTray": "غیرفعال کردن آیکون سیستمتری",
|
"settings.disableTray": "غیرفعال کردن آیکون سیستمتری",
|
||||||
"settings.proxyInTray": "نمایش اطلاعات پراکسی در منوی سیستمتری",
|
"settings.proxyInTray": "نمایش اطلاعات پراکسی در منوی سیستمتری",
|
||||||
"settings.disableTrayIconColor": "غیرفعال کردن تغییر رنگ آیکون تری",
|
"settings.disableTrayIconColor": "غیرفعال کردن تغییر رنگ آیکون تری",
|
||||||
|
"settings.disableAnimations": "غیرفعال کردن جلوههای انیمیشن",
|
||||||
"settings.showTraffic_windows": "نمایش سرعت شبکه در نوار وظیفه",
|
"settings.showTraffic_windows": "نمایش سرعت شبکه در نوار وظیفه",
|
||||||
"settings.showTraffic_mac": "نمایش سرعت شبکه در نوار وضعیت",
|
"settings.showTraffic_mac": "نمایش سرعت شبکه در نوار وضعیت",
|
||||||
"settings.showDockIcon": "نمایش آیکون Dock",
|
"settings.showDockIcon": "نمایش آیکون Dock",
|
||||||
@ -344,6 +345,15 @@
|
|||||||
"dns.nameserverPlaceholder": "مثال: tls://dns.alidns.com",
|
"dns.nameserverPlaceholder": "مثال: tls://dns.alidns.com",
|
||||||
"dns.directNameserver": "سرور حل نام مستقیم",
|
"dns.directNameserver": "سرور حل نام مستقیم",
|
||||||
"dns.directNameserverPlaceholder": "مثال: tls://dns.alidns.com",
|
"dns.directNameserverPlaceholder": "مثال: tls://dns.alidns.com",
|
||||||
|
"dns.fallback": "سرورهای پشتیبان",
|
||||||
|
"dns.fallbackPlaceholder": "مثال: https://dns.alidns.com/dns-query",
|
||||||
|
"dns.fallbackFilter.title": "تنظیمات فیلتر پشتیبان",
|
||||||
|
"dns.fallbackFilter.geoip": "فیلتر GeoIP",
|
||||||
|
"dns.fallbackFilter.geoipCode": "کد کشور GeoIP",
|
||||||
|
"dns.fallbackFilter.ipcidr": "CIDR آیپی پشتیبان",
|
||||||
|
"dns.fallbackFilter.ipcidrPlaceholder": "مثال: 240.0.0.0/4",
|
||||||
|
"dns.fallbackFilter.domain": "دامنههای پشتیبان",
|
||||||
|
"dns.fallbackFilter.domainPlaceholder": "مثال: +.google.com",
|
||||||
"dns.nameserverPolicy.title": "سیاست جایگزینی DNS",
|
"dns.nameserverPolicy.title": "سیاست جایگزینی DNS",
|
||||||
"dns.nameserverPolicy.list": "لیست سیاست DNS",
|
"dns.nameserverPolicy.list": "لیست سیاست DNS",
|
||||||
"dns.nameserverPolicy.domainPlaceholder": "دامنه",
|
"dns.nameserverPolicy.domainPlaceholder": "دامنه",
|
||||||
|
|||||||
@ -59,6 +59,7 @@
|
|||||||
"settings.disableTray": "Отключить значок в трее",
|
"settings.disableTray": "Отключить значок в трее",
|
||||||
"settings.proxyInTray": "Показывать информацию о прокси в трее",
|
"settings.proxyInTray": "Показывать информацию о прокси в трее",
|
||||||
"settings.disableTrayIconColor": "Отключить смену цвета значка в трее",
|
"settings.disableTrayIconColor": "Отключить смену цвета значка в трее",
|
||||||
|
"settings.disableAnimations": "Отключить анимационные эффекты",
|
||||||
"settings.showTraffic_windows": "Показывать скорость в панели задач",
|
"settings.showTraffic_windows": "Показывать скорость в панели задач",
|
||||||
"settings.showTraffic_mac": "Показывать скорость в строке состояния",
|
"settings.showTraffic_mac": "Показывать скорость в строке состояния",
|
||||||
"settings.showDockIcon": "Показывать значок в доке",
|
"settings.showDockIcon": "Показывать значок в доке",
|
||||||
@ -344,6 +345,15 @@
|
|||||||
"dns.nameserverPlaceholder": "Пример: tls://dns.alidns.com",
|
"dns.nameserverPlaceholder": "Пример: tls://dns.alidns.com",
|
||||||
"dns.directNameserver": "Сервер прямого разрешения",
|
"dns.directNameserver": "Сервер прямого разрешения",
|
||||||
"dns.directNameserverPlaceholder": "Пример: tls://dns.alidns.com",
|
"dns.directNameserverPlaceholder": "Пример: tls://dns.alidns.com",
|
||||||
|
"dns.fallback": "Резервные серверы",
|
||||||
|
"dns.fallbackPlaceholder": "Пример: https://dns.alidns.com/dns-query",
|
||||||
|
"dns.fallbackFilter.title": "Настройки резервного фильтра",
|
||||||
|
"dns.fallbackFilter.geoip": "GeoIP фильтр",
|
||||||
|
"dns.fallbackFilter.geoipCode": "GeoIP код страны",
|
||||||
|
"dns.fallbackFilter.ipcidr": "Резервные IP CIDR",
|
||||||
|
"dns.fallbackFilter.ipcidrPlaceholder": "Пример: 240.0.0.0/4",
|
||||||
|
"dns.fallbackFilter.domain": "Резервные домены",
|
||||||
|
"dns.fallbackFilter.domainPlaceholder": "Пример: +.google.com",
|
||||||
"dns.nameserverPolicy.title": "Переопределение политики DNS",
|
"dns.nameserverPolicy.title": "Переопределение политики DNS",
|
||||||
"dns.nameserverPolicy.list": "Список политик DNS",
|
"dns.nameserverPolicy.list": "Список политик DNS",
|
||||||
"dns.nameserverPolicy.domainPlaceholder": "Домен",
|
"dns.nameserverPolicy.domainPlaceholder": "Домен",
|
||||||
|
|||||||
@ -62,6 +62,7 @@
|
|||||||
"settings.disableTray": "禁用托盘图标",
|
"settings.disableTray": "禁用托盘图标",
|
||||||
"settings.proxyInTray": "在托盘菜单显示代理信息",
|
"settings.proxyInTray": "在托盘菜单显示代理信息",
|
||||||
"settings.disableTrayIconColor": "禁用托盘图标颜色变化",
|
"settings.disableTrayIconColor": "禁用托盘图标颜色变化",
|
||||||
|
"settings.disableAnimations": "禁用动画效果",
|
||||||
"settings.showTraffic_windows": "在任务栏显示网速",
|
"settings.showTraffic_windows": "在任务栏显示网速",
|
||||||
"settings.showTraffic_mac": "在状态栏显示网速",
|
"settings.showTraffic_mac": "在状态栏显示网速",
|
||||||
"settings.showDockIcon": "显示 Dock 图标",
|
"settings.showDockIcon": "显示 Dock 图标",
|
||||||
@ -359,6 +360,15 @@
|
|||||||
"dns.customHosts.list": "Hosts 列表",
|
"dns.customHosts.list": "Hosts 列表",
|
||||||
"dns.customHosts.domainPlaceholder": "域名",
|
"dns.customHosts.domainPlaceholder": "域名",
|
||||||
"dns.customHosts.valuePlaceholder": "域名或 IP",
|
"dns.customHosts.valuePlaceholder": "域名或 IP",
|
||||||
|
"dns.fallback": "回退服务器",
|
||||||
|
"dns.fallbackPlaceholder": "例:https://dns.alidns.com/dns-query",
|
||||||
|
"dns.fallbackFilter.title": "回退过滤设置",
|
||||||
|
"dns.fallbackFilter.geoip": "GeoIP 过滤",
|
||||||
|
"dns.fallbackFilter.geoipCode": "GeoIP 国家代码",
|
||||||
|
"dns.fallbackFilter.ipcidr": "回退 IP CIDR",
|
||||||
|
"dns.fallbackFilter.ipcidrPlaceholder": "例:240.0.0.0/4",
|
||||||
|
"dns.fallbackFilter.domain": "回退域名",
|
||||||
|
"dns.fallbackFilter.domainPlaceholder": "例:+.google.com",
|
||||||
"dns.saveOnly": "仅保存",
|
"dns.saveOnly": "仅保存",
|
||||||
"profiles.title": "订阅管理",
|
"profiles.title": "订阅管理",
|
||||||
"profiles.updateAll": "更新全部订阅",
|
"profiles.updateAll": "更新全部订阅",
|
||||||
|
|||||||
@ -37,7 +37,14 @@ const DNS: React.FC = () => {
|
|||||||
'https://doh.pub/dns-query',
|
'https://doh.pub/dns-query',
|
||||||
'https://dns.alidns.com/dns-query'
|
'https://dns.alidns.com/dns-query'
|
||||||
],
|
],
|
||||||
'direct-nameserver': directNameserver = []
|
'direct-nameserver': directNameserver = [],
|
||||||
|
fallback = [],
|
||||||
|
'fallback-filter': fallbackFilter = {
|
||||||
|
geoip: true,
|
||||||
|
'geoip-code': 'CN',
|
||||||
|
ipcidr: ['240.0.0.0/4', '0.0.0.0/32'],
|
||||||
|
domain: ['+.google.com', '+.facebook.com', '+.youtube.com']
|
||||||
|
}
|
||||||
} = dns || {}
|
} = dns || {}
|
||||||
const [changed, setChanged] = useState(false)
|
const [changed, setChanged] = useState(false)
|
||||||
const [values, originSetValues] = useState({
|
const [values, originSetValues] = useState({
|
||||||
@ -53,6 +60,11 @@ const DNS: React.FC = () => {
|
|||||||
nameserver,
|
nameserver,
|
||||||
proxyServerNameserver,
|
proxyServerNameserver,
|
||||||
directNameserver,
|
directNameserver,
|
||||||
|
fallback,
|
||||||
|
fallbackGeoip: fallbackFilter?.geoip || true,
|
||||||
|
fallbackGeoipCode: fallbackFilter?.['geoip-code'] || 'CN',
|
||||||
|
fallbackIpcidr: fallbackFilter?.ipcidr || ['240.0.0.0/4', '0.0.0.0/32'],
|
||||||
|
fallbackDomain: fallbackFilter?.domain || ['+.google.com', '+.facebook.com', '+.youtube.com'],
|
||||||
useNameserverPolicy,
|
useNameserverPolicy,
|
||||||
nameserverPolicy: Object.entries(nameserverPolicy || {}).map(([domain, value]) => ({
|
nameserverPolicy: Object.entries(nameserverPolicy || {}).map(([domain, value]) => ({
|
||||||
domain,
|
domain,
|
||||||
@ -160,8 +172,13 @@ const DNS: React.FC = () => {
|
|||||||
nameserver: values.nameserver,
|
nameserver: values.nameserver,
|
||||||
'proxy-server-nameserver': values.proxyServerNameserver,
|
'proxy-server-nameserver': values.proxyServerNameserver,
|
||||||
'direct-nameserver': values.directNameserver,
|
'direct-nameserver': values.directNameserver,
|
||||||
fallback: undefined,
|
fallback: values.fallback,
|
||||||
'fallback-filter': undefined
|
'fallback-filter': {
|
||||||
|
geoip: values.fallbackGeoip,
|
||||||
|
'geoip-code': values.fallbackGeoipCode,
|
||||||
|
ipcidr: values.fallbackIpcidr,
|
||||||
|
domain: values.fallbackDomain
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (values.useNameserverPolicy) {
|
if (values.useNameserverPolicy) {
|
||||||
dnsConfig['nameserver-policy'] = Object.fromEntries(
|
dnsConfig['nameserver-policy'] = Object.fromEntries(
|
||||||
@ -388,6 +405,42 @@ const DNS: React.FC = () => {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<Divider className="my-2" />
|
||||||
|
<div className="flex flex-col items-stretch">
|
||||||
|
<h3>{t('dns.fallback')}</h3>
|
||||||
|
{renderListInputs('fallback', t('dns.fallbackPlaceholder'))}
|
||||||
|
</div>
|
||||||
|
</SettingCard>
|
||||||
|
<SettingCard title={t('dns.fallbackFilter.title')}>
|
||||||
|
<SettingItem title={t('dns.fallbackFilter.geoip')} divider>
|
||||||
|
<Switch
|
||||||
|
size="sm"
|
||||||
|
isSelected={values.fallbackGeoip}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setValues({ ...values, fallbackGeoip: v })
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem title={t('dns.fallbackFilter.geoipCode')} divider>
|
||||||
|
<Input
|
||||||
|
size="sm"
|
||||||
|
className="w-[100px]"
|
||||||
|
value={values.fallbackGeoipCode}
|
||||||
|
placeholder="CN"
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setValues({ ...values, fallbackGeoipCode: v })
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SettingItem>
|
||||||
|
<div className="flex flex-col items-stretch">
|
||||||
|
<h3>{t('dns.fallbackFilter.ipcidr')}</h3>
|
||||||
|
{renderListInputs('fallbackIpcidr', t('dns.fallbackFilter.ipcidrPlaceholder'))}
|
||||||
|
</div>
|
||||||
|
<Divider className="my-2" />
|
||||||
|
<div className="flex flex-col items-stretch">
|
||||||
|
<h3>{t('dns.fallbackFilter.domain')}</h3>
|
||||||
|
{renderListInputs('fallbackDomain', t('dns.fallbackFilter.domainPlaceholder'))}
|
||||||
|
</div>
|
||||||
</SettingCard>
|
</SettingCard>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
)
|
)
|
||||||
|
|||||||
1
src/shared/types.d.ts
vendored
1
src/shared/types.d.ts
vendored
@ -288,6 +288,7 @@ interface IAppConfig {
|
|||||||
useDockIcon?: boolean
|
useDockIcon?: boolean
|
||||||
showTraffic?: boolean
|
showTraffic?: boolean
|
||||||
disableTrayIconColor?: boolean
|
disableTrayIconColor?: boolean
|
||||||
|
disableAnimations?: boolean
|
||||||
webdavUrl?: string
|
webdavUrl?: string
|
||||||
webdavDir?: string
|
webdavDir?: string
|
||||||
webdavUsername?: string
|
webdavUsername?: string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user