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

Function getVersion

qtx.js:306–321  ·  view source on GitHub ↗

* 获取远程版本

(scriptUrl, timeout = 3 * 1000)

Source from the content-addressed store, hash-verified

304 * 获取远程版本
305 */
306function getVersion(scriptUrl, timeout = 3 * 1000) {
307 return new Promise((resolve) => {
308 const options = { url: `https://fastly.jsdelivr.net/gh/${scriptUrl}` };
309 $.get(options, (err, resp, data) => {
310 try {
311 const regex = /scriptVersionNow\s*=\s*(["'`])([\d.]+)\1/;
312 const match = data.match(regex);
313 const scriptVersionLatest = match ? match[2] : "";
314 console.log(`\n====== 当前版本:${scriptVersionNow} 📌 最新版本:${scriptVersionLatest} ======`);
315 } catch (e) {
316 $.logErr(e, resp);
317 }
318 resolve();
319 }, timeout);
320 });
321}
322/**
323 * 获取远程通知
324 */

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected