release 2.0.0

This commit is contained in:
wonfen
2024-11-23 11:34:17 +08:00
Unverified
parent a610a43db0
commit e72e8ea631
6 changed files with 25 additions and 19 deletions

View File

@@ -205,7 +205,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
spellCheck="false"
sx={{ width: 250, marginLeft: "auto" }}
value={values.defaultLatencyTest}
placeholder="https://cp.cloudflare.com/generate_204"
placeholder="http://cp.cloudflare.com/generate_204"
onChange={(e) =>
setValues((v) => ({ ...v, defaultLatencyTest: e.target.value }))
}

View File

@@ -72,16 +72,16 @@ export const getRules = async () => {
export const getProxyDelay = async (
name: string,
url?: string,
timeout?: number
timeout?: number,
) => {
const params = {
timeout: timeout || 10000,
url: url || "https://cp.cloudflare.com/generate_204",
url: url || "http://cp.cloudflare.com/generate_204",
};
const instance = await getAxios();
const result = await instance.get(
`/proxies/${encodeURIComponent(name)}/delay`,
{ params }
{ params },
);
return result as any as { delay: number };
};
@@ -108,8 +108,8 @@ export const getProxies = async () => {
// provider name map
const providerMap = Object.fromEntries(
Object.entries(providerRecord).flatMap(([provider, item]) =>
item.proxies.map((p) => [p.name, { ...p, provider }])
)
item.proxies.map((p) => [p.name, { ...p, provider }]),
),
);
// compatible with proxy-providers
@@ -154,7 +154,7 @@ export const getProxies = async () => {
}
return acc;
},
[]
[],
);
let globalNames = new Set(globalGroups.map((each) => each.name));
@@ -167,8 +167,8 @@ export const getProxies = async () => {
const proxies = [direct, reject].concat(
Object.values(proxyRecord).filter(
(p) => !p.all?.length && p.name !== "DIRECT" && p.name !== "REJECT"
)
(p) => !p.all?.length && p.name !== "DIRECT" && p.name !== "REJECT",
),
);
const _global: IProxyGroupItem = {
@@ -193,7 +193,7 @@ export const getProxyProviders = async () => {
Object.entries(providers).filter(([key, item]) => {
const type = item.vehicleType.toLowerCase();
return type === "http" || type === "file";
})
}),
);
};
@@ -210,7 +210,7 @@ export const getRuleProviders = async () => {
Object.entries(providers).filter(([key, item]) => {
const type = item.vehicleType.toLowerCase();
return type === "http" || type === "file";
})
}),
);
};
@@ -218,7 +218,7 @@ export const getRuleProviders = async () => {
export const providerHealthCheck = async (name: string) => {
const instance = await getAxios();
return instance.get(
`/providers/proxies/${encodeURIComponent(name)}/healthcheck`
`/providers/proxies/${encodeURIComponent(name)}/healthcheck`,
);
};
@@ -254,16 +254,16 @@ export const closeAllConnections = async () => {
export const getGroupProxyDelays = async (
groupName: string,
url?: string,
timeout?: number
timeout?: number,
) => {
const params = {
timeout: timeout || 10000,
url: url || "https://cp.cloudflare.com/generate_204",
url: url || "http://cp.cloudflare.com/generate_204",
};
const instance = await getAxios();
const result = await instance.get(
`/group/${encodeURIComponent(groupName)}/delay`,
{ params }
{ params },
);
return result as any as Record<string, number>;
};