mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
chore: make eslint happy (part 1) (#4890)
This commit is contained in:
@@ -24,6 +24,8 @@ export const RuleItem = (props: Props) => {
|
|||||||
const proxyPolicy = rule.match(/[^,]+$/)?.[0] ?? "";
|
const proxyPolicy = rule.match(/[^,]+$/)?.[0] ?? "";
|
||||||
const ruleContent = rule.slice(ruleType.length + 1, -proxyPolicy.length - 1);
|
const ruleContent = rule.slice(ruleType.length + 1, -proxyPolicy.length - 1);
|
||||||
|
|
||||||
|
const $sortable = useSortable({ id: ruleRaw });
|
||||||
|
|
||||||
const {
|
const {
|
||||||
attributes,
|
attributes,
|
||||||
listeners,
|
listeners,
|
||||||
@@ -32,7 +34,7 @@ export const RuleItem = (props: Props) => {
|
|||||||
transition,
|
transition,
|
||||||
isDragging,
|
isDragging,
|
||||||
} = sortable
|
} = sortable
|
||||||
? useSortable({ id: ruleRaw })
|
? $sortable
|
||||||
: {
|
: {
|
||||||
attributes: {},
|
attributes: {},
|
||||||
listeners: {},
|
listeners: {},
|
||||||
|
|||||||
@@ -31,9 +31,15 @@ interface Props {
|
|||||||
onHeadState: (val: Partial<HeadState>) => void;
|
onHeadState: (val: Partial<HeadState>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProxyHead = (props: Props) => {
|
export const ProxyHead = ({
|
||||||
const { sx = {}, url, groupName, headState, onHeadState } = props;
|
sx = {},
|
||||||
|
url,
|
||||||
|
groupName,
|
||||||
|
headState,
|
||||||
|
onHeadState,
|
||||||
|
onLocation,
|
||||||
|
onCheckDelay,
|
||||||
|
}: Props) => {
|
||||||
const { showType, sortType, filterText, textState, testUrl } = headState;
|
const { showType, sortType, filterText, textState, testUrl } = headState;
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -46,13 +52,11 @@ export const ProxyHead = (props: Props) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const { verge } = useVerge();
|
const { verge } = useVerge();
|
||||||
|
const default_latency_test = verge!.default_latency_test!;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
delayManager.setUrl(
|
delayManager.setUrl(groupName, testUrl || url || default_latency_test);
|
||||||
groupName,
|
}, [groupName, testUrl, default_latency_test, url]);
|
||||||
testUrl || url || verge?.default_latency_test!,
|
|
||||||
);
|
|
||||||
}, [groupName, testUrl, verge?.default_latency_test]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5, ...sx }}>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5, ...sx }}>
|
||||||
@@ -60,7 +64,7 @@ export const ProxyHead = (props: Props) => {
|
|||||||
size="small"
|
size="small"
|
||||||
color="inherit"
|
color="inherit"
|
||||||
title={t("locate")}
|
title={t("locate")}
|
||||||
onClick={props.onLocation}
|
onClick={onLocation}
|
||||||
>
|
>
|
||||||
<MyLocationRounded />
|
<MyLocationRounded />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
@@ -76,7 +80,7 @@ export const ProxyHead = (props: Props) => {
|
|||||||
console.log(`[ProxyHead] 使用自定义测试URL: ${testUrl}`);
|
console.log(`[ProxyHead] 使用自定义测试URL: ${testUrl}`);
|
||||||
onHeadState({ textState: "url" });
|
onHeadState({ textState: "url" });
|
||||||
}
|
}
|
||||||
props.onCheckDelay();
|
onCheckDelay();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NetworkCheckRounded />
|
<NetworkCheckRounded />
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ export const ProxyItem = (props: Props) => {
|
|||||||
return () => {
|
return () => {
|
||||||
delayManager.removeListener(proxy.name, group.name);
|
delayManager.removeListener(proxy.name, group.name);
|
||||||
};
|
};
|
||||||
}, [proxy.name, group.name]);
|
}, [proxy.name, group.name, isPreset]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!proxy) return;
|
if (!proxy) return;
|
||||||
setDelay(delayManager.getDelayFix(proxy, group.name));
|
setDelay(delayManager.getDelayFix(proxy, group.name));
|
||||||
}, [proxy]);
|
}, [group.name, proxy]);
|
||||||
|
|
||||||
const onDelay = useLockFn(async () => {
|
const onDelay = useLockFn(async () => {
|
||||||
setDelay(-2);
|
setDelay(-2);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default function useFilterSort(
|
|||||||
filterText: string,
|
filterText: string,
|
||||||
sortType: ProxySortType,
|
sortType: ProxySortType,
|
||||||
) {
|
) {
|
||||||
const [refresh, setRefresh] = useState({});
|
const [, setRefresh] = useState({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let last = 0;
|
let last = 0;
|
||||||
@@ -34,7 +34,7 @@ export default function useFilterSort(
|
|||||||
const fp = filterProxies(proxies, groupName, filterText);
|
const fp = filterProxies(proxies, groupName, filterText);
|
||||||
const sp = sortProxies(fp, groupName, sortType);
|
const sp = sortProxies(fp, groupName, sortType);
|
||||||
return sp;
|
return sp;
|
||||||
}, [proxies, groupName, filterText, sortType, refresh]);
|
}, [proxies, groupName, filterText, sortType]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterSort(
|
export function filterSort(
|
||||||
|
|||||||
@@ -90,13 +90,11 @@ export const HotkeyInput = (props: Props) => {
|
|||||||
|
|
||||||
<div className="list">
|
<div className="list">
|
||||||
{keys.map((key, index) => (
|
{keys.map((key, index) => (
|
||||||
<Box display="flex">
|
<Box display="flex" key={key}>
|
||||||
<span className="delimiter" hidden={index === 0}>
|
<span className="delimiter" hidden={index === 0}>
|
||||||
+
|
+
|
||||||
</span>
|
</span>
|
||||||
<div key={key} className="item">
|
<div className="item">{key}</div>
|
||||||
{key}
|
|
||||||
</div>
|
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ const SettingVergeAdvanced = ({ onError: _ }: Props) => {
|
|||||||
const onExportDiagnosticInfo = useCallback(async () => {
|
const onExportDiagnosticInfo = useCallback(async () => {
|
||||||
await exportDiagnosticInfo();
|
await exportDiagnosticInfo();
|
||||||
showNotice("success", t("Copy Success"), 1000);
|
showNotice("success", t("Copy Success"), 1000);
|
||||||
}, []);
|
}, [t]);
|
||||||
|
|
||||||
const copyVersion = useCallback(() => {
|
const copyVersion = useCallback(() => {
|
||||||
navigator.clipboard.writeText(`v${version}`).then(() => {
|
navigator.clipboard.writeText(`v${version}`).then(() => {
|
||||||
showNotice("success", t("Version copied to clipboard"), 1000);
|
showNotice("success", t("Version copied to clipboard"), 1000);
|
||||||
});
|
});
|
||||||
}, [version, t]);
|
}, [t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingList title={t("Verge Advanced Setting")}>
|
<SettingList title={t("Verge Advanced Setting")}>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const SettingVergeBasic = ({ onError }: Props) => {
|
|||||||
const onCopyClashEnv = useCallback(async () => {
|
const onCopyClashEnv = useCallback(async () => {
|
||||||
await copyClashEnv();
|
await copyClashEnv();
|
||||||
showNotice("success", t("Copy Success"), 1000);
|
showNotice("success", t("Copy Success"), 1000);
|
||||||
}, []);
|
}, [t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingList title={t("Verge Basic Setting")}>
|
<SettingList title={t("Verge Basic Setting")}>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export async function getRuntimeLogs() {
|
|||||||
return invoke<Record<string, [string, string][]>>("get_runtime_logs");
|
return invoke<Record<string, [string, string][]>>("get_runtime_logs");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getRuntimeProxyChainConfig(proxyChainExitNode: String) {
|
export async function getRuntimeProxyChainConfig(proxyChainExitNode: string) {
|
||||||
return invoke<string>("get_runtime_proxy_chain_config", {
|
return invoke<string>("get_runtime_proxy_chain_config", {
|
||||||
proxyChainExitNode,
|
proxyChainExitNode,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user