MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / getVersion

Function getVersion

hqcsh.js:360–375  ·  view source on GitHub ↗
(scriptUrl, timeout = 3 * 1000)

Source from the content-addressed store, hash-verified

358}
359//==============================================获取远程版本=================================================
360function getVersion(scriptUrl, timeout = 3 * 1000) {
361 return new Promise((resolve) => {
362 const options = { url: `https://fastly.jsdelivr.net/gh/${scriptUrl}` };
363 $.get(options, (err, resp, data) => {
364 try {
365 const regex = /scriptVersionNow\s*=\s*(["'`])([\d.]+)\1/;
366 const match = data.match(regex);
367 const scriptVersionLatest = match ? match[2] : "";
368 console.log(`\n====== 当前版本:${scriptVersionNow} 📌 最新版本:${scriptVersionLatest} ======`);
369 } catch (e) {
370 $.logErr(e, resp);
371 }
372 resolve();
373 }, timeout);
374 });
375}
376//=================================GOT===========================================================
377async function request(opt) {
378 const DEFAULT_RETRY = 3 //请求出错重试三次

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected