From 8c8171e7746e3d46f08cf52630e3df2454f0082a Mon Sep 17 00:00:00 2001
From: GyDi <zzzgydi@gmail.com>
Date: Fri, 11 Nov 2022 01:24:18 +0800
Subject: [PATCH] feat: change default latency test url

---
 src/components/proxy/proxy-head.tsx         | 10 ++++++++--
 src/components/setting/mods/misc-viewer.tsx |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/components/proxy/proxy-head.tsx b/src/components/proxy/proxy-head.tsx
index b91f090..7dbaae0 100644
--- a/src/components/proxy/proxy-head.tsx
+++ b/src/components/proxy/proxy-head.tsx
@@ -14,6 +14,7 @@ import {
   SortByAlphaRounded,
   SortRounded,
 } from "@mui/icons-material";
+import { useVergeConfig } from "@/hooks/use-verge-config";
 import delayManager from "@/services/delay";
 import type { HeadState } from "./use-head-state";
 import type { ProxySortType } from "./use-filter-sort";
@@ -41,9 +42,14 @@ const ProxyHead = (props: Props) => {
     return () => clearTimeout(timer);
   }, []);
 
+  const { data: vergeConfig } = useVergeConfig();
+
   useEffect(() => {
-    delayManager.setUrl(groupName, testUrl);
-  }, [groupName, headState.testUrl]);
+    delayManager.setUrl(
+      groupName,
+      testUrl || vergeConfig?.default_latency_test!
+    );
+  }, [groupName, testUrl, vergeConfig?.default_latency_test]);
 
   return (
     <Box sx={{ display: "flex", alignItems: "center", ...sx }}>
diff --git a/src/components/setting/mods/misc-viewer.tsx b/src/components/setting/mods/misc-viewer.tsx
index 5ab3abf..d747eba 100644
--- a/src/components/setting/mods/misc-viewer.tsx
+++ b/src/components/setting/mods/misc-viewer.tsx
@@ -81,6 +81,9 @@ const MiscViewer = ({ handler }: Props) => {
             <TextField
               size="small"
               autoComplete="off"
+              autoCorrect="off"
+              autoCapitalize="off"
+              spellCheck="false"
               sx={{ width: 200 }}
               value={values.defaultLatencyTest}
               placeholder="http://www.gstatic.com/generate_204"
-- 
GitLab