electron-updater 4.3.5 → 4.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/out/AppAdapter.js +19 -28
- package/out/AppAdapter.js.map +1 -1
- package/out/AppImageUpdater.js +103 -173
- package/out/AppImageUpdater.js.map +1 -1
- package/out/AppUpdater.d.ts +1 -3
- package/out/AppUpdater.js +517 -773
- package/out/AppUpdater.js.map +1 -1
- package/out/BaseUpdater.js +79 -103
- package/out/BaseUpdater.js.map +1 -1
- package/out/DownloadedUpdateHelper.js +150 -224
- package/out/DownloadedUpdateHelper.js.map +1 -1
- package/out/ElectronAppAdapter.js +35 -63
- package/out/ElectronAppAdapter.js.map +1 -1
- package/out/MacUpdater.d.ts +1 -1
- package/out/MacUpdater.js +132 -182
- package/out/MacUpdater.js.map +1 -1
- package/out/NoOpLogger.d.ts +6 -0
- package/out/NoOpLogger.js +19 -0
- package/out/NoOpLogger.js.map +1 -0
- package/out/NsisUpdater.js +199 -331
- package/out/NsisUpdater.js.map +1 -1
- package/out/differentialDownloader/DataSplitter.js +180 -252
- package/out/differentialDownloader/DataSplitter.js.map +1 -1
- package/out/differentialDownloader/DifferentialDownloader.d.ts +3 -0
- package/out/differentialDownloader/DifferentialDownloader.js +243 -308
- package/out/differentialDownloader/DifferentialDownloader.js.map +1 -1
- package/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js +29 -65
- package/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js.map +1 -1
- package/out/differentialDownloader/GenericDifferentialDownloader.js +7 -21
- package/out/differentialDownloader/GenericDifferentialDownloader.js.map +1 -1
- package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.d.ts +32 -0
- package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js +90 -0
- package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js.map +1 -0
- package/out/differentialDownloader/downloadPlanBuilder.js +99 -124
- package/out/differentialDownloader/downloadPlanBuilder.js.map +1 -1
- package/out/differentialDownloader/multipleRangeDownloader.js +99 -148
- package/out/differentialDownloader/multipleRangeDownloader.js.map +1 -1
- package/out/electronHttpExecutor.js +73 -106
- package/out/electronHttpExecutor.js.map +1 -1
- package/out/event.d.ts +35 -0
- package/out/event.js +39 -0
- package/out/event.js.map +1 -0
- package/out/log.d.ts +11 -0
- package/out/log.js +19 -0
- package/out/log.js.map +1 -0
- package/out/main.d.ts +1 -4
- package/out/main.js +60 -212
- package/out/main.js.map +1 -1
- package/out/providerFactory.js +49 -105
- package/out/providerFactory.js.map +1 -1
- package/out/providers/BintrayProvider.d.ts +2 -2
- package/out/providers/BintrayProvider.js +40 -95
- package/out/providers/BintrayProvider.js.map +1 -1
- package/out/providers/GenericProvider.d.ts +2 -2
- package/out/providers/GenericProvider.js +46 -80
- package/out/providers/GenericProvider.js.map +1 -1
- package/out/providers/GitHubProvider.d.ts +2 -2
- package/out/providers/GitHubProvider.js +122 -201
- package/out/providers/GitHubProvider.js.map +1 -1
- package/out/providers/PrivateGitHubProvider.js +87 -165
- package/out/providers/PrivateGitHubProvider.js.map +1 -1
- package/out/providers/Provider.js +122 -173
- package/out/providers/Provider.js.map +1 -1
- package/out/util.d.ts +5 -0
- package/out/util.js +42 -0
- package/out/util.js.map +1 -0
- package/out/windowsExecutableCodeSignatureVerifier.js +99 -139
- package/out/windowsExecutableCodeSignatureVerifier.js.map +1 -1
- package/package.json +33 -31
|
@@ -1,99 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.BintrayProvider = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _bintray() {
|
|
19
|
-
const data = require("builder-util-runtime/out/bintray");
|
|
20
|
-
|
|
21
|
-
_bintray = function () {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _url() {
|
|
29
|
-
const data = require("url");
|
|
30
|
-
|
|
31
|
-
_url = function () {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _main() {
|
|
39
|
-
const data = require("../main");
|
|
40
|
-
|
|
41
|
-
_main = function () {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _Provider() {
|
|
49
|
-
const data = require("./Provider");
|
|
50
|
-
|
|
51
|
-
_Provider = function () {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class BintrayProvider extends _main().Provider {
|
|
59
|
-
constructor(configuration, runtimeOptions) {
|
|
60
|
-
super(runtimeOptions);
|
|
61
|
-
this.client = new (_bintray().BintrayClient)(configuration, runtimeOptions.executor, new (_builderUtilRuntime().CancellationToken)());
|
|
62
|
-
this.baseUrl = (0, _main().newBaseUrl)(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
setRequestHeaders(value) {
|
|
66
|
-
super.setRequestHeaders(value);
|
|
67
|
-
this.client.setRequestHeaders(value);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async getLatestVersion() {
|
|
71
|
-
try {
|
|
72
|
-
const data = await this.client.getVersion("_latest");
|
|
73
|
-
const channelFilename = (0, _main().getChannelFilename)(this.getDefaultChannelName());
|
|
74
|
-
const files = await this.client.getVersionFiles(data.name);
|
|
75
|
-
const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`));
|
|
76
|
-
|
|
77
|
-
if (channelFile == null) {
|
|
78
|
-
// noinspection ExceptionCaughtLocallyJS
|
|
79
|
-
throw (0, _builderUtilRuntime().newError)(`Cannot find channel file "${channelFilename}", existing files:\n${files.map(it => JSON.stringify(it, null, 2)).join(",\n")}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const channelFileUrl = new (_url().URL)(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`);
|
|
83
|
-
return (0, _Provider().parseUpdateInfo)((await this.httpRequest(channelFileUrl)), channelFilename, channelFileUrl);
|
|
84
|
-
} catch (e) {
|
|
85
|
-
if ("statusCode" in e && e.statusCode === 404) {
|
|
86
|
-
throw (0, _builderUtilRuntime().newError)(`No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`, "ERR_UPDATER_LATEST_VERSION_NOT_FOUND");
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
throw e;
|
|
4
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
5
|
+
const bintray_1 = require("builder-util-runtime/out/bintray");
|
|
6
|
+
const url_1 = require("url");
|
|
7
|
+
const util_1 = require("../util");
|
|
8
|
+
const Provider_1 = require("./Provider");
|
|
9
|
+
class BintrayProvider extends Provider_1.Provider {
|
|
10
|
+
constructor(configuration, runtimeOptions) {
|
|
11
|
+
super(runtimeOptions);
|
|
12
|
+
this.client = new bintray_1.BintrayClient(configuration, runtimeOptions.executor, new builder_util_runtime_1.CancellationToken());
|
|
13
|
+
this.baseUrl = util_1.newBaseUrl(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`);
|
|
90
14
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
15
|
+
setRequestHeaders(value) {
|
|
16
|
+
super.setRequestHeaders(value);
|
|
17
|
+
this.client.setRequestHeaders(value);
|
|
18
|
+
}
|
|
19
|
+
async getLatestVersion() {
|
|
20
|
+
try {
|
|
21
|
+
const data = await this.client.getVersion("_latest");
|
|
22
|
+
const channelFilename = util_1.getChannelFilename(this.getDefaultChannelName());
|
|
23
|
+
const files = await this.client.getVersionFiles(data.name);
|
|
24
|
+
const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`));
|
|
25
|
+
if (channelFile == null) {
|
|
26
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
27
|
+
throw builder_util_runtime_1.newError(`Cannot find channel file "${channelFilename}", existing files:\n${files.map(it => JSON.stringify(it, null, 2)).join(",\n")}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
|
|
28
|
+
}
|
|
29
|
+
const channelFileUrl = new url_1.URL(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`);
|
|
30
|
+
return Provider_1.parseUpdateInfo(await this.httpRequest(channelFileUrl), channelFilename, channelFileUrl);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
if ("statusCode" in e && e.statusCode === 404) {
|
|
34
|
+
throw builder_util_runtime_1.newError(`No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`, "ERR_UPDATER_LATEST_VERSION_NOT_FOUND");
|
|
35
|
+
}
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
resolveFiles(updateInfo) {
|
|
40
|
+
return Provider_1.resolveFiles(updateInfo, this.baseUrl);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.BintrayProvider = BintrayProvider;
|
|
99
44
|
//# sourceMappingURL=BintrayProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/BintrayProv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I,WAAW,IAAI,IAAI,EAAE;gBACvB,wCAAwC;gBACxC,MAAM,+BAAQ,CACZ,6BAA6B,eAAe,uBAAuB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAC7H,oCAAoC,CACrC,CAAA;aACF;YAED,MAAM,cAAc,GAAG,IAAI,SAAG,CAAC,0BAA0B,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;YACrH,OAAO,0BAAe,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAA;SAChG;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE;gBAC7C,MAAM,+BAAQ,CACZ,kIAAkI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,EACxJ,sCAAsC,CACvC,CAAA;aACF;YACD,MAAM,CAAC,CAAA;SACR;IACH,CAAC;IAED,YAAY,CAAC,UAAsB;QACjC,OAAO,uBAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACF;AA9CD,0CA8CC","sourcesContent":["import { BintrayOptions, CancellationToken, newError, UpdateInfo } from \"builder-util-runtime\"\nimport { BintrayClient } from \"builder-util-runtime/out/bintray\"\nimport { URL } from \"url\"\nimport { ResolvedUpdateFileInfo } from \"../main\"\nimport { getChannelFilename, newBaseUrl } from \"../util\"\nimport { parseUpdateInfo, Provider, ProviderRuntimeOptions, resolveFiles } from \"./Provider\"\n\nexport class BintrayProvider extends Provider<UpdateInfo> {\n private client: BintrayClient\n private readonly baseUrl: URL\n\n constructor(configuration: BintrayOptions, runtimeOptions: ProviderRuntimeOptions) {\n super(runtimeOptions)\n\n this.client = new BintrayClient(configuration, runtimeOptions.executor, new CancellationToken())\n this.baseUrl = newBaseUrl(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}`)\n }\n\n setRequestHeaders(value: any): void {\n super.setRequestHeaders(value)\n this.client.setRequestHeaders(value)\n }\n\n async getLatestVersion(): Promise<UpdateInfo> {\n try {\n const data = await this.client.getVersion(\"_latest\")\n const channelFilename = getChannelFilename(this.getDefaultChannelName())\n const files = await this.client.getVersionFiles(data.name)\n const channelFile = files.find(it => it.name.endsWith(`_${channelFilename}`) || it.name.endsWith(`-${channelFilename}`))\n if (channelFile == null) {\n // noinspection ExceptionCaughtLocallyJS\n throw newError(\n `Cannot find channel file \"${channelFilename}\", existing files:\\n${files.map(it => JSON.stringify(it, null, 2)).join(\",\\n\")}`,\n \"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND\"\n )\n }\n\n const channelFileUrl = new URL(`https://dl.bintray.com/${this.client.owner}/${this.client.repo}/${channelFile.name}`)\n return parseUpdateInfo(await this.httpRequest(channelFileUrl), channelFilename, channelFileUrl)\n } catch (e) {\n if (\"statusCode\" in e && e.statusCode === 404) {\n throw newError(\n `No latest version, please ensure that user, package and repository correctly configured. Or at least one version is published. ${e.stack || e.message}`,\n \"ERR_UPDATER_LATEST_VERSION_NOT_FOUND\"\n )\n }\n throw e\n }\n }\n\n resolveFiles(updateInfo: UpdateInfo): Array<ResolvedUpdateFileInfo> {\n return resolveFiles(updateInfo, this.baseUrl)\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GenericServerOptions, UpdateInfo } from "builder-util-runtime";
|
|
2
2
|
import { AppUpdater } from "../AppUpdater";
|
|
3
|
-
import {
|
|
4
|
-
import { ProviderRuntimeOptions } from "./Provider";
|
|
3
|
+
import { ResolvedUpdateFileInfo } from "../main";
|
|
4
|
+
import { Provider, ProviderRuntimeOptions } from "./Provider";
|
|
5
5
|
export declare class GenericProvider extends Provider<UpdateInfo> {
|
|
6
6
|
private readonly configuration;
|
|
7
7
|
private readonly updater;
|
|
@@ -1,85 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.GenericProvider = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const result = this.updater.channel || this.configuration.channel;
|
|
48
|
-
return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async getLatestVersion() {
|
|
52
|
-
const channelFile = (0, _main().getChannelFilename)(this.channel);
|
|
53
|
-
const channelUrl = (0, _main().newUrlFromBase)(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery);
|
|
54
|
-
|
|
55
|
-
for (let attemptNumber = 0;; attemptNumber++) {
|
|
56
|
-
try {
|
|
57
|
-
return (0, _Provider().parseUpdateInfo)((await this.httpRequest(channelUrl)), channelFile, channelUrl);
|
|
58
|
-
} catch (e) {
|
|
59
|
-
if (e instanceof _builderUtilRuntime().HttpError && e.statusCode === 404) {
|
|
60
|
-
throw (0, _builderUtilRuntime().newError)(`Cannot find channel "${channelFile}" update info: ${e.stack || e.message}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
|
|
61
|
-
} else if (e.code === "ECONNREFUSED") {
|
|
62
|
-
if (attemptNumber < 3) {
|
|
63
|
-
await new Promise((resolve, reject) => {
|
|
64
|
-
try {
|
|
65
|
-
setTimeout(resolve, 1000 * attemptNumber);
|
|
66
|
-
} catch (e) {
|
|
67
|
-
reject(e);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
4
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
5
|
+
const util_1 = require("../util");
|
|
6
|
+
const Provider_1 = require("./Provider");
|
|
7
|
+
class GenericProvider extends Provider_1.Provider {
|
|
8
|
+
constructor(configuration, updater, runtimeOptions) {
|
|
9
|
+
super(runtimeOptions);
|
|
10
|
+
this.configuration = configuration;
|
|
11
|
+
this.updater = updater;
|
|
12
|
+
this.baseUrl = util_1.newBaseUrl(this.configuration.url);
|
|
13
|
+
}
|
|
14
|
+
get channel() {
|
|
15
|
+
const result = this.updater.channel || this.configuration.channel;
|
|
16
|
+
return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result);
|
|
17
|
+
}
|
|
18
|
+
async getLatestVersion() {
|
|
19
|
+
const channelFile = util_1.getChannelFilename(this.channel);
|
|
20
|
+
const channelUrl = util_1.newUrlFromBase(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery);
|
|
21
|
+
for (let attemptNumber = 0;; attemptNumber++) {
|
|
22
|
+
try {
|
|
23
|
+
return Provider_1.parseUpdateInfo(await this.httpRequest(channelUrl), channelFile, channelUrl);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
if (e instanceof builder_util_runtime_1.HttpError && e.statusCode === 404) {
|
|
27
|
+
throw builder_util_runtime_1.newError(`Cannot find channel "${channelFile}" update info: ${e.stack || e.message}`, "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND");
|
|
28
|
+
}
|
|
29
|
+
else if (e.code === "ECONNREFUSED") {
|
|
30
|
+
if (attemptNumber < 3) {
|
|
31
|
+
await new Promise((resolve, reject) => {
|
|
32
|
+
try {
|
|
33
|
+
setTimeout(resolve, 1000 * attemptNumber);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
reject(e);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
72
44
|
}
|
|
73
|
-
|
|
74
|
-
throw e;
|
|
75
|
-
}
|
|
76
45
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} exports.GenericProvider = GenericProvider;
|
|
84
|
-
// __ts-babel@6.0.4
|
|
46
|
+
resolveFiles(updateInfo) {
|
|
47
|
+
return Provider_1.resolveFiles(updateInfo, this.baseUrl);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.GenericProvider = GenericProvider;
|
|
85
51
|
//# sourceMappingURL=GenericProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/GenericProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenericProvider.js","sourceRoot":"","sources":["../../src/providers/GenericProvider.ts"],"names":[],"mappings":";;;AAAA,+DAA4F;AAG5F,kCAAwE;AACxE,yCAA4F;AAE5F,MAAa,eAAgB,SAAQ,mBAAoB;IAGvD,YAA6B,aAAmC,EAAmB,OAAmB,EAAE,cAAsC;QAC5I,KAAK,CAAC,cAAc,CAAC,CAAA;QADM,kBAAa,GAAb,aAAa,CAAsB;QAAmB,YAAO,GAAP,OAAO,CAAY;QAFrF,YAAO,GAAG,iBAAU,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAI7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AAQ;qBACT;iBACF;gBACD,MAAM,CAAC,CAAA;aACR;SACF;IACH,CAAC;IAED,YAAY,CAAC,UAAsB;QACjC,OAAO,uBAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACF;AAzCD,0CAyCC","sourcesContent":["import { GenericServerOptions, HttpError, newError, UpdateInfo } from \"builder-util-runtime\"\nimport { AppUpdater } from \"../AppUpdater\"\nimport { ResolvedUpdateFileInfo } from \"../main\"\nimport { getChannelFilename, newBaseUrl, newUrlFromBase } from \"../util\"\nimport { parseUpdateInfo, Provider, ProviderRuntimeOptions, resolveFiles } from \"./Provider\"\n\nexport class GenericProvider extends Provider<UpdateInfo> {\n private readonly baseUrl = newBaseUrl(this.configuration.url)\n\n constructor(private readonly configuration: GenericServerOptions, private readonly updater: AppUpdater, runtimeOptions: ProviderRuntimeOptions) {\n super(runtimeOptions)\n }\n\n private get channel(): string {\n const result = this.updater.channel || this.configuration.channel\n return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result)\n }\n\n async getLatestVersion(): Promise<UpdateInfo> {\n const channelFile = getChannelFilename(this.channel)\n const channelUrl = newUrlFromBase(channelFile, this.baseUrl, this.updater.isAddNoCacheQuery)\n for (let attemptNumber = 0; ; attemptNumber++) {\n try {\n return parseUpdateInfo(await this.httpRequest(channelUrl), channelFile, channelUrl)\n } catch (e) {\n if (e instanceof HttpError && e.statusCode === 404) {\n throw newError(`Cannot find channel \"${channelFile}\" update info: ${e.stack || e.message}`, \"ERR_UPDATER_CHANNEL_FILE_NOT_FOUND\")\n } else if (e.code === \"ECONNREFUSED\") {\n if (attemptNumber < 3) {\n await new Promise((resolve, reject) => {\n try {\n setTimeout(resolve, 1000 * attemptNumber)\n } catch (e) {\n reject(e)\n }\n })\n continue\n }\n }\n throw e\n }\n }\n }\n\n resolveFiles(updateInfo: UpdateInfo): Array<ResolvedUpdateFileInfo> {\n return resolveFiles(updateInfo, this.baseUrl)\n }\n}\n"]}
|
|
@@ -3,8 +3,8 @@ import { GithubOptions, ReleaseNoteInfo, UpdateInfo, XElement } from "builder-ut
|
|
|
3
3
|
import * as semver from "semver";
|
|
4
4
|
import { URL } from "url";
|
|
5
5
|
import { AppUpdater } from "../AppUpdater";
|
|
6
|
-
import {
|
|
7
|
-
import { ProviderRuntimeOptions } from "./Provider";
|
|
6
|
+
import { ResolvedUpdateFileInfo } from "../main";
|
|
7
|
+
import { Provider, ProviderRuntimeOptions } from "./Provider";
|
|
8
8
|
export declare abstract class BaseGitHubProvider<T extends UpdateInfo> extends Provider<T> {
|
|
9
9
|
protected readonly options: GithubOptions;
|
|
10
10
|
protected readonly baseUrl: URL;
|