From e0fe2ce3cf8c6456759fbb94a458dec0e777ead9 Mon Sep 17 00:00:00 2001 From: cmliu Date: Thu, 18 Dec 2025 19:41:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=9F=9F=E5=90=8D=E5=87=BD=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E5=8C=96=E4=B8=BB=E6=9C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=BB=A5=E6=8F=90=E9=AB=98=E5=A4=9A=E6=A0=B7=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _worker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_worker.js b/_worker.js index a984ab8..a3267bc 100644 --- a/_worker.js +++ b/_worker.js @@ -870,9 +870,10 @@ function 随机替换通配符(h) { } function 批量替换域名(内容, hosts, 每组数量 = 2) { + const 打乱后数组 = [...hosts].sort(() => Math.random() - 0.5); let count = 0, currentRandomHost = null; return 内容.replace(/example\.com/g, () => { - if (count % 每组数量 === 0) currentRandomHost = 随机替换通配符(hosts[Math.floor(Math.random() * hosts.length)]); + if (count % 每组数量 === 0) currentRandomHost = 随机替换通配符(打乱后数组[count % 打乱后数组.length]); count++; return currentRandomHost; });