소스 검색

fix: use group testUrl

#1384
MystiPanda 11 달 전
부모
커밋
e749fe70e2
3개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      src/components/proxy/proxy-head.tsx
  2. 1 0
      src/components/proxy/proxy-render.tsx
  3. 1 0
      src/services/types.d.ts

+ 6 - 2
src/components/proxy/proxy-head.tsx

@@ -21,6 +21,7 @@ import delayManager from "@/services/delay";
 
 interface Props {
   sx?: SxProps;
+  url?: string;
   groupName: string;
   headState: HeadState;
   onLocation: () => void;
@@ -29,7 +30,7 @@ interface Props {
 }
 
 export const ProxyHead = (props: Props) => {
-  const { sx = {}, groupName, headState, onHeadState } = props;
+  const { sx = {}, url, groupName, headState, onHeadState } = props;
 
   const { showType, sortType, filterText, textState, testUrl } = headState;
 
@@ -45,7 +46,10 @@ export const ProxyHead = (props: Props) => {
   const { verge } = useVerge();
 
   useEffect(() => {
-    delayManager.setUrl(groupName, testUrl || verge?.default_latency_test!);
+    delayManager.setUrl(
+      groupName,
+      testUrl || url || verge?.default_latency_test!
+    );
   }, [groupName, testUrl, verge?.default_latency_test]);
 
   return (

+ 1 - 0
src/components/proxy/proxy-render.tsx

@@ -129,6 +129,7 @@ export const ProxyRender = (props: RenderProps) => {
     return (
       <ProxyHead
         sx={{ pl: 2, pr: 3, mt: indent ? 1 : 0.5, mb: 1 }}
+        url={group.testUrl}
         groupName={group.name}
         headState={headState!}
         onLocation={() => onLocation(group)}

+ 1 - 0
src/services/types.d.ts

@@ -59,6 +59,7 @@ interface IProxyItem {
     time: string;
     delay: number;
   }[];
+  testUrl?: string;
   all?: string[];
   now?: string;
   hidden?: boolean;