From 83a8d5f7426bc411dace4f2005d3794d98ca66a2 Mon Sep 17 00:00:00 2001 From: purocean Date: Thu, 13 Jan 2022 16:08:41 +0800 Subject: [PATCH] fix: updater source --- src/main/updater.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/updater.ts b/src/main/updater.ts index 614ea2bb..105d3d62 100644 --- a/src/main/updater.ts +++ b/src/main/updater.ts @@ -35,12 +35,13 @@ 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 setFeedURL = autoUpdater.setFeedURL +autoUpdater.setFeedURL = async function (options: any) { + setFeedURL.call(this, options) const source: Source = config.get('updater.source', 'github.com') - result.provider.baseUrl.host = source - result.provider.getBaseDownloadPath = function (tag: string, fileName: string) { + const provider = await (this as any).clientPromise + provider.baseUrl.host = source + 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}` @@ -48,7 +49,6 @@ const getUpdateInfoAndProvider = (autoUpdater as any).getUpdateInfoAndProvider return downloadPath } - return result } const init = (call: () => void) => {