feat: change default latency test url

This commit is contained in:
GyDi 2022-11-11 01:24:18 +08:00
parent 0bb1790206
commit 8c8171e774
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A
2 changed files with 11 additions and 2 deletions

View File

@ -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 }}>

View File

@ -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"