mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-26 20:50:30 +08:00
prioritize displaying file types
This commit is contained in:
parent
ceb89d28c8
commit
2b42f68a30
@ -47,11 +47,16 @@ const ProxyProvider: React.FC = () => {
|
||||
const { data, mutate } = useSWR('mihomoProxyProviders', mihomoProxyProviders)
|
||||
const providers = useMemo(() => {
|
||||
if (!data) return []
|
||||
if (!data.providers) return []
|
||||
return Object.keys(data.providers)
|
||||
.map((key) => data.providers[key])
|
||||
.filter((provider) => {
|
||||
return 'subscriptionInfo' in provider
|
||||
return Object.values(data.providers)
|
||||
.filter(provider => 'subscriptionInfo' in provider)
|
||||
.sort((a, b) => {
|
||||
if (a.vehicleType === 'File' && b.vehicleType !== 'File') {
|
||||
return -1
|
||||
}
|
||||
if (a.vehicleType !== 'File' && b.vehicleType === 'File') {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
})
|
||||
}, [data])
|
||||
const [updating, setUpdating] = useState(Array(providers.length).fill(false))
|
||||
|
||||
@ -47,8 +47,15 @@ const RuleProvider: React.FC = () => {
|
||||
const { data, mutate } = useSWR('mihomoRuleProviders', mihomoRuleProviders)
|
||||
const providers = useMemo(() => {
|
||||
if (!data) return []
|
||||
if (!data.providers) return []
|
||||
return Object.keys(data.providers).map((key) => data.providers[key])
|
||||
return Object.values(data.providers).sort((a, b) => {
|
||||
if (a.vehicleType === 'File' && b.vehicleType !== 'File') {
|
||||
return -1
|
||||
}
|
||||
if (a.vehicleType !== 'File' && b.vehicleType === 'File') {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
})
|
||||
}, [data])
|
||||
const [updating, setUpdating] = useState(Array(providers.length).fill(false))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user