mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
parent
6fb80a848f
commit
3119e0ed37
|
@ -7,6 +7,7 @@
|
||||||
- 代理组图标支持SVG格式
|
- 代理组图标支持SVG格式
|
||||||
- 优化覆写启用逻辑
|
- 优化覆写启用逻辑
|
||||||
- 覆写支持全局启用
|
- 覆写支持全局启用
|
||||||
|
- 筛选过滤忽略大小写
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import ConnectionDetailModal from '@renderer/components/connections/connection-d
|
||||||
import { CgClose } from 'react-icons/cg'
|
import { CgClose } from 'react-icons/cg'
|
||||||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||||
import { HiSortAscending, HiSortDescending } from 'react-icons/hi'
|
import { HiSortAscending, HiSortDescending } from 'react-icons/hi'
|
||||||
|
import { includesIgnoreCase } from '@renderer/utils/includes'
|
||||||
|
|
||||||
let preData: IMihomoConnectionDetail[] = []
|
let preData: IMihomoConnectionDetail[] = []
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ const Connections: React.FC = () => {
|
||||||
if (filter === '') return connections
|
if (filter === '') return connections
|
||||||
return connections?.filter((connection) => {
|
return connections?.filter((connection) => {
|
||||||
const raw = JSON.stringify(connection)
|
const raw = JSON.stringify(connection)
|
||||||
return raw.includes(filter)
|
return includesIgnoreCase(raw, filter)
|
||||||
})
|
})
|
||||||
}, [connections, filter, connectionDirection, connectionOrderBy])
|
}, [connections, filter, connectionDirection, connectionOrderBy])
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { Button, Divider, Input } from '@nextui-org/react'
|
import { Button, Divider, Input } from '@nextui-org/react'
|
||||||
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso'
|
import { Virtuoso, VirtuosoHandle } from 'react-virtuoso'
|
||||||
import { IoLocationSharp } from 'react-icons/io5'
|
import { IoLocationSharp } from 'react-icons/io5'
|
||||||
|
import { includesIgnoreCase } from '@renderer/utils/includes'
|
||||||
|
|
||||||
const Logs: React.FC = () => {
|
const Logs: React.FC = () => {
|
||||||
const [logs, setLogs] = useState<IMihomoLogInfo[]>([])
|
const [logs, setLogs] = useState<IMihomoLogInfo[]>([])
|
||||||
|
@ -14,7 +15,7 @@ const Logs: React.FC = () => {
|
||||||
const filteredLogs = useMemo(() => {
|
const filteredLogs = useMemo(() => {
|
||||||
if (filter === '') return logs
|
if (filter === '') return logs
|
||||||
return logs.filter((log) => {
|
return logs.filter((log) => {
|
||||||
return log.payload.includes(filter) || log.type.includes(filter)
|
return includesIgnoreCase(log.payload, filter) || includesIgnoreCase(log.type, filter)
|
||||||
})
|
})
|
||||||
}, [logs, filter])
|
}, [logs, filter])
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { IoIosArrowBack } from 'react-icons/io'
|
||||||
import { MdOutlineSpeed } from 'react-icons/md'
|
import { MdOutlineSpeed } from 'react-icons/md'
|
||||||
import { useGroups } from '@renderer/hooks/use-groups'
|
import { useGroups } from '@renderer/hooks/use-groups'
|
||||||
import CollapseInput from '@renderer/components/base/collapse-input'
|
import CollapseInput from '@renderer/components/base/collapse-input'
|
||||||
|
import { includesIgnoreCase } from '@renderer/utils/includes'
|
||||||
|
|
||||||
const Proxies: React.FC = () => {
|
const Proxies: React.FC = () => {
|
||||||
const { groups = [], mutate } = useGroups()
|
const { groups = [], mutate } = useGroups()
|
||||||
|
@ -40,7 +41,7 @@ const Proxies: React.FC = () => {
|
||||||
groups.forEach((group, index) => {
|
groups.forEach((group, index) => {
|
||||||
if (isOpen[index]) {
|
if (isOpen[index]) {
|
||||||
let groupProxies = group.all.filter((proxy) =>
|
let groupProxies = group.all.filter((proxy) =>
|
||||||
proxy.name.toLowerCase().includes(searchValue[index].toLowerCase())
|
includesIgnoreCase(proxy.name, searchValue[index])
|
||||||
)
|
)
|
||||||
const count = Math.floor(groupProxies.length / cols)
|
const count = Math.floor(groupProxies.length / cols)
|
||||||
groupCounts.push(groupProxies.length % cols === 0 ? count : count + 1)
|
groupCounts.push(groupProxies.length % cols === 0 ? count : count + 1)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { Virtuoso } from 'react-virtuoso'
|
||||||
import { useMemo, useState } from 'react'
|
import { useMemo, useState } from 'react'
|
||||||
import { Divider, Input } from '@nextui-org/react'
|
import { Divider, Input } from '@nextui-org/react'
|
||||||
import { useRules } from '@renderer/hooks/use-rules'
|
import { useRules } from '@renderer/hooks/use-rules'
|
||||||
|
import { includesIgnoreCase } from '@renderer/utils/includes'
|
||||||
|
|
||||||
const Rules: React.FC = () => {
|
const Rules: React.FC = () => {
|
||||||
const { rules } = useRules()
|
const { rules } = useRules()
|
||||||
|
@ -14,7 +15,9 @@ const Rules: React.FC = () => {
|
||||||
if (filter === '') return rules.rules
|
if (filter === '') return rules.rules
|
||||||
return rules.rules.filter((rule) => {
|
return rules.rules.filter((rule) => {
|
||||||
return (
|
return (
|
||||||
rule.payload.includes(filter) || rule.type.includes(filter) || rule.proxy.includes(filter)
|
includesIgnoreCase(rule.payload, filter) ||
|
||||||
|
includesIgnoreCase(rule.type, filter) ||
|
||||||
|
includesIgnoreCase(rule.proxy, filter)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}, [rules, filter])
|
}, [rules, filter])
|
||||||
|
|
3
src/renderer/src/utils/includes.ts
Normal file
3
src/renderer/src/utils/includes.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export function includesIgnoreCase(mainStr: string = '', subStr: string = ''): boolean {
|
||||||
|
return mainStr.toLowerCase().includes(subStr.toLowerCase())
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user