support unfixed urlTest proxy

This commit is contained in:
pompurin404 2024-09-25 15:37:13 +08:00
parent bad68830ff
commit 21418954c1
No known key found for this signature in database
2 changed files with 39 additions and 16 deletions

View File

@ -1,7 +1,7 @@
### Breaking Changes
- 此版本将Sub-Store后端默认监听端口修改为38324如果此前使用了内置Sub-Store的订阅链接请修改端口或重新导入
### Bug Fixes
- 修复便携版无法自动更新的问题
- 修复GIF图标缓存后无法播放的问题
- 修复Linux重启应用进入沙盒环境的问题
- 修复已关闭连接信息过时的问题
- 修复win7开机启动开关无法打开的问题
- 修复url-test代理组节点无法取消固定的问题

View File

@ -1,5 +1,7 @@
import { Button, Card, CardBody } from '@nextui-org/react'
import { mihomoGroupDelay } from '@renderer/utils/ipc'
import React, { useMemo, useState } from 'react'
import { FaMapPin } from 'react-icons/fa6'
interface Props {
mutateProxies: () => void
@ -22,7 +24,7 @@ const ProxyItem: React.FC<Props> = (props) => {
}, [proxy])
const [loading, setLoading] = useState(false)
const [unfixing, setUnfixing] = useState(false)
function delayColor(delay: number): 'primary' | 'success' | 'warning' | 'danger' {
if (delay === -1) return 'primary'
if (delay === 0) return 'danger'
@ -67,16 +69,37 @@ const ProxyItem: React.FC<Props> = (props) => {
</div>
)}
</div>
<Button
title={proxy.type}
isLoading={loading}
color={delayColor(delay)}
onPress={onDelay}
variant="light"
className="h-full min-w-[50px] p-0 mx-2 text-sm hover:bg-content"
>
{delayText(delay)}
</Button>
<div className="flex justify-end">
{fixed && (
<Button
isIconOnly
title="取消固定"
isLoading={unfixing}
color="danger"
onPress={async () => {
setUnfixing(true)
await mihomoGroupDelay(group.name)
mutateProxies()
setUnfixing(false)
}}
variant="light"
className="h-[20px] p-0 text-sm"
>
<FaMapPin className="text-md le" />
</Button>
)}
<Button
isIconOnly
title={proxy.type}
isLoading={loading}
color={delayColor(delay)}
onPress={onDelay}
variant="light"
className="h-full p-0 text-sm"
>
{delayText(delay)}
</Button>
</div>
</div>
</CardBody>
</Card>