MCPcopy Create free account
hub / github.com/XIU2/UserScript / get_New_download_url

Function get_New_download_url

GithubEnhanced-High-Speed-Download.user.js:219–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217
218 // download_url 随机几个美国加速源
219 function get_New_download_url() {
220 //return download_url_us // 全输出调试用
221 let minnum = 6; // 随机输出几个美国加速源
222 if (GM_getValue('custom_download_url')) {minnum = 5;} // 如果有自定义加速源,则只随机输出 5 个美国加速源
223 let shuffled = download_url_us.slice(0), i = download_url_us.length, min = i - minnum, temp, index;
224 while (i-- > min) {index = Math.floor((i + 1) * Math.random()); temp = shuffled[index]; shuffled[index] = shuffled[i]; shuffled[i] = temp;}
225 // 如果有自定义加速源,则将其添加到随机数组的开头
226 if (GM_getValue('custom_download_url')) {return [[GM_getValue('custom_download_url'), '自定义', '[由你自定义的 Release/Code(ZIP) 加速源地址]

提示:点击浏览器右上角 Tampermonkey 扩展图标 - [ #️⃣ 自定义加速源 ]
即可轮流设置 Raw、Git Clone、Release/Code(ZIP) 的自定义加速源地址(留空代表不设置)。']].concat(shuffled.slice(min));}
227 return shuffled.slice(min) // 随机洗牌 download_url_us 数组并取前几个,然后将其合并至 download_url 数组
228 // 为了缓解非美国公益节点压力(考虑到很多人无视前面随机的美国节点),干脆也将其加入随机
229 }
230
231 // Release
232 function addRelease() {

Callers 2

addReleaseFunction · 0.85
addDownloadZIPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected