electron-updater 4.3.8 → 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 -195
- package/out/AppImageUpdater.js.map +1 -1
- package/out/AppUpdater.d.ts +1 -1
- package/out/AppUpdater.js +517 -771
- 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 -223
- package/out/DownloadedUpdateHelper.js.map +1 -1
- package/out/ElectronAppAdapter.js +35 -63
- package/out/ElectronAppAdapter.js.map +1 -1
- package/out/MacUpdater.js +132 -201
- 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 -345
- 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 +1 -1
- package/out/differentialDownloader/DifferentialDownloader.js +242 -355
- 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.js +79 -107
- package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js.map +1 -1
- package/out/differentialDownloader/downloadPlanBuilder.js +99 -123
- 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 -3
- package/out/main.js +60 -196
- 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
package/out/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,+DAAmH;AAO1G,kGAPA,wCAAiB,OAOA;AAD1B,2CAAqD;AAA5C,wGAAA,UAAU,OAAA;AAAE,wGAAA,UAAU,OAAA;AAE/B,iDAA+C;AAAtC,oGAAA,QAAQ,OAAA;AACjB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,2CAAyC;AAAhC,wGAAA,UAAU,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,CAAC;IAED,eAAe,CAAC,OAAmC;QACjD,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;CACF;AArBD,sCAqBC;AAMD,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,SAAS,UAAU,CAAC,OAAqB,EAAE,KAAoB,EAAE,OAAsC;IACrG,IAAI,UAAU,EAAE;QACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAgB,EAAE,EAAE;YACxC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;YACjC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;KACH;SAAM;QACL,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;KAC3B;AACH,CAAC","sourcesContent":["import { CancellationToken, PackageFileInfo, ProgressInfo, UpdateFileInfo, UpdateInfo } from \"builder-util-runtime\"\nimport { EventEmitter } from \"events\"\nimport { URL } from \"url\"\nimport { AppUpdater } from \"./AppUpdater\"\nimport { LoginCallback } from \"./electronHttpExecutor\"\n\nexport { AppUpdater, NoOpLogger } from \"./AppUpdater\"\nexport { CancellationToken, PackageFileInfo, ProgressInfo, UpdateFileInfo, UpdateInfo }\nexport { Provider } from \"./providers/Provider\"\nexport { AppImageUpdater } from \"./AppImageUpdater\"\nexport { MacUpdater } from \"./MacUpdater\"\nexport { NsisUpdater } from \"./NsisUpdater\"\n\n// autoUpdater to mimic electron bundled autoUpdater\nlet _autoUpdater: any\n\n// required for jsdoc\nexport declare const autoUpdater: AppUpdater\n\nfunction doLoadAutoUpdater(): AppUpdater {\n // tslint:disable:prefer-conditional-expression\n if (process.platform === \"win32\") {\n _autoUpdater = new (require(\"./NsisUpdater\").NsisUpdater)()\n } else if (process.platform === \"darwin\") {\n _autoUpdater = new (require(\"./MacUpdater\").MacUpdater)()\n } else {\n _autoUpdater = new (require(\"./AppImageUpdater\").AppImageUpdater)()\n }\n return _autoUpdater\n}\n\nObject.defineProperty(exports, \"autoUpdater\", {\n enumerable: true,\n get: () => {\n return _autoUpdater || doLoadAutoUpdater()\n },\n})\n\nexport interface ResolvedUpdateFileInfo {\n readonly url: URL\n readonly info: UpdateFileInfo\n\n packageInfo?: PackageFileInfo\n}\n\nexport interface UpdateCheckResult {\n readonly updateInfo: UpdateInfo\n\n readonly downloadPromise?: Promise<Array<string>> | null\n\n readonly cancellationToken?: CancellationToken\n\n /** @deprecated */\n readonly versionInfo: UpdateInfo\n}\n\nexport type UpdaterEvents = \"login\" | \"checking-for-update\" | \"update-available\" | \"update-cancelled\" | \"download-progress\" | \"update-downloaded\" | \"error\"\n\nexport const DOWNLOAD_PROGRESS: UpdaterEvents = \"download-progress\"\nexport const UPDATE_DOWNLOADED: UpdaterEvents = \"update-downloaded\"\n\nexport type LoginHandler = (authInfo: any, callback: LoginCallback) => void\n\nexport class UpdaterSignal {\n constructor(private emitter: EventEmitter) {}\n\n /**\n * Emitted when an authenticating proxy is [asking for user credentials](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login).\n */\n login(handler: LoginHandler): void {\n addHandler(this.emitter, \"login\", handler)\n }\n\n progress(handler: (info: ProgressInfo) => void): void {\n addHandler(this.emitter, DOWNLOAD_PROGRESS, handler)\n }\n\n updateDownloaded(handler: (info: UpdateDownloadedEvent) => void): void {\n addHandler(this.emitter, UPDATE_DOWNLOADED, handler)\n }\n\n updateCancelled(handler: (info: UpdateInfo) => void): void {\n addHandler(this.emitter, \"update-cancelled\", handler)\n }\n}\n\nexport interface UpdateDownloadedEvent extends UpdateInfo {\n downloadedFile: string\n}\n\nconst isLogEvent = false\n\nfunction addHandler(emitter: EventEmitter, event: UpdaterEvents, handler: (...args: Array<any>) => void): void {\n if (isLogEvent) {\n emitter.on(event, (...args: Array<any>) => {\n console.log(\"%s %s\", event, args)\n handler(...args)\n })\n } else {\n emitter.on(event, handler)\n }\n}\n\nexport interface Logger {\n info(message?: any): void\n\n warn(message?: any): void\n\n error(message?: any): void\n\n debug?(message: string): void\n}\n"]}
|
package/out/providerFactory.js
CHANGED
|
@@ -1,111 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _builderUtilRuntime() {
|
|
10
|
-
const data = require("builder-util-runtime");
|
|
11
|
-
|
|
12
|
-
_builderUtilRuntime = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function _BintrayProvider() {
|
|
20
|
-
const data = require("./providers/BintrayProvider");
|
|
21
|
-
|
|
22
|
-
_BintrayProvider = function () {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function _GenericProvider() {
|
|
30
|
-
const data = require("./providers/GenericProvider");
|
|
31
|
-
|
|
32
|
-
_GenericProvider = function () {
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _GitHubProvider() {
|
|
40
|
-
const data = require("./providers/GitHubProvider");
|
|
41
|
-
|
|
42
|
-
_GitHubProvider = function () {
|
|
43
|
-
return data;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return data;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _PrivateGitHubProvider() {
|
|
50
|
-
const data = require("./providers/PrivateGitHubProvider");
|
|
51
|
-
|
|
52
|
-
_PrivateGitHubProvider = function () {
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return data;
|
|
57
|
-
}
|
|
58
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createClient = exports.isUrlProbablySupportMultiRangeRequests = void 0;
|
|
4
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
5
|
+
const BintrayProvider_1 = require("./providers/BintrayProvider");
|
|
6
|
+
const GenericProvider_1 = require("./providers/GenericProvider");
|
|
7
|
+
const GitHubProvider_1 = require("./providers/GitHubProvider");
|
|
8
|
+
const PrivateGitHubProvider_1 = require("./providers/PrivateGitHubProvider");
|
|
59
9
|
function isUrlProbablySupportMultiRangeRequests(url) {
|
|
60
|
-
|
|
10
|
+
return !url.includes("s3.amazonaws.com");
|
|
61
11
|
}
|
|
62
|
-
|
|
12
|
+
exports.isUrlProbablySupportMultiRangeRequests = isUrlProbablySupportMultiRangeRequests;
|
|
63
13
|
function createClient(data, updater, runtimeOptions) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
14
|
+
// noinspection SuspiciousTypeOfGuard
|
|
15
|
+
if (typeof data === "string") {
|
|
16
|
+
throw builder_util_runtime_1.newError("Please pass PublishConfiguration object", "ERR_UPDATER_INVALID_PROVIDER_CONFIGURATION");
|
|
17
|
+
}
|
|
18
|
+
const provider = data.provider;
|
|
19
|
+
switch (provider) {
|
|
20
|
+
case "github": {
|
|
21
|
+
const githubOptions = data;
|
|
22
|
+
const token = (githubOptions.private ? process.env.GH_TOKEN || process.env.GITHUB_TOKEN : null) || githubOptions.token;
|
|
23
|
+
if (token == null) {
|
|
24
|
+
return new GitHubProvider_1.GitHubProvider(githubOptions, updater, runtimeOptions);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return new PrivateGitHubProvider_1.PrivateGitHubProvider(githubOptions, updater, token, runtimeOptions);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
case "s3":
|
|
31
|
+
case "spaces":
|
|
32
|
+
return new GenericProvider_1.GenericProvider({
|
|
33
|
+
provider: "generic",
|
|
34
|
+
url: builder_util_runtime_1.getS3LikeProviderBaseUrl(data),
|
|
35
|
+
channel: data.channel || null,
|
|
36
|
+
}, updater, {
|
|
37
|
+
...runtimeOptions,
|
|
38
|
+
// https://github.com/minio/minio/issues/5285#issuecomment-350428955
|
|
39
|
+
isUseMultipleRangeRequest: false,
|
|
40
|
+
});
|
|
41
|
+
case "generic": {
|
|
42
|
+
const options = data;
|
|
43
|
+
return new GenericProvider_1.GenericProvider(options, updater, {
|
|
44
|
+
...runtimeOptions,
|
|
45
|
+
isUseMultipleRangeRequest: options.useMultipleRangeRequest !== false && isUrlProbablySupportMultiRangeRequests(options.url),
|
|
46
|
+
});
|
|
81
47
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
channel: data.channel || null
|
|
90
|
-
}, updater, { ...runtimeOptions,
|
|
91
|
-
// https://github.com/minio/minio/issues/5285#issuecomment-350428955
|
|
92
|
-
isUseMultipleRangeRequest: false
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
case "generic":
|
|
96
|
-
{
|
|
97
|
-
const options = data;
|
|
98
|
-
return new (_GenericProvider().GenericProvider)(options, updater, { ...runtimeOptions,
|
|
99
|
-
isUseMultipleRangeRequest: options.useMultipleRangeRequest !== false && isUrlProbablySupportMultiRangeRequests(options.url)
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
case "bintray":
|
|
104
|
-
return new (_BintrayProvider().BintrayProvider)(data, runtimeOptions);
|
|
105
|
-
|
|
106
|
-
default:
|
|
107
|
-
throw (0, _builderUtilRuntime().newError)(`Unsupported provider: ${provider}`, "ERR_UPDATER_UNSUPPORTED_PROVIDER");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// __ts-babel@6.0.4
|
|
48
|
+
case "bintray":
|
|
49
|
+
return new BintrayProvider_1.BintrayProvider(data, runtimeOptions);
|
|
50
|
+
default:
|
|
51
|
+
throw builder_util_runtime_1.newError(`Unsupported provider: ${provider}`, "ERR_UPDATER_UNSUPPORTED_PROVIDER");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.createClient = createClient;
|
|
111
55
|
//# sourceMappingURL=providerFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providerFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providerFactory.js","sourceRoot":"","sources":["../src/providerFactory.ts"],"names":[],"mappings":";;;AAAA,+DAS6B;AAE7B,iEAA6D;AAC7D,iEAA6D;AAC7D,+DAA2D;AAC3D,6EAAyE;AAGzE,SAAgB,sCAAsC,CAAC,GAAW;IAChE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAA;AAC1C,CAAC;AAFD,wFAEC;AAED,SAAgB,YAAY,CAAC,IAA8C,EAAE,OAAmB,EAAE,cAAsC;IACtI,qCAAqC;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,MAAM,+BAAQ,CAAC,yCAAyC,EAAE,4CAA4C,CAAC,CAAA;KACxG;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAC9B,QAAQ,QAAQ,EAAE;QAChB,KAAK,QAAQ,CAAC,CAAC;YACb,MAAM,aAAa,GAAG,IAAqB,CAAA;YAC3C,MAAM,KAAK,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,KAAK,CAAA;YACtH,IAAI,KAAK,IAAI,IAAI,EAAE;gBACjB,OAAO,IAAI,+BAAc,CAAC,aAAa,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;aAClE;iBAAM;gBACL,OAAO,IAAI,6CAAqB,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;aAChF;SACF;QAED,KAAK,IAAI,CAAC;QACV,KAAK,QAAQ;YACX,OAAO,IAAI,iCAAe,CACxB;gBACE,QAAQ,EAAE,SAAS;gBACnB,GAAG,EAAE,+CAAwB,CAAC,IAAI,CAAC;gBACnC,OAAO,EAAG,IAAsB,CAAC,OAAO,IAAI,IAAI;aACjD,EACD,OAAO,EACP;gBACE,GAAG,cAAc;gBACjB,oEAAoE;gBACpE,yBAAyB,EAAE,KAAK;aACjC,CACF,CAAA;QAEH,KAAK,SAAS,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,IAA4B,CAAA;YAC5C,OAAO,IAAI,iCAAe,CAAC,OAAO,EAAE,OAAO,EAAE;gBAC3C,GAAG,cAAc;gBACjB,yBAAyB,EAAE,OAAO,CAAC,uBAAuB,KAAK,KAAK,IAAI,sCAAsC,CAAC,OAAO,CAAC,GAAG,CAAC;aAC5H,CAAC,CAAA;SACH;QAED,KAAK,SAAS;YACZ,OAAO,IAAI,iCAAe,CAAC,IAAsB,EAAE,cAAc,CAAC,CAAA;QAEpE;YACE,MAAM,+BAAQ,CAAC,yBAAyB,QAAQ,EAAE,EAAE,kCAAkC,CAAC,CAAA;KAC1F;AACH,CAAC;AAhDD,oCAgDC","sourcesContent":["import {\n AllPublishOptions,\n BaseS3Options,\n BintrayOptions,\n GenericServerOptions,\n getS3LikeProviderBaseUrl,\n GithubOptions,\n newError,\n PublishConfiguration,\n} from \"builder-util-runtime\"\nimport { AppUpdater } from \"./AppUpdater\"\nimport { BintrayProvider } from \"./providers/BintrayProvider\"\nimport { GenericProvider } from \"./providers/GenericProvider\"\nimport { GitHubProvider } from \"./providers/GitHubProvider\"\nimport { PrivateGitHubProvider } from \"./providers/PrivateGitHubProvider\"\nimport { Provider, ProviderRuntimeOptions } from \"./providers/Provider\"\n\nexport function isUrlProbablySupportMultiRangeRequests(url: string): boolean {\n return !url.includes(\"s3.amazonaws.com\")\n}\n\nexport function createClient(data: PublishConfiguration | AllPublishOptions, updater: AppUpdater, runtimeOptions: ProviderRuntimeOptions): Provider<any> {\n // noinspection SuspiciousTypeOfGuard\n if (typeof data === \"string\") {\n throw newError(\"Please pass PublishConfiguration object\", \"ERR_UPDATER_INVALID_PROVIDER_CONFIGURATION\")\n }\n\n const provider = data.provider\n switch (provider) {\n case \"github\": {\n const githubOptions = data as GithubOptions\n const token = (githubOptions.private ? process.env.GH_TOKEN || process.env.GITHUB_TOKEN : null) || githubOptions.token\n if (token == null) {\n return new GitHubProvider(githubOptions, updater, runtimeOptions)\n } else {\n return new PrivateGitHubProvider(githubOptions, updater, token, runtimeOptions)\n }\n }\n\n case \"s3\":\n case \"spaces\":\n return new GenericProvider(\n {\n provider: \"generic\",\n url: getS3LikeProviderBaseUrl(data),\n channel: (data as BaseS3Options).channel || null,\n },\n updater,\n {\n ...runtimeOptions,\n // https://github.com/minio/minio/issues/5285#issuecomment-350428955\n isUseMultipleRangeRequest: false,\n }\n )\n\n case \"generic\": {\n const options = data as GenericServerOptions\n return new GenericProvider(options, updater, {\n ...runtimeOptions,\n isUseMultipleRangeRequest: options.useMultipleRangeRequest !== false && isUrlProbablySupportMultiRangeRequests(options.url),\n })\n }\n\n case \"bintray\":\n return new BintrayProvider(data as BintrayOptions, runtimeOptions)\n\n default:\n throw newError(`Unsupported provider: ${provider}`, \"ERR_UPDATER_UNSUPPORTED_PROVIDER\")\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BintrayOptions, UpdateInfo } from "builder-util-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { ProviderRuntimeOptions } from "./Provider";
|
|
2
|
+
import { ResolvedUpdateFileInfo } from "../main";
|
|
3
|
+
import { Provider, ProviderRuntimeOptions } from "./Provider";
|
|
4
4
|
export declare class BintrayProvider extends Provider<UpdateInfo> {
|
|
5
5
|
private client;
|
|
6
6
|
private readonly baseUrl;
|
|
@@ -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/BintrayProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BintrayProvider.js","sourceRoot":"","sources":["../../src/providers/BintrayProvider.ts"],"names":[],"mappings":";;;AAAA,+DAA8F;AAC9F,8DAAgE;AAChE,6BAAyB;AAEzB,kCAAwD;AACxD,yCAA4F;AAE5F,MAAa,eAAgB,SAAQ,mBAAoB;IAIvD,YAAY,aAA6B,EAAE,cAAsC;QAC/E,KAAK,CAAC,cAAc,CAAC,CAAA;QAErB,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAa,CAAC,aAAa,EAAE,cAAc,CAAC,QAAQ,EAAE,IAAI,wCAAiB,EAAE,CAAC,CAAA;QAChG,IAAI,CAAC,OAAO,GAAG,iBAAU,CAAC,0BAA0B,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IAC9F,CAAC;IAED,iBAAiB,CAAC,KAAU;QAC1B,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;YACpD,MAAM,eAAe,GAAG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AI,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":"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AAE,EAAE,oCAAoC,CAAC,CAAA;iBAClI;qBAAM,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,EAAE;oBACpC,IAAI,aAAa,GAAG,CAAC,EAAE;wBACrB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;4BACpC,IAAI;gCACF,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,aAAa,CAAC,CAAA;6BAC1C;4BAAC,OAAO,CAAC,EAAE;gCACV,MAAM,CAAC,CAAC,CAAC,CAAA;6BACV;wBACH,CAAC,CAAC,CAAA;wBACF,SAAQ;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;
|