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
|
@@ -1,112 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.getNetSession = getNetSession;
|
|
7
|
-
exports.ElectronHttpExecutor = exports.NET_SESSION_NAME = void 0;
|
|
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 _electron() {
|
|
20
|
-
const data = require("electron");
|
|
21
|
-
|
|
22
|
-
_electron = function () {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const NET_SESSION_NAME = "electron-updater";
|
|
30
|
-
exports.NET_SESSION_NAME = NET_SESSION_NAME;
|
|
31
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElectronHttpExecutor = exports.getNetSession = exports.NET_SESSION_NAME = void 0;
|
|
4
|
+
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
5
|
+
exports.NET_SESSION_NAME = "electron-updater";
|
|
32
6
|
function getNetSession() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
class ElectronHttpExecutor extends _builderUtilRuntime().HttpExecutor {
|
|
39
|
-
constructor(proxyLoginCallback) {
|
|
40
|
-
super();
|
|
41
|
-
this.proxyLoginCallback = proxyLoginCallback;
|
|
42
|
-
this.cachedSession = null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async download(url, destination, options) {
|
|
46
|
-
return await options.cancellationToken.createPromise((resolve, reject, onCancel) => {
|
|
47
|
-
const requestOptions = {
|
|
48
|
-
headers: options.headers || undefined,
|
|
49
|
-
redirect: "manual"
|
|
50
|
-
};
|
|
51
|
-
(0, _builderUtilRuntime().configureRequestUrl)(url, requestOptions);
|
|
52
|
-
(0, _builderUtilRuntime().configureRequestOptions)(requestOptions);
|
|
53
|
-
this.doDownload(requestOptions, {
|
|
54
|
-
destination,
|
|
55
|
-
options,
|
|
56
|
-
onCancel,
|
|
57
|
-
callback: error => {
|
|
58
|
-
if (error == null) {
|
|
59
|
-
resolve(destination);
|
|
60
|
-
} else {
|
|
61
|
-
reject(error);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
responseHandler: null
|
|
65
|
-
}, 0);
|
|
7
|
+
return require("electron").session.fromPartition(exports.NET_SESSION_NAME, {
|
|
8
|
+
cache: false,
|
|
66
9
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
delete options.headers.Host;
|
|
76
|
-
} // differential downloader can call this method very often, so, better to cache session
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (this.cachedSession == null) {
|
|
80
|
-
this.cachedSession = getNetSession();
|
|
10
|
+
}
|
|
11
|
+
exports.getNetSession = getNetSession;
|
|
12
|
+
class ElectronHttpExecutor extends builder_util_runtime_1.HttpExecutor {
|
|
13
|
+
constructor(proxyLoginCallback) {
|
|
14
|
+
super();
|
|
15
|
+
this.proxyLoginCallback = proxyLoginCallback;
|
|
16
|
+
this.cachedSession = null;
|
|
81
17
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
18
|
+
async download(url, destination, options) {
|
|
19
|
+
return await options.cancellationToken.createPromise((resolve, reject, onCancel) => {
|
|
20
|
+
const requestOptions = {
|
|
21
|
+
headers: options.headers || undefined,
|
|
22
|
+
redirect: "manual",
|
|
23
|
+
};
|
|
24
|
+
builder_util_runtime_1.configureRequestUrl(url, requestOptions);
|
|
25
|
+
builder_util_runtime_1.configureRequestOptions(requestOptions);
|
|
26
|
+
this.doDownload(requestOptions, {
|
|
27
|
+
destination,
|
|
28
|
+
options,
|
|
29
|
+
onCancel,
|
|
30
|
+
callback: error => {
|
|
31
|
+
if (error == null) {
|
|
32
|
+
resolve(destination);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
reject(error);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
responseHandler: null,
|
|
39
|
+
}, 0);
|
|
40
|
+
});
|
|
91
41
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
42
|
+
createRequest(options, callback) {
|
|
43
|
+
// fix (node 7+) for making electron updater work when using AWS private buckets, check if headers contain Host property
|
|
44
|
+
if (options.headers && options.headers.Host) {
|
|
45
|
+
// set host value from headers.Host
|
|
46
|
+
options.host = options.headers.Host;
|
|
47
|
+
// remove header property 'Host', if not removed causes net::ERR_INVALID_ARGUMENT exception
|
|
48
|
+
delete options.headers.Host;
|
|
49
|
+
}
|
|
50
|
+
// differential downloader can call this method very often, so, better to cache session
|
|
51
|
+
if (this.cachedSession == null) {
|
|
52
|
+
this.cachedSession = getNetSession();
|
|
53
|
+
}
|
|
54
|
+
const request = require("electron").net.request({
|
|
55
|
+
...options,
|
|
56
|
+
session: this.cachedSession,
|
|
57
|
+
});
|
|
58
|
+
request.on("response", callback);
|
|
59
|
+
if (this.proxyLoginCallback != null) {
|
|
60
|
+
request.on("login", this.proxyLoginCallback);
|
|
61
|
+
}
|
|
62
|
+
return request;
|
|
63
|
+
}
|
|
64
|
+
addRedirectHandlers(request, options, reject, redirectCount, handler) {
|
|
65
|
+
request.on("redirect", (statusCode, method, redirectUrl) => {
|
|
66
|
+
// no way to modify request options, abort old and make a new one
|
|
67
|
+
// https://github.com/electron/electron/issues/11505
|
|
68
|
+
request.abort();
|
|
69
|
+
if (redirectCount > this.maxRedirects) {
|
|
70
|
+
reject(this.createMaxRedirectError());
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
handler(builder_util_runtime_1.HttpExecutor.prepareRedirectUrlOptions(redirectUrl, options));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ElectronHttpExecutor = ElectronHttpExecutor;
|
|
112
79
|
//# sourceMappingURL=electronHttpExecutor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/electronHttpExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"electronHttpExecutor.js","sourceRoot":"","sources":["../src/electronHttpExecutor.ts"],"names":[],"mappings":"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","sourcesContent":["import { DownloadOptions, HttpExecutor, configureRequestOptions, configureRequestUrl } from \"builder-util-runtime\"\nimport { RequestOptions } from \"http\"\nimport Session = Electron.Session\nimport ClientRequest = Electron.ClientRequest\n\nexport type LoginCallback = (username: string, password: string) => void\nexport const NET_SESSION_NAME = \"electron-updater\"\n\nexport function getNetSession(): Session {\n return require(\"electron\").session.fromPartition(NET_SESSION_NAME, {\n cache: false,\n })\n}\n\nexport class ElectronHttpExecutor extends HttpExecutor<Electron.ClientRequest> {\n private cachedSession: Session | null = null\n\n constructor(private readonly proxyLoginCallback?: (authInfo: any, callback: LoginCallback) => void) {\n super()\n }\n\n async download(url: URL, destination: string, options: DownloadOptions): Promise<string> {\n return await options.cancellationToken.createPromise<string>((resolve, reject, onCancel) => {\n const requestOptions = {\n headers: options.headers || undefined,\n redirect: \"manual\",\n }\n configureRequestUrl(url, requestOptions)\n configureRequestOptions(requestOptions)\n this.doDownload(\n requestOptions,\n {\n destination,\n options,\n onCancel,\n callback: error => {\n if (error == null) {\n resolve(destination)\n } else {\n reject(error)\n }\n },\n responseHandler: null,\n },\n 0\n )\n })\n }\n\n createRequest(options: any, callback: (response: any) => void): any {\n // fix (node 7+) for making electron updater work when using AWS private buckets, check if headers contain Host property\n if (options.headers && options.headers.Host) {\n // set host value from headers.Host\n options.host = options.headers.Host\n // remove header property 'Host', if not removed causes net::ERR_INVALID_ARGUMENT exception\n delete options.headers.Host\n }\n\n // differential downloader can call this method very often, so, better to cache session\n if (this.cachedSession == null) {\n this.cachedSession = getNetSession()\n }\n\n const request = require(\"electron\").net.request({\n ...options,\n session: this.cachedSession,\n })\n request.on(\"response\", callback)\n if (this.proxyLoginCallback != null) {\n request.on(\"login\", this.proxyLoginCallback)\n }\n return request\n }\n\n protected addRedirectHandlers(\n request: ClientRequest,\n options: RequestOptions,\n reject: (error: Error) => void,\n redirectCount: number,\n handler: (options: RequestOptions) => void\n ): void {\n request.on(\"redirect\", (statusCode: number, method: string, redirectUrl: string) => {\n // no way to modify request options, abort old and make a new one\n // https://github.com/electron/electron/issues/11505\n request.abort()\n\n if (redirectCount > this.maxRedirects) {\n reject(this.createMaxRedirectError())\n } else {\n handler(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, options))\n }\n })\n }\n}\n"]}
|
package/out/event.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { CancellationToken, PackageFileInfo, ProgressInfo, UpdateFileInfo, UpdateInfo } from "builder-util-runtime";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
import { URL } from "url";
|
|
5
|
+
import { LoginCallback } from "./electronHttpExecutor";
|
|
6
|
+
export declare type UpdaterEvents = "login" | "checking-for-update" | "update-available" | "update-cancelled" | "download-progress" | "update-downloaded" | "error";
|
|
7
|
+
export declare const DOWNLOAD_PROGRESS: UpdaterEvents;
|
|
8
|
+
export declare const UPDATE_DOWNLOADED: UpdaterEvents;
|
|
9
|
+
export declare type LoginHandler = (authInfo: any, callback: LoginCallback) => void;
|
|
10
|
+
export declare class UpdaterSignal {
|
|
11
|
+
private emitter;
|
|
12
|
+
constructor(emitter: EventEmitter);
|
|
13
|
+
/**
|
|
14
|
+
* Emitted when an authenticating proxy is [asking for user credentials](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login).
|
|
15
|
+
*/
|
|
16
|
+
login(handler: LoginHandler): void;
|
|
17
|
+
progress(handler: (info: ProgressInfo) => void): void;
|
|
18
|
+
updateDownloaded(handler: (info: UpdateDownloadedEvent) => void): void;
|
|
19
|
+
updateCancelled(handler: (info: UpdateInfo) => void): void;
|
|
20
|
+
}
|
|
21
|
+
export interface UpdateCheckResult {
|
|
22
|
+
readonly updateInfo: UpdateInfo;
|
|
23
|
+
readonly downloadPromise?: Promise<Array<string>> | null;
|
|
24
|
+
readonly cancellationToken?: CancellationToken;
|
|
25
|
+
/** @deprecated */
|
|
26
|
+
readonly versionInfo: UpdateInfo;
|
|
27
|
+
}
|
|
28
|
+
export interface ResolvedUpdateFileInfo {
|
|
29
|
+
readonly url: URL;
|
|
30
|
+
readonly info: UpdateFileInfo;
|
|
31
|
+
packageInfo?: PackageFileInfo;
|
|
32
|
+
}
|
|
33
|
+
export interface UpdateDownloadedEvent extends UpdateInfo {
|
|
34
|
+
downloadedFile: string;
|
|
35
|
+
}
|
package/out/event.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdaterSignal = exports.UPDATE_DOWNLOADED = exports.DOWNLOAD_PROGRESS = void 0;
|
|
4
|
+
exports.DOWNLOAD_PROGRESS = "download-progress";
|
|
5
|
+
exports.UPDATE_DOWNLOADED = "update-downloaded";
|
|
6
|
+
class UpdaterSignal {
|
|
7
|
+
constructor(emitter) {
|
|
8
|
+
this.emitter = emitter;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Emitted when an authenticating proxy is [asking for user credentials](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login).
|
|
12
|
+
*/
|
|
13
|
+
login(handler) {
|
|
14
|
+
addHandler(this.emitter, "login", handler);
|
|
15
|
+
}
|
|
16
|
+
progress(handler) {
|
|
17
|
+
addHandler(this.emitter, exports.DOWNLOAD_PROGRESS, handler);
|
|
18
|
+
}
|
|
19
|
+
updateDownloaded(handler) {
|
|
20
|
+
addHandler(this.emitter, exports.UPDATE_DOWNLOADED, handler);
|
|
21
|
+
}
|
|
22
|
+
updateCancelled(handler) {
|
|
23
|
+
addHandler(this.emitter, "update-cancelled", handler);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.UpdaterSignal = UpdaterSignal;
|
|
27
|
+
const isLogEvent = false;
|
|
28
|
+
function addHandler(emitter, event, handler) {
|
|
29
|
+
if (isLogEvent) {
|
|
30
|
+
emitter.on(event, (...args) => {
|
|
31
|
+
console.log("%s %s", event, args);
|
|
32
|
+
handler(...args);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
emitter.on(event, handler);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=event.js.map
|
package/out/event.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":";;;AAOa,QAAA,iBAAiB,GAAkB,mBAAmB,CAAA;AACtD,QAAA,iBAAiB,GAAkB,mBAAmB,CAAA;AAInE,MAAa,aAAa;IACxB,YAAoB,OAAqB;QAArB,YAAO,GAAP,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;AAED,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 { LoginCallback } from \"./electronHttpExecutor\"\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\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 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 interface ResolvedUpdateFileInfo {\n readonly url: URL\n readonly info: UpdateFileInfo\n\n packageInfo?: PackageFileInfo\n}\n\nexport interface UpdateDownloadedEvent extends UpdateInfo {\n downloadedFile: string\n}\n"]}
|
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,7 +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 };
|
|
8
|
+
export { CancellationToken, PackageFileInfo, ProgressInfo, UpdateFileInfo, UpdateInfo };
|
|
9
9
|
export { Provider } from "./providers/Provider";
|
|
10
10
|
export { AppImageUpdater } from "./AppImageUpdater";
|
|
11
11
|
export { MacUpdater } from "./MacUpdater";
|
|
@@ -16,7 +16,6 @@ export interface ResolvedUpdateFileInfo {
|
|
|
16
16
|
readonly info: UpdateFileInfo;
|
|
17
17
|
packageInfo?: PackageFileInfo;
|
|
18
18
|
}
|
|
19
|
-
export declare function getChannelFilename(channel: string): string;
|
|
20
19
|
export interface UpdateCheckResult {
|
|
21
20
|
readonly updateInfo: UpdateInfo;
|
|
22
21
|
readonly downloadPromise?: Promise<Array<string>> | null;
|
|
@@ -48,4 +47,3 @@ export interface Logger {
|
|
|
48
47
|
error(message?: any): void;
|
|
49
48
|
debug?(message: string): void;
|
|
50
49
|
}
|
|
51
|
-
export declare function newUrlFromBase(pathname: string, baseUrl: URL, addRandomQueryToAvoidCaching?: boolean): URL;
|
package/out/main.js
CHANGED
|
@@ -1,209 +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, "Provider", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _Provider().Provider;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(exports, "AppImageUpdater", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return _AppImageUpdater().AppImageUpdater;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports, "MacUpdater", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return _MacUpdater().MacUpdater;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, "NsisUpdater", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return _NsisUpdater().NsisUpdater;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
exports.UpdaterSignal = exports.UPDATE_DOWNLOADED = exports.DOWNLOAD_PROGRESS = void 0;
|
|
46
|
-
|
|
47
|
-
function _url() {
|
|
48
|
-
const data = require("url");
|
|
49
|
-
|
|
50
|
-
_url = function () {
|
|
51
|
-
return data;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return data;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _AppUpdater() {
|
|
58
|
-
const data = require("./AppUpdater");
|
|
59
|
-
|
|
60
|
-
_AppUpdater = function () {
|
|
61
|
-
return data;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return data;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function _Provider() {
|
|
68
|
-
const data = require("./providers/Provider");
|
|
69
|
-
|
|
70
|
-
_Provider = function () {
|
|
71
|
-
return data;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function _AppImageUpdater() {
|
|
78
|
-
const data = require("./AppImageUpdater");
|
|
79
|
-
|
|
80
|
-
_AppImageUpdater = function () {
|
|
81
|
-
return data;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return data;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function _MacUpdater() {
|
|
88
|
-
const data = require("./MacUpdater");
|
|
89
|
-
|
|
90
|
-
_MacUpdater = function () {
|
|
91
|
-
return data;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
return data;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function _NsisUpdater() {
|
|
98
|
-
const data = require("./NsisUpdater");
|
|
99
|
-
|
|
100
|
-
_NsisUpdater = function () {
|
|
101
|
-
return data;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
return data;
|
|
105
|
-
}
|
|
106
|
-
|
|
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; } });
|
|
107
17
|
// autoUpdater to mimic electron bundled autoUpdater
|
|
108
18
|
let _autoUpdater;
|
|
109
|
-
|
|
110
19
|
function doLoadAutoUpdater() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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;
|
|
121
31
|
}
|
|
122
|
-
|
|
123
32
|
Object.defineProperty(exports, "autoUpdater", {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: () => {
|
|
35
|
+
return _autoUpdater || doLoadAutoUpdater();
|
|
36
|
+
},
|
|
128
37
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return `${channel}.yml`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const DOWNLOAD_PROGRESS = "download-progress";
|
|
135
|
-
exports.DOWNLOAD_PROGRESS = DOWNLOAD_PROGRESS;
|
|
136
|
-
const UPDATE_DOWNLOADED = "update-downloaded";
|
|
137
|
-
exports.UPDATE_DOWNLOADED = UPDATE_DOWNLOADED;
|
|
138
|
-
|
|
38
|
+
exports.DOWNLOAD_PROGRESS = "download-progress";
|
|
39
|
+
exports.UPDATE_DOWNLOADED = "update-downloaded";
|
|
139
40
|
class UpdaterSignal {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
updateCancelled(handler) {
|
|
161
|
-
addHandler(this.emitter, "update-cancelled", handler);
|
|
162
|
-
}
|
|
163
|
-
|
|
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
|
+
}
|
|
164
59
|
}
|
|
165
|
-
|
|
166
60
|
exports.UpdaterSignal = UpdaterSignal;
|
|
167
61
|
const isLogEvent = false;
|
|
168
|
-
|
|
169
62
|
function addHandler(emitter, event, handler) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/** @internal */
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
function newBaseUrl(url) {
|
|
184
|
-
const result = new (_url().URL)(url);
|
|
185
|
-
|
|
186
|
-
if (!result.pathname.endsWith("/")) {
|
|
187
|
-
result.pathname += "/";
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return result;
|
|
191
|
-
} // addRandomQueryToAvoidCaching is false by default because in most cases URL already contains version number,
|
|
192
|
-
// so, it makes sense only for Generic Provider for channel files
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
function newUrlFromBase(pathname, baseUrl, addRandomQueryToAvoidCaching = false) {
|
|
196
|
-
const result = new (_url().URL)(pathname, baseUrl); // search is not propagated (search is an empty string if not specified)
|
|
197
|
-
|
|
198
|
-
const search = baseUrl.search;
|
|
199
|
-
|
|
200
|
-
if (search != null && search.length !== 0) {
|
|
201
|
-
result.search = search;
|
|
202
|
-
} else if (addRandomQueryToAvoidCaching) {
|
|
203
|
-
result.search = `noCache=${Date.now().toString(32)}`;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
208
|
-
// __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
|
+
}
|
|
209
73
|
//# sourceMappingURL=main.js.map
|