Skip to content

Commit 517d277

Browse files
authored
Merge pull request #892 from cmliu/beta2.0
fix: 修正批量替换域名函数中的随机主机选择逻辑
2 parents aaf7d2a + b9cb7f7 commit 517d277

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

_worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ function 批量替换域名(内容, hosts, 每组数量 = 2) {
901901
const 打乱后数组 = [...hosts].sort(() => Math.random() - 0.5);
902902
let count = 0, currentRandomHost = null;
903903
return 内容.replace(/example\.com/g, () => {
904-
if (count % 每组数量 === 0) currentRandomHost = 随机替换通配符(打乱后数组[count % 打乱后数组.length]);
904+
if (count % 每组数量 === 0) currentRandomHost = 随机替换通配符(打乱后数组[Math.floor(count / 每组数量) % 打乱后数组.length]);
905905
count++;
906906
return currentRandomHost;
907907
});

0 commit comments

Comments
 (0)