mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-10 19:50:28 +08:00
Compare commits
2 Commits
e6548a0bc3
...
19ff003352
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19ff003352 | ||
|
|
52cefa39d3 |
@ -46,10 +46,10 @@ function getBindingName() {
|
|||||||
function loadBinding() {
|
function loadBinding() {
|
||||||
const bindingName = getBindingName()
|
const bindingName = getBindingName()
|
||||||
|
|
||||||
// 查找项目根目录的 extra/sidecar
|
// 查找项目根目录的 sidecar
|
||||||
let currentDir = __dirname
|
let currentDir = __dirname
|
||||||
while (currentDir !== require('path').dirname(currentDir)) {
|
while (currentDir !== require('path').dirname(currentDir)) {
|
||||||
const sidecarPath = join(currentDir, 'extra', 'sidecar', bindingName)
|
const sidecarPath = join(currentDir, 'sidecar', bindingName)
|
||||||
if (existsSync(sidecarPath)) {
|
if (existsSync(sidecarPath)) {
|
||||||
try {
|
try {
|
||||||
nativeBinding = require(sidecarPath)
|
nativeBinding = require(sidecarPath)
|
||||||
|
|||||||
@ -342,6 +342,8 @@
|
|||||||
"actions.version.title": "App Version",
|
"actions.version.title": "App Version",
|
||||||
"theme.editor.title": "Edit Theme",
|
"theme.editor.title": "Edit Theme",
|
||||||
"proxies.title": "Proxy Groups & Nodes",
|
"proxies.title": "Proxy Groups & Nodes",
|
||||||
|
"proxies.hideUnavailable.enabled": "Show Unavailable Proxies",
|
||||||
|
"proxies.hideUnavailable.disabled": "Hide Unavailable Proxies",
|
||||||
"proxies.card.title": "ProxyGrp",
|
"proxies.card.title": "ProxyGrp",
|
||||||
"proxies.delay.test": "Test",
|
"proxies.delay.test": "Test",
|
||||||
"proxies.delay.timeout": "Timeout",
|
"proxies.delay.timeout": "Timeout",
|
||||||
|
|||||||
@ -318,6 +318,8 @@
|
|||||||
"actions.version.title": "نسخه برنامه",
|
"actions.version.title": "نسخه برنامه",
|
||||||
"theme.editor.title": "ویرایش پوسته",
|
"theme.editor.title": "ویرایش پوسته",
|
||||||
"proxies.title": "گروههای پراکسی و گرهها",
|
"proxies.title": "گروههای پراکسی و گرهها",
|
||||||
|
"proxies.hideUnavailable.enabled": "نمایش گرههای غیرفعال",
|
||||||
|
"proxies.hideUnavailable.disabled": "پنهان کردن گرههای غیرفعال",
|
||||||
"proxies.card.title": "گروهپراکسی",
|
"proxies.card.title": "گروهپراکسی",
|
||||||
"proxies.delay.test": "تست",
|
"proxies.delay.test": "تست",
|
||||||
"proxies.delay.timeout": "وقفه",
|
"proxies.delay.timeout": "وقفه",
|
||||||
|
|||||||
@ -318,6 +318,8 @@
|
|||||||
"actions.version.title": "Версия приложения",
|
"actions.version.title": "Версия приложения",
|
||||||
"theme.editor.title": "Редактор темы",
|
"theme.editor.title": "Редактор темы",
|
||||||
"proxies.title": "Прокси группы и узлы",
|
"proxies.title": "Прокси группы и узлы",
|
||||||
|
"proxies.hideUnavailable.enabled": "Показать недоступные узлы",
|
||||||
|
"proxies.hideUnavailable.disabled": "Скрыть недоступные узлы",
|
||||||
"proxies.card.title": "Прокси группы",
|
"proxies.card.title": "Прокси группы",
|
||||||
"proxies.delay.test": "Тест",
|
"proxies.delay.test": "Тест",
|
||||||
"proxies.delay.timeout": "Таймаут",
|
"proxies.delay.timeout": "Таймаут",
|
||||||
|
|||||||
@ -342,6 +342,8 @@
|
|||||||
"actions.version.title": "应用版本",
|
"actions.version.title": "应用版本",
|
||||||
"theme.editor.title": "编辑主题",
|
"theme.editor.title": "编辑主题",
|
||||||
"proxies.title": "代理组与节点",
|
"proxies.title": "代理组与节点",
|
||||||
|
"proxies.hideUnavailable.enabled": "显示不可用节点",
|
||||||
|
"proxies.hideUnavailable.disabled": "隐藏不可用节点",
|
||||||
"proxies.card.title": "代理组",
|
"proxies.card.title": "代理组",
|
||||||
"proxies.delay.test": "测试",
|
"proxies.delay.test": "测试",
|
||||||
"proxies.delay.timeout": "超时",
|
"proxies.delay.timeout": "超时",
|
||||||
|
|||||||
@ -342,6 +342,8 @@
|
|||||||
"actions.version.title": "應用程式版本",
|
"actions.version.title": "應用程式版本",
|
||||||
"theme.editor.title": "編輯主題",
|
"theme.editor.title": "編輯主題",
|
||||||
"proxies.title": "代理組與節點",
|
"proxies.title": "代理組與節點",
|
||||||
|
"proxies.hideUnavailable.enabled": "顯示不可用節點",
|
||||||
|
"proxies.hideUnavailable.disabled": "隱藏不可用節點",
|
||||||
"proxies.card.title": "代理組",
|
"proxies.card.title": "代理組",
|
||||||
"proxies.delay.test": "測試",
|
"proxies.delay.test": "測試",
|
||||||
"proxies.delay.timeout": "逾時",
|
"proxies.delay.timeout": "逾時",
|
||||||
|
|||||||
@ -11,11 +11,11 @@ import { CgDetailsLess, CgDetailsMore } from 'react-icons/cg'
|
|||||||
import { TbCircleLetterD } from 'react-icons/tb'
|
import { TbCircleLetterD } from 'react-icons/tb'
|
||||||
import { FaLocationCrosshairs } from 'react-icons/fa6'
|
import { FaLocationCrosshairs } from 'react-icons/fa6'
|
||||||
import { RxLetterCaseCapitalize } from 'react-icons/rx'
|
import { RxLetterCaseCapitalize } from 'react-icons/rx'
|
||||||
|
import { MdVisibilityOff, MdDoubleArrow, MdOutlineSpeed } from 'react-icons/md'
|
||||||
import { useEffect, useMemo, useRef, useState, useCallback } from 'react'
|
import { useEffect, useMemo, useRef, useState, useCallback } from 'react'
|
||||||
import { GroupedVirtuoso, GroupedVirtuosoHandle } from 'react-virtuoso'
|
import { GroupedVirtuoso, GroupedVirtuosoHandle } from 'react-virtuoso'
|
||||||
import ProxyItem from '@renderer/components/proxies/proxy-item'
|
import ProxyItem from '@renderer/components/proxies/proxy-item'
|
||||||
import { IoIosArrowBack } from 'react-icons/io'
|
import { IoIosArrowBack } from 'react-icons/io'
|
||||||
import { MdDoubleArrow, 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'
|
import { includesIgnoreCase } from '@renderer/utils/includes'
|
||||||
@ -160,9 +160,25 @@ const Proxies: React.FC = () => {
|
|||||||
|
|
||||||
groups.forEach((group, index) => {
|
groups.forEach((group, index) => {
|
||||||
if (isOpen[index]) {
|
if (isOpen[index]) {
|
||||||
const filtered = group.all.filter(
|
const filtered = group.all.filter((proxy) => {
|
||||||
(proxy) => proxy && includesIgnoreCase(proxy.name, searchValue[index])
|
if (!includesIgnoreCase(proxy.name, searchValue[index])) {
|
||||||
)
|
return false
|
||||||
|
}
|
||||||
|
if (appConfig?.hideUnavailableProxies) {
|
||||||
|
const isGroup = 'all' in proxy
|
||||||
|
if (isGroup) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (!proxy.history || proxy.history.length === 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const lastDelay = proxy.history[proxy.history.length - 1].delay
|
||||||
|
if (lastDelay === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
const sorted = sortProxies(filtered, proxyDisplayOrder)
|
const sorted = sortProxies(filtered, proxyDisplayOrder)
|
||||||
const count = Math.ceil(sorted.length / cols)
|
const count = Math.ceil(sorted.length / cols)
|
||||||
groupCounts.push(count)
|
groupCounts.push(count)
|
||||||
@ -173,7 +189,15 @@ const Proxies: React.FC = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return { groupCounts, allProxies }
|
return { groupCounts, allProxies }
|
||||||
}, [groups, isOpen, proxyDisplayOrder, cols, searchValue, sortProxies])
|
}, [
|
||||||
|
groups,
|
||||||
|
isOpen,
|
||||||
|
proxyDisplayOrder,
|
||||||
|
cols,
|
||||||
|
searchValue,
|
||||||
|
sortProxies,
|
||||||
|
appConfig?.hideUnavailableProxies
|
||||||
|
])
|
||||||
|
|
||||||
const onChangeProxy = useCallback(
|
const onChangeProxy = useCallback(
|
||||||
async (group: string, proxy: string): Promise<void> => {
|
async (group: string, proxy: string): Promise<void> => {
|
||||||
@ -509,6 +533,26 @@ const Proxies: React.FC = () => {
|
|||||||
title={t('proxies.title')}
|
title={t('proxies.title')}
|
||||||
header={
|
header={
|
||||||
<>
|
<>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
isIconOnly
|
||||||
|
variant="light"
|
||||||
|
className="app-nodrag"
|
||||||
|
onPress={() => {
|
||||||
|
patchAppConfig({
|
||||||
|
hideUnavailableProxies: !appConfig?.hideUnavailableProxies
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdVisibilityOff
|
||||||
|
className={`text-lg ${appConfig?.hideUnavailableProxies ? 'text-warning' : 'text-foreground-500'}`}
|
||||||
|
title={
|
||||||
|
appConfig?.hideUnavailableProxies
|
||||||
|
? t('proxies.hideUnavailable.enabled')
|
||||||
|
: t('proxies.hideUnavailable.disabled')
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
isIconOnly
|
isIconOnly
|
||||||
|
|||||||
1
src/shared/types.d.ts
vendored
1
src/shared/types.d.ts
vendored
@ -229,6 +229,7 @@ interface IAppConfig {
|
|||||||
profileDisplayDate?: 'expire' | 'update'
|
profileDisplayDate?: 'expire' | 'update'
|
||||||
envType?: ('bash' | 'cmd' | 'powershell')[]
|
envType?: ('bash' | 'cmd' | 'powershell')[]
|
||||||
proxyCols: 'auto' | '1' | '2' | '3' | '4'
|
proxyCols: 'auto' | '1' | '2' | '3' | '4'
|
||||||
|
hideUnavailableProxies?: boolean
|
||||||
connectionDirection: 'asc' | 'desc'
|
connectionDirection: 'asc' | 'desc'
|
||||||
connectionOrderBy: 'time' | 'upload' | 'download' | 'uploadSpeed' | 'downloadSpeed'
|
connectionOrderBy: 'time' | 'upload' | 'download' | 'uploadSpeed' | 'downloadSpeed'
|
||||||
connectionViewMode?: 'list' | 'table'
|
connectionViewMode?: 'list' | 'table'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user