From 6a70f0519b5fedd37507dec13b23142ac36c729a Mon Sep 17 00:00:00 2001 From: purocean Date: Thu, 13 Jan 2022 15:06:14 +0800 Subject: [PATCH] fix: updater source --- package.json | 2 +- src/main/updater.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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