Skip to content

Commit

Permalink
优化测速逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
qinlili23333 committed May 19, 2022
1 parent 261d744 commit d25917a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions settingFrame/speedtest.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <H4>音频节点</H4>
if (canuse) {
info.innerText = domains[i] + "-测试延迟...";
let startTime = Date.now();
await (await fetch("https://" + domains[i] + "/?ForceNoCache=1", { method: "HEAD", mode: "no-cors" }).catch(() => {
await (await fetch("https://" + domains[i] + "/?ForceNoCache=1&random=" + Math.random(), { method: "HEAD", mode: "no-cors" }).catch(() => {
info.innerText = domains[i] + "-延迟测试失败";
info.style.color = "red";
canuse = false;
Expand All @@ -98,7 +98,7 @@ <H4>音频节点</H4>
info.innerText = domains[i] + "-" + latency + "MS-测试速度...";
if (canuse) {
let startTime = Date.now();
await (await fetch("https://" + domains[i] + "/img/%E5%A4%A7%E5%A1%94.webp?ForceNoCache=1", { headers: { "cache-control": "no-cache" }, method: "GET", mode: "no-cors" }).catch(() => {
await (await fetch("https://" + domains[i] + "/img/%E5%A4%A7%E5%A1%94.webp?ForceNoCache=1&random=" + Math.random(), { headers: { "cache-control": "no-cache" }, method: "GET", mode: "no-cors" }).catch(() => {
info.innerText = domains[i] + "-" + latency + "MS-速度测试失败";
info.style.color = "red";
canuse = false;
Expand Down Expand Up @@ -130,7 +130,7 @@ <H4>音频节点</H4>
if (canuse) {
info.innerText = cdnDomains[i].name + "-测试延迟...";
let startTime = Date.now();
await (await fetch("https://" + cdnDomains[i].domain + "/?ForceNoCache=1", { method: "HEAD", mode: "no-cors" }).catch(() => {
await (await fetch("https://" + cdnDomains[i].domain + "/?ForceNoCache=1&random=" + Math.random(), { method: "HEAD", mode: "no-cors" }).catch(() => {
info.innerText = cdnDomains[i].name + "-延迟测试失败";
info.style.color = "red";
canuse = false;
Expand All @@ -143,7 +143,7 @@ <H4>音频节点</H4>
info.innerText = cdnDomains[i].name + "-" + latency + "MS-测试速度...";
if (canuse) {
let startTime = Date.now();
await (await fetch(cdnDomains[i].file + "?ForceNoCache=1", { headers: { "cache-control": "no-cache" }, method: "GET", mode: "no-cors" }).catch(() => {
await (await fetch(cdnDomains[i].file + "?ForceNoCache=1&random=" + Math.random(), { headers: { "cache-control": "no-cache" }, method: "GET", mode: "no-cors" }).catch(() => {
info.innerText = cdnDomains[i].name + "-" + latency + "MS-速度测试失败";
info.style.color = "red";
canuse = false;
Expand Down

1 comment on commit d25917a

@vercel
Copy link

@vercel vercel bot commented on d25917a May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.