diff --git a/package.json b/package.json index 4f001e7f..a60bbed2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yank.note", - "version": "3.20.0", + "version": "3.19.0", "description": "Yank Note: A hackable markdown note application for programmers", "main": "dist/main/app.js", "license": "GPL-3.0", diff --git a/src/main/updater.ts b/src/main/updater.ts index 760bbe39..614ea2bb 100644 --- a/src/main/updater.ts +++ b/src/main/updater.ts @@ -35,6 +35,22 @@ const httpRequest = (Provider.prototype as any).httpRequest return httpRequest.call(this, url, ...args) } +const getUpdateInfoAndProvider = (autoUpdater as any).getUpdateInfoAndProvider +;(autoUpdater as any).getUpdateInfoAndProvider = async function () { + const result = await getUpdateInfoAndProvider.call(this) + const source: Source = config.get('updater.source', 'github.com') + result.provider.baseUrl.host = source + result.provider.getBaseDownloadPath = function (tag: string, fileName: string) { + const downloadPath = `${this.basePath}/download/${tag}/${fileName}` + if (source === 'mirror.ghproxy.com' || source === 'ghproxy.com') { + return `/https://github.com/${downloadPath}` + } + + return downloadPath + } + return result +} + const init = (call: () => void) => { if (disabled) { return