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.
Files changed (68) hide show
  1. package/LICENSE +22 -0
  2. package/out/AppAdapter.js +19 -28
  3. package/out/AppAdapter.js.map +1 -1
  4. package/out/AppImageUpdater.js +103 -195
  5. package/out/AppImageUpdater.js.map +1 -1
  6. package/out/AppUpdater.d.ts +1 -1
  7. package/out/AppUpdater.js +517 -771
  8. package/out/AppUpdater.js.map +1 -1
  9. package/out/BaseUpdater.js +79 -103
  10. package/out/BaseUpdater.js.map +1 -1
  11. package/out/DownloadedUpdateHelper.js +150 -223
  12. package/out/DownloadedUpdateHelper.js.map +1 -1
  13. package/out/ElectronAppAdapter.js +35 -63
  14. package/out/ElectronAppAdapter.js.map +1 -1
  15. package/out/MacUpdater.js +132 -201
  16. package/out/MacUpdater.js.map +1 -1
  17. package/out/NoOpLogger.d.ts +6 -0
  18. package/out/NoOpLogger.js +19 -0
  19. package/out/NoOpLogger.js.map +1 -0
  20. package/out/NsisUpdater.js +199 -345
  21. package/out/NsisUpdater.js.map +1 -1
  22. package/out/differentialDownloader/DataSplitter.js +180 -252
  23. package/out/differentialDownloader/DataSplitter.js.map +1 -1
  24. package/out/differentialDownloader/DifferentialDownloader.d.ts +1 -1
  25. package/out/differentialDownloader/DifferentialDownloader.js +242 -355
  26. package/out/differentialDownloader/DifferentialDownloader.js.map +1 -1
  27. package/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js +29 -65
  28. package/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js.map +1 -1
  29. package/out/differentialDownloader/GenericDifferentialDownloader.js +7 -21
  30. package/out/differentialDownloader/GenericDifferentialDownloader.js.map +1 -1
  31. package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js +79 -107
  32. package/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js.map +1 -1
  33. package/out/differentialDownloader/downloadPlanBuilder.js +99 -123
  34. package/out/differentialDownloader/downloadPlanBuilder.js.map +1 -1
  35. package/out/differentialDownloader/multipleRangeDownloader.js +99 -148
  36. package/out/differentialDownloader/multipleRangeDownloader.js.map +1 -1
  37. package/out/electronHttpExecutor.js +73 -106
  38. package/out/electronHttpExecutor.js.map +1 -1
  39. package/out/event.d.ts +35 -0
  40. package/out/event.js +39 -0
  41. package/out/event.js.map +1 -0
  42. package/out/log.d.ts +11 -0
  43. package/out/log.js +19 -0
  44. package/out/log.js.map +1 -0
  45. package/out/main.d.ts +1 -3
  46. package/out/main.js +60 -196
  47. package/out/main.js.map +1 -1
  48. package/out/providerFactory.js +49 -105
  49. package/out/providerFactory.js.map +1 -1
  50. package/out/providers/BintrayProvider.d.ts +2 -2
  51. package/out/providers/BintrayProvider.js +40 -95
  52. package/out/providers/BintrayProvider.js.map +1 -1
  53. package/out/providers/GenericProvider.d.ts +2 -2
  54. package/out/providers/GenericProvider.js +46 -80
  55. package/out/providers/GenericProvider.js.map +1 -1
  56. package/out/providers/GitHubProvider.d.ts +2 -2
  57. package/out/providers/GitHubProvider.js +122 -201
  58. package/out/providers/GitHubProvider.js.map +1 -1
  59. package/out/providers/PrivateGitHubProvider.js +87 -165
  60. package/out/providers/PrivateGitHubProvider.js.map +1 -1
  61. package/out/providers/Provider.js +122 -173
  62. package/out/providers/Provider.js.map +1 -1
  63. package/out/util.d.ts +5 -0
  64. package/out/util.js +42 -0
  65. package/out/util.js.map +1 -0
  66. package/out/windowsExecutableCodeSignatureVerifier.js +99 -139
  67. package/out/windowsExecutableCodeSignatureVerifier.js.map +1 -1
  68. package/package.json +33 -31
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Loopline Systems
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/out/AppAdapter.js CHANGED
@@ -1,31 +1,22 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getAppCacheDir = getAppCacheDir;
7
-
8
- var path = _interopRequireWildcard(require("path"));
9
-
10
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11
-
12
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppCacheDir = void 0;
4
+ const path = require("path");
5
+ const os_1 = require("os");
14
6
  function getAppCacheDir() {
15
- const homedir = require("os").homedir(); // https://github.com/electron/electron/issues/1404#issuecomment-194391247
16
-
17
-
18
- let result;
19
-
20
- if (process.platform === "win32") {
21
- result = process.env.LOCALAPPDATA || path.join(homedir, "AppData", "Local");
22
- } else if (process.platform === "darwin") {
23
- result = path.join(homedir, "Library", "Application Support", "Caches");
24
- } else {
25
- result = process.env.XDG_CACHE_HOME || path.join(homedir, ".cache");
26
- }
27
-
28
- return result;
29
- }
30
- // __ts-babel@6.0.4
7
+ const homedir = os_1.homedir();
8
+ // https://github.com/electron/electron/issues/1404#issuecomment-194391247
9
+ let result;
10
+ if (process.platform === "win32") {
11
+ result = process.env.LOCALAPPDATA || path.join(homedir, "AppData", "Local");
12
+ }
13
+ else if (process.platform === "darwin") {
14
+ result = path.join(homedir, "Library", "Application Support", "Caches");
15
+ }
16
+ else {
17
+ result = process.env.XDG_CACHE_HOME || path.join(homedir, ".cache");
18
+ }
19
+ return result;
20
+ }
21
+ exports.getAppCacheDir = getAppCacheDir;
31
22
  //# sourceMappingURL=AppAdapter.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/AppAdapter.ts"],"names":[],"mappings":";;;;;;;AAAA;;;;;;AA8BM,SAAU,cAAV,GAAwB;AAC5B,QAAM,OAAO,GAAG,OAAO,CAAC,IAAD,CAAP,CAAc,OAAd,EAAhB,CAD4B,CAE5B;;;AACA,MAAI,MAAJ;;AACA,MAAI,OAAO,CAAC,QAAR,KAAqB,OAAzB,EAAkC;AAChC,IAAA,MAAM,GAAG,OAAO,CAAC,GAAR,CAAY,YAAZ,IAA4B,IAAI,CAAC,IAAL,CAAU,OAAV,EAAmB,SAAnB,EAA8B,OAA9B,CAArC;AACD,GAFD,MAGK,IAAI,OAAO,CAAC,QAAR,KAAqB,QAAzB,EAAmC;AACtC,IAAA,MAAM,GAAG,IAAI,CAAC,IAAL,CAAU,OAAV,EAAmB,SAAnB,EAA8B,qBAA9B,EAAqD,QAArD,CAAT;AACD,GAFI,MAGA;AACH,IAAA,MAAM,GAAG,OAAO,CAAC,GAAR,CAAY,cAAZ,IAA8B,IAAI,CAAC,IAAL,CAAU,OAAV,EAAmB,QAAnB,CAAvC;AACD;;AACD,SAAO,MAAP;AACD,C","sourcesContent":["import * as path from \"path\"\n\nexport interface AppAdapter {\n readonly version: string\n readonly name: string\n\n readonly isPackaged: boolean\n\n /**\n * Path to update metadata file.\n */\n readonly appUpdateConfigPath: string\n\n /**\n * Path to user data directory.\n */\n readonly userDataPath: string\n\n /**\n * Path to cache directory.\n */\n readonly baseCachePath: string\n\n whenReady(): Promise<void>\n\n quit(): void\n\n onQuit(handler: (exitCode: number) => void): void\n}\n\nexport function getAppCacheDir() {\n const homedir = require(\"os\").homedir()\n // https://github.com/electron/electron/issues/1404#issuecomment-194391247\n let result: string\n if (process.platform === \"win32\") {\n result = process.env.LOCALAPPDATA || path.join(homedir, \"AppData\", \"Local\")\n }\n else if (process.platform === \"darwin\") {\n result = path.join(homedir, \"Library\", \"Application Support\", \"Caches\")\n }\n else {\n result = process.env.XDG_CACHE_HOME || path.join(homedir, \".cache\")\n }\n return result\n}"],"sourceRoot":""}
1
+ {"version":3,"file":"AppAdapter.js","sourceRoot":"","sources":["../src/AppAdapter.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAC5B,2BAA0C;AA8B1C,SAAgB,cAAc;IAC5B,MAAM,OAAO,GAAG,YAAU,EAAE,CAAA;IAC5B,0EAA0E;IAC1E,IAAI,MAAc,CAAA;IAClB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;KAC5E;SAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACxC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAA;KACxE;SAAM;QACL,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;KACpE;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAZD,wCAYC","sourcesContent":["import * as path from \"path\"\nimport { homedir as getHomedir } from \"os\"\n\nexport interface AppAdapter {\n readonly version: string\n readonly name: string\n\n readonly isPackaged: boolean\n\n /**\n * Path to update metadata file.\n */\n readonly appUpdateConfigPath: string\n\n /**\n * Path to user data directory.\n */\n readonly userDataPath: string\n\n /**\n * Path to cache directory.\n */\n readonly baseCachePath: string\n\n whenReady(): Promise<void>\n\n quit(): void\n\n onQuit(handler: (exitCode: number) => void): void\n}\n\nexport function getAppCacheDir() {\n const homedir = getHomedir()\n // https://github.com/electron/electron/issues/1404#issuecomment-194391247\n let result: string\n if (process.platform === \"win32\") {\n result = process.env.LOCALAPPDATA || path.join(homedir, \"AppData\", \"Local\")\n } else if (process.platform === \"darwin\") {\n result = path.join(homedir, \"Library\", \"Application Support\", \"Caches\")\n } else {\n result = process.env.XDG_CACHE_HOME || path.join(homedir, \".cache\")\n }\n return result\n}\n"]}
@@ -1,203 +1,111 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.AppImageUpdater = void 0;
7
-
8
- function _builderUtilRuntime() {
9
- const data = require("builder-util-runtime");
10
-
11
- _builderUtilRuntime = function () {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
- function _child_process() {
19
- const data = require("child_process");
20
-
21
- _child_process = function () {
22
- return data;
23
- };
24
-
25
- return data;
26
- }
27
-
28
- function _fsExtra() {
29
- const data = require("fs-extra");
30
-
31
- _fsExtra = function () {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- var _fs = require("fs");
39
-
40
- var path = _interopRequireWildcard(require("path"));
41
-
42
- function _BaseUpdater() {
43
- const data = require("./BaseUpdater");
44
-
45
- _BaseUpdater = function () {
46
- return data;
47
- };
48
-
49
- return data;
50
- }
51
-
52
- function _FileWithEmbeddedBlockMapDifferentialDownloader() {
53
- const data = require("./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader");
54
-
55
- _FileWithEmbeddedBlockMapDifferentialDownloader = function () {
56
- return data;
57
- };
58
-
59
- return data;
60
- }
61
-
62
- function _main() {
63
- const data = require("./main");
64
-
65
- _main = function () {
66
- return data;
67
- };
68
-
69
- return data;
70
- }
71
-
72
- function _Provider() {
73
- const data = require("./providers/Provider");
74
-
75
- _Provider = function () {
76
- return data;
77
- };
78
-
79
- return data;
80
- }
81
-
82
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
83
-
84
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
85
-
86
- class AppImageUpdater extends _BaseUpdater().BaseUpdater {
87
- constructor(options, app) {
88
- super(options, app);
89
- }
90
-
91
- isUpdaterActive() {
92
- if (process.env.APPIMAGE == null) {
93
- if (process.env.SNAP == null) {
94
- this._logger.warn("APPIMAGE env is not defined, current application is not an AppImage");
95
- } else {
96
- this._logger.info("SNAP env is defined, updater is disabled");
97
- }
98
-
99
- return false;
4
+ const builder_util_runtime_1 = require("builder-util-runtime");
5
+ const child_process_1 = require("child_process");
6
+ const fs_extra_1 = require("fs-extra");
7
+ const fs_1 = require("fs");
8
+ const path = require("path");
9
+ const BaseUpdater_1 = require("./BaseUpdater");
10
+ const FileWithEmbeddedBlockMapDifferentialDownloader_1 = require("./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader");
11
+ const main_1 = require("./main");
12
+ const Provider_1 = require("./providers/Provider");
13
+ class AppImageUpdater extends BaseUpdater_1.BaseUpdater {
14
+ constructor(options, app) {
15
+ super(options, app);
100
16
  }
101
-
102
- return super.isUpdaterActive();
103
- }
104
- /*** @private */
105
-
106
-
107
- doDownloadUpdate(downloadUpdateOptions) {
108
- const provider = downloadUpdateOptions.updateInfoAndProvider.provider;
109
- const fileInfo = (0, _Provider().findFile)(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), "AppImage");
110
- return this.executeDownload({
111
- fileExtension: "AppImage",
112
- fileInfo,
113
- downloadUpdateOptions,
114
- task: async (updateFile, downloadOptions) => {
115
- const oldFile = process.env.APPIMAGE;
116
-
117
- if (oldFile == null) {
118
- throw (0, _builderUtilRuntime().newError)("APPIMAGE env is not defined", "ERR_UPDATER_OLD_FILE_NOT_FOUND");
119
- }
120
-
121
- let isDownloadFull = false;
122
-
123
- try {
124
- const downloadOptions = {
125
- newUrl: fileInfo.url,
126
- oldFile,
127
- logger: this._logger,
128
- newFile: updateFile,
129
- isUseMultipleRangeRequest: provider.isUseMultipleRangeRequest,
130
- requestHeaders: downloadUpdateOptions.requestHeaders,
131
- cancellationToken: downloadUpdateOptions.cancellationToken
132
- };
133
-
134
- if (this.listenerCount(_main().DOWNLOAD_PROGRESS) > 0) {
135
- downloadOptions.onProgress = it => this.emit(_main().DOWNLOAD_PROGRESS, it);
136
- }
137
-
138
- await new (_FileWithEmbeddedBlockMapDifferentialDownloader().FileWithEmbeddedBlockMapDifferentialDownloader)(fileInfo.info, this.httpExecutor, downloadOptions).download();
139
- } catch (e) {
140
- this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`); // during test (developer machine mac) we must throw error
141
-
142
-
143
- isDownloadFull = process.platform === "linux";
17
+ isUpdaterActive() {
18
+ if (process.env.APPIMAGE == null) {
19
+ if (process.env.SNAP == null) {
20
+ this._logger.warn("APPIMAGE env is not defined, current application is not an AppImage");
21
+ }
22
+ else {
23
+ this._logger.info("SNAP env is defined, updater is disabled");
24
+ }
25
+ return false;
144
26
  }
145
-
146
- if (isDownloadFull) {
147
- await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions);
148
- }
149
-
150
- await (0, _fsExtra().chmod)(updateFile, 0o755);
151
- }
152
- });
153
- }
154
-
155
- doInstall(options) {
156
- const appImageFile = process.env.APPIMAGE;
157
-
158
- if (appImageFile == null) {
159
- throw (0, _builderUtilRuntime().newError)("APPIMAGE env is not defined", "ERR_UPDATER_OLD_FILE_NOT_FOUND");
160
- } // https://stackoverflow.com/a/1712051/1910191
161
-
162
-
163
- (0, _fs.unlinkSync)(appImageFile);
164
- let destination;
165
- const existingBaseName = path.basename(appImageFile); // https://github.com/electron-userland/electron-builder/issues/2964
166
- // if no version in existing file name, it means that user wants to preserve current custom name
167
-
168
- if (path.basename(options.installerPath) === existingBaseName || !/\d+\.\d+\.\d+/.test(existingBaseName)) {
169
- // no version in the file name, overwrite existing
170
- destination = appImageFile;
171
- } else {
172
- destination = path.join(path.dirname(appImageFile), path.basename(options.installerPath));
27
+ return super.isUpdaterActive();
173
28
  }
174
-
175
- (0, _child_process().execFileSync)("mv", ["-f", options.installerPath, destination]);
176
-
177
- if (destination !== appImageFile) {
178
- this.emit('appimage-filename-updated', destination);
29
+ /*** @private */
30
+ doDownloadUpdate(downloadUpdateOptions) {
31
+ const provider = downloadUpdateOptions.updateInfoAndProvider.provider;
32
+ const fileInfo = Provider_1.findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), "AppImage");
33
+ return this.executeDownload({
34
+ fileExtension: "AppImage",
35
+ fileInfo,
36
+ downloadUpdateOptions,
37
+ task: async (updateFile, downloadOptions) => {
38
+ const oldFile = process.env.APPIMAGE;
39
+ if (oldFile == null) {
40
+ throw builder_util_runtime_1.newError("APPIMAGE env is not defined", "ERR_UPDATER_OLD_FILE_NOT_FOUND");
41
+ }
42
+ let isDownloadFull = false;
43
+ try {
44
+ const downloadOptions = {
45
+ newUrl: fileInfo.url,
46
+ oldFile,
47
+ logger: this._logger,
48
+ newFile: updateFile,
49
+ isUseMultipleRangeRequest: provider.isUseMultipleRangeRequest,
50
+ requestHeaders: downloadUpdateOptions.requestHeaders,
51
+ cancellationToken: downloadUpdateOptions.cancellationToken,
52
+ };
53
+ if (this.listenerCount(main_1.DOWNLOAD_PROGRESS) > 0) {
54
+ downloadOptions.onProgress = it => this.emit(main_1.DOWNLOAD_PROGRESS, it);
55
+ }
56
+ await new FileWithEmbeddedBlockMapDifferentialDownloader_1.FileWithEmbeddedBlockMapDifferentialDownloader(fileInfo.info, this.httpExecutor, downloadOptions).download();
57
+ }
58
+ catch (e) {
59
+ this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`);
60
+ // during test (developer machine mac) we must throw error
61
+ isDownloadFull = process.platform === "linux";
62
+ }
63
+ if (isDownloadFull) {
64
+ await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions);
65
+ }
66
+ await fs_extra_1.chmod(updateFile, 0o755);
67
+ },
68
+ });
179
69
  }
180
-
181
- const env = { ...process.env,
182
- APPIMAGE_SILENT_INSTALL: "true"
183
- };
184
-
185
- if (options.isForceRunAfter) {
186
- (0, _child_process().spawn)(destination, [], {
187
- detached: true,
188
- stdio: "ignore",
189
- env
190
- }).unref();
191
- } else {
192
- env.APPIMAGE_EXIT_AFTER_INSTALL = "true";
193
- (0, _child_process().execFileSync)(destination, [], {
194
- env
195
- });
70
+ doInstall(options) {
71
+ const appImageFile = process.env.APPIMAGE;
72
+ if (appImageFile == null) {
73
+ throw builder_util_runtime_1.newError("APPIMAGE env is not defined", "ERR_UPDATER_OLD_FILE_NOT_FOUND");
74
+ }
75
+ // https://stackoverflow.com/a/1712051/1910191
76
+ fs_1.unlinkSync(appImageFile);
77
+ let destination;
78
+ const existingBaseName = path.basename(appImageFile);
79
+ // https://github.com/electron-userland/electron-builder/issues/2964
80
+ // if no version in existing file name, it means that user wants to preserve current custom name
81
+ if (path.basename(options.installerPath) === existingBaseName || !/\d+\.\d+\.\d+/.test(existingBaseName)) {
82
+ // no version in the file name, overwrite existing
83
+ destination = appImageFile;
84
+ }
85
+ else {
86
+ destination = path.join(path.dirname(appImageFile), path.basename(options.installerPath));
87
+ }
88
+ child_process_1.execFileSync("mv", ["-f", options.installerPath, destination]);
89
+ if (destination !== appImageFile) {
90
+ this.emit("appimage-filename-updated", destination);
91
+ }
92
+ const env = {
93
+ ...process.env,
94
+ APPIMAGE_SILENT_INSTALL: "true",
95
+ };
96
+ if (options.isForceRunAfter) {
97
+ child_process_1.spawn(destination, [], {
98
+ detached: true,
99
+ stdio: "ignore",
100
+ env,
101
+ }).unref();
102
+ }
103
+ else {
104
+ env.APPIMAGE_EXIT_AFTER_INSTALL = "true";
105
+ child_process_1.execFileSync(destination, [], { env });
106
+ }
107
+ return true;
196
108
  }
197
-
198
- return true;
199
- }
200
-
201
- } exports.AppImageUpdater = AppImageUpdater;
202
- // __ts-babel@6.0.4
109
+ }
110
+ exports.AppImageUpdater = AppImageUpdater;
203
111
  //# sourceMappingURL=AppImageUpdater.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AACA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAE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AWzC;AACA;;AACA,QAAI,IAAI,CAAC,QAAL,CAAc,OAAO,CAAC,aAAtB,MAAyC,gBAAzC,IAA6D,CAAC,gBAAgB,IAAhB,CAAqB,gBAArB,CAAlE,EAA0G;AACxG;AACA,MAAA,WAAW,GAAG,YAAd;AACD,KAHD,MAIK;AACH,MAAA,WAAW,GAAG,IAAI,CAAC,IAAL,CAAU,IAAI,CAAC,OAAL,CAAa,YAAb,CAAV,EAAsC,IAAI,CAAC,QAAL,CAAc,OAAO,CAAC,aAAtB,CAAtC,CAAd;AACD;;AAED,uCAAa,IAAb,EAAmB,CAAC,IAAD,EAAO,OAAO,CAAC,aAAf,EAA8B,WAA9B,CAAnB;;AACA,QAAI,WAAW,KAAK,YAApB,EAAkC;AAChC,WAAK,IAAL,CAAU,2BAAV,EAAuC,WAAvC;AACD;;AAED,UAAM,GAAG,GAAQ,EACf,GAAG,OAAO,CAAC,GADI;AAEf,MAAA,uBAAuB,EAAE;AAFV,KAAjB;;AAKA,QAAI,OAAO,CAAC,eAAZ,EAA6B;AAC3B,kCAAM,WAAN,EAAmB,EAAnB,EAAuB;AACrB,QAAA,QAAQ,EAAE,IADW;AAErB,QAAA,KAAK,EAAE,QAFc;AAGrB,QAAA;AAHqB,OAAvB,EAKG,KALH;AAMD,KAPD,MAQK;AACH,MAAA,GAAG,CAAC,2BAAJ,GAAkC,MAAlC;AACA,yCAAa,WAAb,EAA0B,EAA1B,EAA8B;AAAC,QAAA;AAAD,OAA9B;AACD;;AACD,WAAO,IAAP;AACD;;AA9G6C,C","sourcesContent":["import { AllPublishOptions, newError } from \"builder-util-runtime\"\nimport { execFileSync, spawn } from \"child_process\"\nimport { chmod } from \"fs-extra\"\nimport { unlinkSync } from \"fs\"\nimport * as path from \"path\"\nimport { DownloadUpdateOptions } from \"./AppUpdater\"\nimport { BaseUpdater, InstallOptions } from \"./BaseUpdater\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader\"\nimport { FileWithEmbeddedBlockMapDifferentialDownloader } from \"./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader\"\nimport { DOWNLOAD_PROGRESS } from \"./main\"\nimport { findFile } from \"./providers/Provider\"\n\nexport class AppImageUpdater extends BaseUpdater {\n constructor(options?: AllPublishOptions | null, app?: any) {\n super(options, app)\n }\n\n public isUpdaterActive(): boolean {\n if (process.env.APPIMAGE == null) {\n if (process.env.SNAP == null) {\n this._logger.warn(\"APPIMAGE env is not defined, current application is not an AppImage\")\n }\n else {\n this._logger.info(\"SNAP env is defined, updater is disabled\")\n }\n return false\n }\n return super.isUpdaterActive()\n }\n\n /*** @private */\n protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>> {\n const provider = downloadUpdateOptions.updateInfoAndProvider.provider\n const fileInfo = findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), \"AppImage\")!!\n return this.executeDownload({\n fileExtension: \"AppImage\",\n fileInfo,\n downloadUpdateOptions,\n task: async (updateFile, downloadOptions) => {\n const oldFile = process.env.APPIMAGE!!\n if (oldFile == null) {\n throw newError(\"APPIMAGE env is not defined\", \"ERR_UPDATER_OLD_FILE_NOT_FOUND\")\n }\n\n let isDownloadFull = false\n try {\n const downloadOptions: DifferentialDownloaderOptions = {\n newUrl: fileInfo.url,\n oldFile,\n logger: this._logger,\n newFile: updateFile,\n isUseMultipleRangeRequest: provider.isUseMultipleRangeRequest,\n requestHeaders: downloadUpdateOptions.requestHeaders,\n cancellationToken: downloadUpdateOptions.cancellationToken,\n }\n\n if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) {\n downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it)\n }\n\n await new FileWithEmbeddedBlockMapDifferentialDownloader(fileInfo.info, this.httpExecutor, downloadOptions)\n .download()\n }\n catch (e) {\n this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`)\n // during test (developer machine mac) we must throw error\n isDownloadFull = process.platform === \"linux\"\n }\n\n if (isDownloadFull) {\n await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)\n }\n\n await chmod(updateFile, 0o755)\n },\n })\n }\n\n protected doInstall(options: InstallOptions): boolean {\n const appImageFile = process.env.APPIMAGE!!\n if (appImageFile == null) {\n throw newError(\"APPIMAGE env is not defined\", \"ERR_UPDATER_OLD_FILE_NOT_FOUND\")\n }\n\n // https://stackoverflow.com/a/1712051/1910191\n unlinkSync(appImageFile)\n\n let destination: string\n const existingBaseName = path.basename(appImageFile)\n // https://github.com/electron-userland/electron-builder/issues/2964\n // if no version in existing file name, it means that user wants to preserve current custom name\n if (path.basename(options.installerPath) === existingBaseName || !/\\d+\\.\\d+\\.\\d+/.test(existingBaseName)) {\n // no version in the file name, overwrite existing\n destination = appImageFile\n }\n else {\n destination = path.join(path.dirname(appImageFile), path.basename(options.installerPath))\n }\n\n execFileSync(\"mv\", [\"-f\", options.installerPath, destination])\n if (destination !== appImageFile) {\n this.emit('appimage-filename-updated', destination)\n }\n\n const env: any = {\n ...process.env,\n APPIMAGE_SILENT_INSTALL: \"true\",\n }\n\n if (options.isForceRunAfter) {\n spawn(destination, [], {\n detached: true,\n stdio: \"ignore\",\n env,\n })\n .unref()\n }\n else {\n env.APPIMAGE_EXIT_AFTER_INSTALL = \"true\"\n execFileSync(destination, [], {env})\n }\n return true\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"file":"AppImageUpdater.js","sourceRoot":"","sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAClE,iDAAmD;AACnD,uCAAgC;AAChC,2BAA+B;AAC/B,6BAA4B;AAE5B,+CAA2D;AAE3D,4IAAwI;AACxI,iCAA0C;AAC1C,mDAA+C;AAE/C,MAAa,eAAgB,SAAQ,yBAAW;IAC9C,YAAY,OAAkC,EAAE,GAAS;QACvD,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACrB,CAAC;IAEM,eAAe;QACpB,IAAI,OAAO,CAAC,GAAG,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G,kDAAkD;YAClD,WAAW,GAAG,YAAY,CAAA;SAC3B;aAAM;YACL,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;SAC1F;QAED,4BAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;QAC9D,IAAI,WAAW,KAAK,YAAY,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAA;SACpD;QAED,MAAM,GAAG,GAAQ;YACf,GAAG,OAAO,CAAC,GAAG;YACd,uBAAuB,EAAE,MAAM;SAChC,CAAA;QAED,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,qBAAK,CAAC,WAAW,EAAE,EAAE,EAAE;gBACrB,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,QAAQ;gBACf,GAAG;aACJ,CAAC,CAAC,KAAK,EAAE,CAAA;SACX;aAAM;YACL,GAAG,CAAC,2BAA2B,GAAG,MAAM,CAAA;YACxC,4BAAY,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;SACvC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAzGD,0CAyGC","sourcesContent":["import { AllPublishOptions, newError } from \"builder-util-runtime\"\nimport { execFileSync, spawn } from \"child_process\"\nimport { chmod } from \"fs-extra\"\nimport { unlinkSync } from \"fs\"\nimport * as path from \"path\"\nimport { DownloadUpdateOptions } from \"./AppUpdater\"\nimport { BaseUpdater, InstallOptions } from \"./BaseUpdater\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader\"\nimport { FileWithEmbeddedBlockMapDifferentialDownloader } from \"./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader\"\nimport { DOWNLOAD_PROGRESS } from \"./main\"\nimport { findFile } from \"./providers/Provider\"\n\nexport class AppImageUpdater extends BaseUpdater {\n constructor(options?: AllPublishOptions | null, app?: any) {\n super(options, app)\n }\n\n public isUpdaterActive(): boolean {\n if (process.env.APPIMAGE == null) {\n if (process.env.SNAP == null) {\n this._logger.warn(\"APPIMAGE env is not defined, current application is not an AppImage\")\n } else {\n this._logger.info(\"SNAP env is defined, updater is disabled\")\n }\n return false\n }\n return super.isUpdaterActive()\n }\n\n /*** @private */\n protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>> {\n const provider = downloadUpdateOptions.updateInfoAndProvider.provider\n const fileInfo = findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), \"AppImage\")!\n return this.executeDownload({\n fileExtension: \"AppImage\",\n fileInfo,\n downloadUpdateOptions,\n task: async (updateFile, downloadOptions) => {\n const oldFile = process.env.APPIMAGE!\n if (oldFile == null) {\n throw newError(\"APPIMAGE env is not defined\", \"ERR_UPDATER_OLD_FILE_NOT_FOUND\")\n }\n\n let isDownloadFull = false\n try {\n const downloadOptions: DifferentialDownloaderOptions = {\n newUrl: fileInfo.url,\n oldFile,\n logger: this._logger,\n newFile: updateFile,\n isUseMultipleRangeRequest: provider.isUseMultipleRangeRequest,\n requestHeaders: downloadUpdateOptions.requestHeaders,\n cancellationToken: downloadUpdateOptions.cancellationToken,\n }\n\n if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) {\n downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it)\n }\n\n await new FileWithEmbeddedBlockMapDifferentialDownloader(fileInfo.info, this.httpExecutor, downloadOptions).download()\n } catch (e) {\n this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`)\n // during test (developer machine mac) we must throw error\n isDownloadFull = process.platform === \"linux\"\n }\n\n if (isDownloadFull) {\n await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)\n }\n\n await chmod(updateFile, 0o755)\n },\n })\n }\n\n protected doInstall(options: InstallOptions): boolean {\n const appImageFile = process.env.APPIMAGE!\n if (appImageFile == null) {\n throw newError(\"APPIMAGE env is not defined\", \"ERR_UPDATER_OLD_FILE_NOT_FOUND\")\n }\n\n // https://stackoverflow.com/a/1712051/1910191\n unlinkSync(appImageFile)\n\n let destination: string\n const existingBaseName = path.basename(appImageFile)\n // https://github.com/electron-userland/electron-builder/issues/2964\n // if no version in existing file name, it means that user wants to preserve current custom name\n if (path.basename(options.installerPath) === existingBaseName || !/\\d+\\.\\d+\\.\\d+/.test(existingBaseName)) {\n // no version in the file name, overwrite existing\n destination = appImageFile\n } else {\n destination = path.join(path.dirname(appImageFile), path.basename(options.installerPath))\n }\n\n execFileSync(\"mv\", [\"-f\", options.installerPath, destination])\n if (destination !== appImageFile) {\n this.emit(\"appimage-filename-updated\", destination)\n }\n\n const env: any = {\n ...process.env,\n APPIMAGE_SILENT_INSTALL: \"true\",\n }\n\n if (options.isForceRunAfter) {\n spawn(destination, [], {\n detached: true,\n stdio: \"ignore\",\n env,\n }).unref()\n } else {\n env.APPIMAGE_EXIT_AFTER_INSTALL = \"true\"\n execFileSync(destination, [], { env })\n }\n return true\n }\n}\n"]}
@@ -93,7 +93,7 @@ export declare abstract class AppUpdater extends EventEmitter {
93
93
  checkForUpdates(): Promise<UpdateCheckResult>;
94
94
  isUpdaterActive(): boolean;
95
95
  checkForUpdatesAndNotify(downloadNotification?: DownloadNotification): Promise<UpdateCheckResult | null>;
96
- private formatDownloadNotification;
96
+ private static formatDownloadNotification;
97
97
  private isStagingMatch;
98
98
  private computeFinalHeaders;
99
99
  private isUpdateAvailable;