MCPcopy
hub / github.com/xcanwin/KeepChatGPT / checkForUpdates

Function checkForUpdates

KeepChatGPT.user.js:2599–2632  ·  view source on GitHub ↗
(action = "click")

Source from the content-addressed store, hash-verified

2597 };
2598
2599 const checkForUpdates = function (action = "click") {
2600 const downloadURL = `https://raw.githubusercontent.com/xcanwin/KeepChatGPT/main/KeepChatGPT.user.js`;
2601 const updateURL = downloadURL;
2602 GM_xmlhttpRequest({
2603 method: "GET",
2604 url: `${updateURL}?t=${Date.now()}`,
2605 onload: function (response) {
2606 const crv = GM_info.script.version;
2607 const m = response.responseText.match(/@version\s+(\S+)/);
2608 const ltv = m && m[1];
2609 if (ltv && verInt(ltv) > verInt(crv)) {
2610 ndialog(
2611 `${tl("检查更新")}`,
2612 `${tl("当前版本")}: ${crv}, ${tl("发现最新版")}: ${ltv}`,
2613 `UPDATE`,
2614 function (t) {
2615 window.open(
2616 `${downloadURL}?t=${Date.now()}`,
2617 "_blank",
2618 );
2619 },
2620 );
2621 } else {
2622 if (action === "click") {
2623 ndialog(
2624 `${tl("检查更新")}`,
2625 `${tl("当前版本")}: ${crv}, ${tl("已是最新版")}`,
2626 `OK`,
2627 );
2628 }
2629 }
2630 },
2631 });
2632 };
2633
2634 /*
2635 克隆对话

Callers 2

loadMenuFunction · 0.85
setUserOptionsFunction · 0.85

Calls 4

verIntFunction · 0.85
ndialogFunction · 0.85
tlFunction · 0.85
openMethod · 0.80

Tested by

no test coverage detected