(targetVersion?: string)
| 126 | } |
| 127 | |
| 128 | showCurrentChangelog(targetVersion?: string) { |
| 129 | const url = targetVersion |
| 130 | ? getChangelogURL(targetVersion) |
| 131 | : constants.currentChangelog; |
| 132 | console.log("正在获取更新日志", url); |
| 133 | this.get(url) |
| 134 | .then(() => { |
| 135 | this.controller.win.registerPostStart(() => { |
| 136 | const win = this.getWindow( |
| 137 | "更新日志", |
| 138 | path.join(env.externalResource, "update", "changelog.html") |
| 139 | ); |
| 140 | win.webContents.once("did-finish-load", () => { |
| 141 | let buff = Buffer.from(url, "utf-8"); |
| 142 | let base64data = buff.toString("base64"); //这里因为是直接传,所以可能会存在一些问题,看看如果先加密再解密会不会好点 |
| 143 | win.webContents.executeJavaScript(`fetchPage("${base64data}");`); |
| 144 | }); |
| 145 | }); |
| 146 | this.controller.set("isNewUser", false); |
| 147 | }) |
| 148 | .catch((e) => { |
| 149 | console.error("获取当前版本更新日志失败", url); |
| 150 | // console.error(e); |
| 151 | }); |
| 152 | } |
| 153 | |
| 154 | getWindow(title: string, file: string) { |
| 155 | let win = this.win; |
no test coverage detected