MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / checkTheGithubPages

Method checkTheGithubPages

src/main/views/update.ts:97–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 checkTheGithubPages() {
98 console.log("正在检查Github更新");
99 console.log(constants.latest);
100 this.get(constants.latest)
101 .then((res) => res.data)
102 .then((data) => {
103 console.log("Github上最新版本为", JSON.stringify(data));
104 //这里的data.version是带了前缀v的
105 if (isLower(version, data.version)) {
106 this.get(getChangelogURL(data.version))
107 .then((res) => res.data)
108 .then((releaseNotes) => {
109 const updateInfo: UpdateInfo = {
110 releaseNotes,
111 releaseName: data.releaseName,
112 needCompile: true,
113 isWin: false,
114 manualLink: constants.manualDownloadLink,
115 };
116 this.postUpdateInfo(updateInfo);
117 })
118 .catch((e) => {
119 console.error("从Github获取最新版本更新日志失败");
120 });
121 } else {
122 console.log("Github显示当前即为最新版本");
123 }
124 })
125 .catch((e) => console.error("通过Github获取最新版本失败"));
126 }
127
128 showCurrentChangelog(targetVersion?: string) {
129 const url = targetVersion

Callers 1

bindUpdateEventsMethod · 0.95

Calls 4

getMethod · 0.95
postUpdateInfoMethod · 0.95
isLowerFunction · 0.90
getChangelogURLFunction · 0.90

Tested by

no test coverage detected