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
package/out/log.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
info(message?: any): void;
|
|
3
|
+
warn(message?: any): void;
|
|
4
|
+
error(message?: any): void;
|
|
5
|
+
debug?(message: string): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class NoOpLogger implements Logger {
|
|
8
|
+
info(message?: any): void;
|
|
9
|
+
warn(message?: any): void;
|
|
10
|
+
error(message?: any): void;
|
|
11
|
+
}
|
package/out/log.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoOpLogger = void 0;
|
|
4
|
+
class NoOpLogger {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
info(message) {
|
|
7
|
+
// ignore
|
|
8
|
+
}
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
warn(message) {
|
|
11
|
+
// ignore
|
|
12
|
+
}
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
error(message) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.NoOpLogger = NoOpLogger;
|
|
19
|
+
//# sourceMappingURL=log.js.map
|
package/out/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";;;AAUA,MAAa,UAAU;IACrB,6DAA6D;IAC7D,IAAI,CAAC,OAAa;QAChB,SAAS;IACX,CAAC;IAED,6DAA6D;IAC7D,IAAI,CAAC,OAAa;QAChB,SAAS;IACX,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,OAAa;QACjB,SAAS;IACX,CAAC;CACF;AAfD,gCAeC","sourcesContent":["export 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\nexport class NoOpLogger implements Logger {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n info(message?: any) {\n // ignore\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n warn(message?: any) {\n // ignore\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n error(message?: any) {\n // ignore\n }\n}\n"]}
|
package/out/main.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ import { URL } from "url";
|
|
|
5
5
|
import { AppUpdater } from "./AppUpdater";
|
|
6
6
|
import { LoginCallback } from "./electronHttpExecutor";
|
|
7
7
|
export { AppUpdater, NoOpLogger } from "./AppUpdater";
|
|
8
|
-
export { UpdateInfo };
|
|
9
|
-
export { CancellationToken } from "builder-util-runtime";
|
|
8
|
+
export { CancellationToken, PackageFileInfo, ProgressInfo, UpdateFileInfo, UpdateInfo };
|
|
10
9
|
export { Provider } from "./providers/Provider";
|
|
11
10
|
export { AppImageUpdater } from "./AppImageUpdater";
|
|
12
11
|
export { MacUpdater } from "./MacUpdater";
|
|
@@ -17,7 +16,6 @@ export interface ResolvedUpdateFileInfo {
|
|
|
17
16
|
readonly info: UpdateFileInfo;
|
|
18
17
|
packageInfo?: PackageFileInfo;
|
|
19
18
|
}
|
|
20
|
-
export declare function getChannelFilename(channel: string): string;
|
|
21
19
|
export interface UpdateCheckResult {
|
|
22
20
|
readonly updateInfo: UpdateInfo;
|
|
23
21
|
readonly downloadPromise?: Promise<Array<string>> | null;
|
|
@@ -49,4 +47,3 @@ export interface Logger {
|
|
|
49
47
|
error(message?: any): void;
|
|
50
48
|
debug?(message: string): void;
|
|
51
49
|
}
|
|
52
|
-
export declare function newUrlFromBase(pathname: string, baseUrl: URL, addRandomQueryToAvoidCaching?: boolean): URL;
|
package/out/main.js
CHANGED
|
@@ -1,225 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
get: function () {
|
|
18
|
-
return _AppUpdater().NoOpLogger;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(exports, "CancellationToken", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _builderUtilRuntime().CancellationToken;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(exports, "Provider", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return _Provider().Provider;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports, "AppImageUpdater", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return _AppImageUpdater().AppImageUpdater;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, "MacUpdater", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return _MacUpdater().MacUpdater;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(exports, "NsisUpdater", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function () {
|
|
48
|
-
return _NsisUpdater().NsisUpdater;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
exports.UpdaterSignal = exports.UPDATE_DOWNLOADED = exports.DOWNLOAD_PROGRESS = void 0;
|
|
52
|
-
|
|
53
|
-
function _url() {
|
|
54
|
-
const data = require("url");
|
|
55
|
-
|
|
56
|
-
_url = function () {
|
|
57
|
-
return data;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return data;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function _AppUpdater() {
|
|
64
|
-
const data = require("./AppUpdater");
|
|
65
|
-
|
|
66
|
-
_AppUpdater = function () {
|
|
67
|
-
return data;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return data;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function _builderUtilRuntime() {
|
|
74
|
-
const data = require("builder-util-runtime");
|
|
75
|
-
|
|
76
|
-
_builderUtilRuntime = function () {
|
|
77
|
-
return data;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return data;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function _Provider() {
|
|
84
|
-
const data = require("./providers/Provider");
|
|
85
|
-
|
|
86
|
-
_Provider = function () {
|
|
87
|
-
return data;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return data;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _AppImageUpdater() {
|
|
94
|
-
const data = require("./AppImageUpdater");
|
|
95
|
-
|
|
96
|
-
_AppImageUpdater = function () {
|
|
97
|
-
return data;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return data;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _MacUpdater() {
|
|
104
|
-
const data = require("./MacUpdater");
|
|
105
|
-
|
|
106
|
-
_MacUpdater = function () {
|
|
107
|
-
return data;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
return data;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function _NsisUpdater() {
|
|
114
|
-
const data = require("./NsisUpdater");
|
|
115
|
-
|
|
116
|
-
_NsisUpdater = function () {
|
|
117
|
-
return data;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return data;
|
|
121
|
-
}
|
|
122
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdaterSignal = exports.UPDATE_DOWNLOADED = exports.DOWNLOAD_PROGRESS = exports.NsisUpdater = exports.MacUpdater = exports.AppImageUpdater = exports.Provider = exports.CancellationToken = exports.NoOpLogger = exports.AppUpdater = void 0;
|
|
4
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
5
|
+
Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return builder_util_runtime_1.CancellationToken; } });
|
|
6
|
+
var AppUpdater_1 = require("./AppUpdater");
|
|
7
|
+
Object.defineProperty(exports, "AppUpdater", { enumerable: true, get: function () { return AppUpdater_1.AppUpdater; } });
|
|
8
|
+
Object.defineProperty(exports, "NoOpLogger", { enumerable: true, get: function () { return AppUpdater_1.NoOpLogger; } });
|
|
9
|
+
var Provider_1 = require("./providers/Provider");
|
|
10
|
+
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return Provider_1.Provider; } });
|
|
11
|
+
var AppImageUpdater_1 = require("./AppImageUpdater");
|
|
12
|
+
Object.defineProperty(exports, "AppImageUpdater", { enumerable: true, get: function () { return AppImageUpdater_1.AppImageUpdater; } });
|
|
13
|
+
var MacUpdater_1 = require("./MacUpdater");
|
|
14
|
+
Object.defineProperty(exports, "MacUpdater", { enumerable: true, get: function () { return MacUpdater_1.MacUpdater; } });
|
|
15
|
+
var NsisUpdater_1 = require("./NsisUpdater");
|
|
16
|
+
Object.defineProperty(exports, "NsisUpdater", { enumerable: true, get: function () { return NsisUpdater_1.NsisUpdater; } });
|
|
123
17
|
// autoUpdater to mimic electron bundled autoUpdater
|
|
124
18
|
let _autoUpdater;
|
|
125
|
-
|
|
126
19
|
function doLoadAutoUpdater() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
20
|
+
// tslint:disable:prefer-conditional-expression
|
|
21
|
+
if (process.platform === "win32") {
|
|
22
|
+
_autoUpdater = new (require("./NsisUpdater").NsisUpdater)();
|
|
23
|
+
}
|
|
24
|
+
else if (process.platform === "darwin") {
|
|
25
|
+
_autoUpdater = new (require("./MacUpdater").MacUpdater)();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
_autoUpdater = new (require("./AppImageUpdater").AppImageUpdater)();
|
|
29
|
+
}
|
|
30
|
+
return _autoUpdater;
|
|
137
31
|
}
|
|
138
|
-
|
|
139
32
|
Object.defineProperty(exports, "autoUpdater", {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: () => {
|
|
35
|
+
return _autoUpdater || doLoadAutoUpdater();
|
|
36
|
+
},
|
|
144
37
|
});
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return `${channel}.yml`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const DOWNLOAD_PROGRESS = "download-progress";
|
|
151
|
-
exports.DOWNLOAD_PROGRESS = DOWNLOAD_PROGRESS;
|
|
152
|
-
const UPDATE_DOWNLOADED = "update-downloaded";
|
|
153
|
-
exports.UPDATE_DOWNLOADED = UPDATE_DOWNLOADED;
|
|
154
|
-
|
|
38
|
+
exports.DOWNLOAD_PROGRESS = "download-progress";
|
|
39
|
+
exports.UPDATE_DOWNLOADED = "update-downloaded";
|
|
155
40
|
class UpdaterSignal {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
updateCancelled(handler) {
|
|
177
|
-
addHandler(this.emitter, "update-cancelled", handler);
|
|
178
|
-
}
|
|
179
|
-
|
|
41
|
+
constructor(emitter) {
|
|
42
|
+
this.emitter = emitter;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Emitted when an authenticating proxy is [asking for user credentials](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login).
|
|
46
|
+
*/
|
|
47
|
+
login(handler) {
|
|
48
|
+
addHandler(this.emitter, "login", handler);
|
|
49
|
+
}
|
|
50
|
+
progress(handler) {
|
|
51
|
+
addHandler(this.emitter, exports.DOWNLOAD_PROGRESS, handler);
|
|
52
|
+
}
|
|
53
|
+
updateDownloaded(handler) {
|
|
54
|
+
addHandler(this.emitter, exports.UPDATE_DOWNLOADED, handler);
|
|
55
|
+
}
|
|
56
|
+
updateCancelled(handler) {
|
|
57
|
+
addHandler(this.emitter, "update-cancelled", handler);
|
|
58
|
+
}
|
|
180
59
|
}
|
|
181
|
-
|
|
182
60
|
exports.UpdaterSignal = UpdaterSignal;
|
|
183
61
|
const isLogEvent = false;
|
|
184
|
-
|
|
185
62
|
function addHandler(emitter, event, handler) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/** @internal */
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
function newBaseUrl(url) {
|
|
200
|
-
const result = new (_url().URL)(url);
|
|
201
|
-
|
|
202
|
-
if (!result.pathname.endsWith("/")) {
|
|
203
|
-
result.pathname += "/";
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return result;
|
|
207
|
-
} // addRandomQueryToAvoidCaching is false by default because in most cases URL already contains version number,
|
|
208
|
-
// so, it makes sense only for Generic Provider for channel files
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
function newUrlFromBase(pathname, baseUrl, addRandomQueryToAvoidCaching = false) {
|
|
212
|
-
const result = new (_url().URL)(pathname, baseUrl); // search is not propagated (search is an empty string if not specified)
|
|
213
|
-
|
|
214
|
-
const search = baseUrl.search;
|
|
215
|
-
|
|
216
|
-
if (search != null && search.length !== 0) {
|
|
217
|
-
result.search = search;
|
|
218
|
-
} else if (addRandomQueryToAvoidCaching) {
|
|
219
|
-
result.search = `noCache=${Date.now().toString(32)}`;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return result;
|
|
223
|
-
}
|
|
224
|
-
// __ts-babel@6.0.4
|
|
63
|
+
if (isLogEvent) {
|
|
64
|
+
emitter.on(event, (...args) => {
|
|
65
|
+
console.log("%s %s", event, args);
|
|
66
|
+
handler(...args);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
emitter.on(event, handler);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
225
73
|
//# sourceMappingURL=main.js.map
|
package/out/main.js.map
CHANGED
|
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OAAO,CAAc;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,OAAqB;QACzB,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;IAED,QAAQ,CAAC,OAAqC;QAC5C,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,yBAAiB,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IAED,gBAAgB,CAAC,OAA8C;QAC7D,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,yBAAiB,EAAE,OAAO,CAAC,CAAA;IACtD,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,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AA;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;
|