electron-updater 6.8.9 → 6.8.10

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.
@@ -1,11 +1,11 @@
1
1
  import { AllPublishOptions } from "builder-util-runtime";
2
- import { DownloadUpdateOptions } from "./AppUpdater";
2
+ import { DownloadExecutorResult, DownloadUpdateOptions } from "./AppUpdater";
3
3
  import { BaseUpdater, InstallOptions } from "./BaseUpdater";
4
4
  export declare class AppImageUpdater extends BaseUpdater {
5
5
  constructor(options?: AllPublishOptions | null, app?: any);
6
6
  isUpdaterActive(): boolean;
7
7
  /*** @private */
8
- protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>>;
8
+ protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<DownloadExecutorResult>;
9
9
  private downloadDifferential;
10
10
  protected doInstall(options: InstallOptions): boolean;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppImageUpdater.js","sourceRoot":"","sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAClE,iDAA4C;AAC5C,uCAAgC;AAChC,2BAA+B;AAC/B,6BAA4B;AAE5B,+CAA2D;AAE3D,4IAAwI;AACxI,mDAAyD;AACzD,mCAAmE;AAEnE,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,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAClE,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAA;YAC1F,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,OAA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aAAM,CAAC;YACN,GAAG,CAAC,2BAA2B,GAAG,MAAM,CAAA;YACxC,IAAA,4BAAY,EAAC,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QACxC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhHD,0CAgHC","sourcesContent":["import { AllPublishOptions, newError } from \"builder-util-runtime\"\nimport { execFileSync } 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 { findFile, Provider } from \"./providers/Provider\"\nimport { DOWNLOAD_PROGRESS, ResolvedUpdateFileInfo } from \"./types\"\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 && !this.forceDevUpdateConfig) {\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\", [\"rpm\", \"deb\", \"pacman\"])!\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 if (downloadUpdateOptions.disableDifferentialDownload || (await this.downloadDifferential(fileInfo, oldFile, updateFile, provider, downloadUpdateOptions))) {\n await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)\n }\n\n await chmod(updateFile, 0o755)\n },\n })\n }\n\n private async downloadDifferential(fileInfo: ResolvedUpdateFileInfo, oldFile: string, updateFile: string, provider: Provider<any>, downloadUpdateOptions: DownloadUpdateOptions) {\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 return false\n } catch (e: any) {\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 return process.platform === \"linux\"\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 if (!path.isAbsolute(appImageFile) || appImageFile.includes(\"\\0\")) {\n throw newError(`APPIMAGE env is not a valid absolute path: \"${appImageFile}\"`, \"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 const installerPath = this.installerPath\n if (installerPath == null) {\n this.dispatchError(new Error(\"No update filepath provided, can't quit and install\"))\n return false\n }\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(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(installerPath))\n }\n\n execFileSync(\"mv\", [\"-f\", installerPath, destination])\n if (destination !== appImageFile) {\n this.emit(\"appimage-filename-updated\", destination)\n }\n\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n APPIMAGE_SILENT_INSTALL: \"true\",\n }\n\n if (options.isForceRunAfter) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.spawnLog(destination, [], env)\n } else {\n env.APPIMAGE_EXIT_AFTER_INSTALL = \"true\"\n execFileSync(destination, [], { env })\n }\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"AppImageUpdater.js","sourceRoot":"","sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAClE,iDAA4C;AAC5C,uCAAgC;AAChC,2BAA+B;AAC/B,6BAA4B;AAE5B,+CAA2D;AAE3D,4IAAwI;AACxI,mDAAyD;AACzD,mCAAmE;AAEnE,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,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAClE,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAA;YAC1F,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAA;YAC/D,CAAC;YACD,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C,IAAA,4BAAY,EAAC,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QACxC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhHD,0CAgHC","sourcesContent":["import { AllPublishOptions, newError } from \"builder-util-runtime\"\nimport { execFileSync } from \"child_process\"\nimport { chmod } from \"fs-extra\"\nimport { unlinkSync } from \"fs\"\nimport * as path from \"path\"\nimport { DownloadExecutorResult, DownloadUpdateOptions } from \"./AppUpdater\"\nimport { BaseUpdater, InstallOptions } from \"./BaseUpdater\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader\"\nimport { FileWithEmbeddedBlockMapDifferentialDownloader } from \"./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader\"\nimport { findFile, Provider } from \"./providers/Provider\"\nimport { DOWNLOAD_PROGRESS, ResolvedUpdateFileInfo } from \"./types\"\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 && !this.forceDevUpdateConfig) {\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<DownloadExecutorResult> {\n const provider = downloadUpdateOptions.updateInfoAndProvider.provider\n const fileInfo = findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), \"AppImage\", [\"rpm\", \"deb\", \"pacman\"])!\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 if (downloadUpdateOptions.disableDifferentialDownload || (await this.downloadDifferential(fileInfo, oldFile, updateFile, provider, downloadUpdateOptions))) {\n await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)\n }\n\n await chmod(updateFile, 0o755)\n },\n })\n }\n\n private async downloadDifferential(fileInfo: ResolvedUpdateFileInfo, oldFile: string, updateFile: string, provider: Provider<any>, downloadUpdateOptions: DownloadUpdateOptions) {\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 return false\n } catch (e: any) {\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 return process.platform === \"linux\"\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 if (!path.isAbsolute(appImageFile) || appImageFile.includes(\"\\0\")) {\n throw newError(`APPIMAGE env is not a valid absolute path: \"${appImageFile}\"`, \"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 const installerPath = this.installerPath\n if (installerPath == null) {\n this.dispatchError(new Error(\"No update filepath provided, can't quit and install\"))\n return false\n }\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(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(installerPath))\n }\n\n execFileSync(\"mv\", [\"-f\", installerPath, destination])\n if (destination !== appImageFile) {\n this.emit(\"appimage-filename-updated\", destination)\n }\n\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n APPIMAGE_SILENT_INSTALL: \"true\",\n }\n\n if (options.isForceRunAfter) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.spawnLog(destination, [], env)\n } else {\n env.APPIMAGE_EXIT_AFTER_INSTALL = \"true\"\n execFileSync(destination, [], { env })\n }\n return true\n }\n}\n"]}
@@ -185,7 +185,7 @@ export declare abstract class AppUpdater extends AppUpdater_base {
185
185
  downloadUpdate(cancellationToken?: CancellationToken): Promise<Array<string>>;
186
186
  protected dispatchError(e: Error): void;
187
187
  protected dispatchUpdateDownloaded(event: UpdateDownloadedEvent): void;
188
- protected abstract doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>>;
188
+ protected abstract doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<DownloadExecutorResult>;
189
189
  /**
190
190
  * Restarts the app and installs the update after it has been downloaded.
191
191
  * It should only be called after `update-downloaded` has been emitted.
@@ -202,7 +202,7 @@ export declare abstract class AppUpdater extends AppUpdater_base {
202
202
  private computeRequestHeaders;
203
203
  private getOrCreateStagingUserId;
204
204
  private getOrCreateDownloadHelper;
205
- protected executeDownload(taskOptions: DownloadExecutorTask): Promise<Array<string>>;
205
+ protected executeDownload(taskOptions: DownloadExecutorTask): Promise<DownloadExecutorResult>;
206
206
  protected differentialDownloadInstaller(fileInfo: ResolvedUpdateFileInfo, downloadUpdateOptions: DownloadUpdateOptions, installerPath: string, provider: Provider<any>, oldInstallerFileName: string): Promise<boolean>;
207
207
  }
208
208
  export interface DownloadUpdateOptions {
@@ -229,6 +229,10 @@ export interface DownloadExecutorTask {
229
229
  readonly task: (destinationFile: string, downloadOptions: DownloadOptions, packageFile: string | null, removeTempDirIfAny: () => Promise<any>) => Promise<any>;
230
230
  readonly done?: (event: UpdateDownloadedEvent) => Promise<any>;
231
231
  }
232
+ export interface DownloadExecutorResult {
233
+ readonly updateFile: string;
234
+ readonly packageFile?: string;
235
+ }
232
236
  export interface DownloadNotification {
233
237
  body: string;
234
238
  title: string;
package/out/AppUpdater.js CHANGED
@@ -441,7 +441,7 @@ class AppUpdater extends events_1.EventEmitter {
441
441
  }
442
442
  if (this.downloadPromise != null) {
443
443
  this._logger.info("Downloading update (already in progress)");
444
- return this.downloadPromise;
444
+ return this.downloadPromise.then(toDownloadedFilesArray);
445
445
  }
446
446
  this._logger.info(`Downloading update from ${(0, builder_util_runtime_1.asArray)(updateInfoAndProvider.info.files)
447
447
  .map(it => it.url)
@@ -471,7 +471,7 @@ class AppUpdater extends events_1.EventEmitter {
471
471
  .finally(() => {
472
472
  this.downloadPromise = null;
473
473
  });
474
- return this.downloadPromise;
474
+ return this.downloadPromise.then(toDownloadedFilesArray);
475
475
  }
476
476
  dispatchError(e) {
477
477
  this.emit("error", e, (e.stack || e).toString());
@@ -588,17 +588,25 @@ class AppUpdater extends events_1.EventEmitter {
588
588
  const updateFileName = getCacheUpdateFileName();
589
589
  let updateFile = path.join(cacheDir, updateFileName);
590
590
  const packageFile = packageInfo == null ? null : path.join(cacheDir, `package-${version}${path.extname(packageInfo.path) || ".7z"}`);
591
+ const pendingBlockMapFile = path.join(cacheDir, "current.blockmap");
592
+ const cachedBlockMapFile = path.join(downloadedUpdateHelper.cacheDir, "current.blockmap");
591
593
  const done = async (isSaveCache) => {
592
594
  await downloadedUpdateHelper.setDownloadedFile(updateFile, packageFile, updateInfo, fileInfo, updateFileName, isSaveCache);
593
595
  await taskOptions.done({
594
596
  ...updateInfo,
595
597
  downloadedFile: updateFile,
596
598
  });
597
- const currentBlockMapFile = path.join(cacheDir, "current.blockmap");
598
- if (await (0, fs_extra_1.pathExists)(currentBlockMapFile)) {
599
- await (0, fs_extra_1.copyFile)(currentBlockMapFile, path.join(downloadedUpdateHelper.cacheDir, "current.blockmap"));
599
+ if (await (0, fs_extra_1.pathExists)(pendingBlockMapFile)) {
600
+ await (0, fs_extra_1.copyFile)(pendingBlockMapFile, cachedBlockMapFile);
600
601
  }
601
- return packageFile == null ? [updateFile] : [updateFile, packageFile];
602
+ else if (!taskOptions.downloadUpdateOptions.disableDifferentialDownload) {
603
+ // this download did not produce a blockmap, but `taskOptions.done` above refreshes the cached installer —
604
+ // remove the cached blockmap too, so a stale one cannot sit next to a fresh file and poison the next
605
+ // differential download with a wrong copy plan (https://github.com/electron-userland/electron-builder/issues/10097).
606
+ // The differential downloader re-fetches the old blockmap from the server when no cached one exists.
607
+ await (0, fs_extra_1.remove)(cachedBlockMapFile);
608
+ }
609
+ return packageFile == null ? { updateFile } : { updateFile, packageFile };
602
610
  };
603
611
  const log = this._logger;
604
612
  const cachedUpdateFile = await downloadedUpdateHelper.validateDownloadedPath(updateFile, updateInfo, fileInfo, log);
@@ -614,6 +622,10 @@ class AppUpdater extends events_1.EventEmitter {
614
622
  // ignore
615
623
  });
616
624
  };
625
+ // a fresh download starts — drop any blockmap left over from a previous update round, so that when this round
626
+ // does not produce a new one (e.g. the differential download is skipped), the leftover cannot be promoted to the
627
+ // cache next to a file it does not describe
628
+ await (0, fs_extra_1.remove)(pendingBlockMapFile);
617
629
  const tempUpdateFile = await (0, DownloadedUpdateHelper_1.createTempUpdateFile)(`temp-${updateFileName}`, cacheDir, log);
618
630
  try {
619
631
  await taskOptions.task(tempUpdateFile, downloadOptions, packageFile, removeFileIfAny);
@@ -635,12 +647,18 @@ class AppUpdater extends events_1.EventEmitter {
635
647
  log.info("cancelled");
636
648
  this.emit("update-cancelled", updateInfo);
637
649
  }
650
+ else if (e.code === "ERR_CHECKSUM_MISMATCH") {
651
+ // a differential-download failure never escapes the task (it falls back to a full download),
652
+ // so a checksum mismatch here means the fully downloaded file itself failed verification
653
+ log.warn(`sha512 checksum mismatch after full download of ${updateFileName}: the downloaded file is corrupted or the published update metadata does not match the uploaded file`);
654
+ }
638
655
  throw e;
639
656
  }
640
657
  log.info(`New version ${version} has been downloaded to ${updateFile}`);
641
658
  return await done(true);
642
659
  }
643
660
  async differentialDownloadInstaller(fileInfo, downloadUpdateOptions, installerPath, provider, oldInstallerFileName) {
661
+ let isOldBlockMapFromCache = false;
644
662
  try {
645
663
  if (this._testOnlyOptions != null && !this._testOnlyOptions.isUseDifferentialDownload) {
646
664
  return true;
@@ -695,13 +713,18 @@ class AppUpdater extends events_1.EventEmitter {
695
713
  await saveBlockMapToCacheDir(newBlockMapData, this.downloadedUpdateHelper.cacheDirForPendingUpdate);
696
714
  // get old blockmap from cache dir first, if not found, download it
697
715
  let oldBlockMapData = await getBlockMapFromCacheDir(this.downloadedUpdateHelper.cacheDir);
716
+ isOldBlockMapFromCache = oldBlockMapData != null;
698
717
  if (oldBlockMapData == null) {
718
+ this._logger.info(`No cached blockmap for the old installer, downloading it from "${blockmapFileUrls[0]}"`);
699
719
  oldBlockMapData = await downloadBlockMap(blockmapFileUrls[0]);
700
720
  }
701
721
  await new GenericDifferentialDownloader_1.GenericDifferentialDownloader(fileInfo.info, this.httpExecutor, downloadOptions).download(oldBlockMapData, newBlockMapData);
702
722
  return false;
703
723
  }
704
724
  catch (e) {
725
+ if (e.code === "ERR_CHECKSUM_MISMATCH") {
726
+ this._logger.warn(`sha512 checksum mismatch after differential download (old blockmap ${isOldBlockMapFromCache ? "was read from the local cache" : "was downloaded from the server"}): cached "${oldInstallerFileName}" is likely out of sync with the old blockmap, e.g. because one of them was replaced or evicted independently of the other`);
727
+ }
705
728
  this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`);
706
729
  if (this._testOnlyOptions != null) {
707
730
  // test mode
@@ -732,4 +755,7 @@ class NoOpLogger {
732
755
  }
733
756
  }
734
757
  exports.NoOpLogger = NoOpLogger;
758
+ function toDownloadedFilesArray({ updateFile, packageFile }) {
759
+ return packageFile == null ? [updateFile] : [updateFile, packageFile];
760
+ }
735
761
  //# sourceMappingURL=AppUpdater.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppUpdater.js","sourceRoot":"","sources":["../src/AppUpdater.ts"],"names":[],"mappings":";;;AAAA,+DAa6B;AAC7B,mCAAoC;AACpC,2BAA4B;AAC5B,mCAAqC;AACrC,uCAA4F;AAE5F,qCAA8B;AAC9B,uCAA+B;AAC/B,6BAA4B;AAC5B,mCAA8K;AAE9K,qEAAuF;AACvF,6DAAyD;AACzD,iEAA2F;AAC3F,iEAA6D;AAC7D,uDAAwF;AAKxF,+BAA2C;AAE3C,0GAAsG;AACtG,mCAAuJ;AAevJ,MAAsB,UAAW,SAAS,qBAAyD;IAwFjG;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,IAAI,OAAO,CAAC,KAAoB;QAC9B,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC1B,qCAAqC;YACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,MAAM,IAAA,+BAAQ,EAAC,sCAAsC,KAAK,EAAE,EAAE,6BAA6B,CAAC,CAAA;YAC9F,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAA,+BAAQ,EAAC,qCAAqC,EAAE,6BAA6B,CAAC,CAAA;YACtF,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QACrB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;IAC5B,CAAC;IAOD;;OAEG;IACH,aAAa,CAAC,KAAa;QACzB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc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Ar0BD,gCAq0BC;AAUD,SAAS,uBAAuB,CAAC,OAAe;IAC9C,MAAM,0BAA0B,GAAG,IAAA,mBAA4B,EAAC,OAAO,CAAC,CAAA;IACxE,OAAO,0BAA0B,IAAI,IAAI,IAAI,0BAA0B,CAAC,MAAM,GAAG,CAAC,CAAA;AACpF,CAAC;AAED,eAAe;AACf,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":["import {\n AllPublishOptions,\n asArray,\n CancellationToken,\n newError,\n PublishConfiguration,\n UpdateInfo,\n UUID,\n DownloadOptions,\n CancellationError,\n ProgressInfo,\n BlockMap,\n retry,\n} from \"builder-util-runtime\"\nimport { randomBytes } from \"crypto\"\nimport { release } from \"os\"\nimport { EventEmitter } from \"events\"\nimport { mkdir, outputFile, readFile, rename, unlink, copyFile, pathExists } from \"fs-extra\"\nimport { OutgoingHttpHeaders } from \"http\"\nimport { load } from \"js-yaml\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { eq as isVersionsEqual, gt as isVersionGreaterThan, lt as isVersionLessThan, parse as parseVersion, prerelease as getVersionPreleaseComponents, SemVer } from \"semver\"\nimport { AppAdapter } from \"./AppAdapter\"\nimport { createTempUpdateFile, DownloadedUpdateHelper } from \"./DownloadedUpdateHelper\"\nimport { ElectronAppAdapter } from \"./ElectronAppAdapter\"\nimport { ElectronHttpExecutor, getNetSession, LoginCallback } from \"./electronHttpExecutor\"\nimport { GenericProvider } from \"./providers/GenericProvider\"\nimport { createClient, isUrlProbablySupportMultiRangeRequests } from \"./providerFactory\"\nimport { Provider, ProviderPlatform } from \"./providers/Provider\"\nimport type { TypedEmitter } from \"tiny-typed-emitter\"\nimport Session = Electron.Session\nimport type { AuthInfo } from \"electron\"\nimport { gunzipSync, gzipSync } from \"zlib\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader\"\nimport { GenericDifferentialDownloader } from \"./differentialDownloader/GenericDifferentialDownloader\"\nimport { DOWNLOAD_PROGRESS, Logger, ResolvedUpdateFileInfo, UPDATE_DOWNLOADED, UpdateCheckResult, UpdateDownloadedEvent, UpdaterSignal } from \"./types\"\nimport { VerifyUpdateSupport } from \"./main\"\n\nexport type AppUpdaterEvents = {\n error: (error: Error, message?: string) => void\n login: (info: AuthInfo, callback: LoginCallback) => void\n \"checking-for-update\": () => void\n \"update-not-available\": (info: UpdateInfo) => void\n \"update-available\": (info: UpdateInfo) => void\n \"update-downloaded\": (event: UpdateDownloadedEvent) => void\n \"download-progress\": (info: ProgressInfo) => void\n \"update-cancelled\": (info: UpdateInfo) => void\n \"appimage-filename-updated\": (path: string) => void\n}\n\nexport abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter<AppUpdaterEvents>) {\n /**\n * Whether to automatically download an update when it is found.\n * @default true\n */\n autoDownload = true\n\n /**\n * Whether to automatically install a downloaded update on app quit (if `quitAndInstall` was not called before).\n * @default true\n */\n autoInstallOnAppQuit = true\n\n /**\n * Whether to run the app after finish install when run the installer is NOT in silent mode.\n * @default true\n */\n autoRunAppAfterInstall = true\n\n /**\n * *GitHub provider only.* Whether to allow update to pre-release versions. Defaults to `true` if application version contains prerelease components (e.g. `0.12.1-alpha.1`, here `alpha` is a prerelease component), otherwise `false`.\n *\n * If `true`, downgrade will be allowed (`allowDowngrade` will be set to `true`).\n */\n allowPrerelease = false\n\n /**\n * *GitHub provider only.* Get all release notes (from current version to latest), not just the latest.\n * @default false\n */\n fullChangelog = false\n\n /**\n * Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).\n *\n * Taken in account only if channel differs (pre-release version component in terms of semantic versioning).\n *\n * @default false\n */\n allowDowngrade = false\n\n /**\n * Web installer files might not have signature verification, this switch prevents to load them unless it is needed.\n *\n * Currently false to prevent breaking the current API, but it should be changed to default true at some point that\n * breaking changes are allowed.\n *\n * @default false\n */\n disableWebInstaller = false\n\n /**\n * *NSIS only* Disable differential downloads and always perform full download of installer.\n *\n * @default false\n */\n disableDifferentialDownload = false\n\n /**\n * Allows developer to force the updater to work in \"dev\" mode, looking for \"dev-app-update.yml\" instead of \"app-update.yml\"\n * Dev: `path.join(this.app.getAppPath(), \"dev-app-update.yml\")`\n * Prod: `path.join(process.resourcesPath!, \"app-update.yml\")`\n *\n * @default false\n */\n forceDevUpdateConfig = false\n\n /**\n * The base URL of the old block map file.\n *\n * When null, the updater will use the base URL of the update file to download the update.\n * When set, the updater will use this string as the base URL of the old block map file.\n * Some servers like github cannot download the old block map file from latest release,\n * so you need to compute the old block map file base URL manually.\n *\n * @default null\n */\n public previousBlockmapBaseUrlOverride: string | null = null\n\n /**\n * The current application version.\n */\n readonly currentVersion: SemVer\n\n private _channel: string | null = null\n\n protected downloadedUpdateHelper: DownloadedUpdateHelper | null = null\n\n /**\n * Get the update channel. Doesn't return `channel` from the update configuration, only if was previously set.\n */\n get channel(): string | null {\n return this._channel\n }\n\n /**\n * Set the update channel. Overrides `channel` in the update configuration.\n *\n * `allowDowngrade` will be automatically set to `true`. If this behavior is not suitable for you, simple set `allowDowngrade` explicitly after.\n */\n set channel(value: string | null) {\n if (this._channel != null) {\n // noinspection SuspiciousTypeOfGuard\n if (typeof value !== \"string\") {\n throw newError(`Channel must be a string, but got: ${value}`, \"ERR_UPDATER_INVALID_CHANNEL\")\n } else if (value.length === 0) {\n throw newError(`Channel must be not an empty string`, \"ERR_UPDATER_INVALID_CHANNEL\")\n }\n }\n\n this._channel = value\n this.allowDowngrade = true\n }\n\n /**\n * The request headers.\n */\n requestHeaders: OutgoingHttpHeaders | null = null\n\n /**\n * Shortcut for explicitly adding auth tokens to request headers\n */\n addAuthHeader(token: string) {\n this.requestHeaders = Object.assign({}, this.requestHeaders, {\n authorization: token,\n })\n }\n\n protected _logger: Logger = console\n\n // noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols\n get netSession(): Session {\n return getNetSession()\n }\n\n /**\n * The logger. You can pass [electron-log](https://github.com/megahertz/electron-log), [winston](https://github.com/winstonjs/winston) or another logger with the following interface: `{ info(), warn(), error() }`.\n * Set it to `null` if you would like to disable a logging feature.\n */\n get logger(): Logger | null {\n return this._logger\n }\n\n set logger(value: Logger | null) {\n this._logger = value == null ? new NoOpLogger() : value\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * For type safety you can use signals, e.g. `autoUpdater.signals.updateDownloaded(() => {})` instead of `autoUpdater.on('update-available', () => {})`\n */\n readonly signals = new UpdaterSignal(this)\n\n private _appUpdateConfigPath: string | null = null\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * test only\n * @private\n */\n set updateConfigPath(value: string | null) {\n this.clientPromise = null\n this._appUpdateConfigPath = value\n this.configOnDisk = new Lazy<any>(() => this.loadUpdateConfig())\n }\n\n protected _isUpdateSupported: VerifyUpdateSupport = updateInfo => this.checkIfUpdateSupported(updateInfo)\n\n /**\n * Allows developer to override default logic for determining if an update is supported.\n * The default logic compares the `UpdateInfo` minimum system version against the `os.release()` with `semver` package\n */\n get isUpdateSupported(): VerifyUpdateSupport {\n return this._isUpdateSupported\n }\n\n set isUpdateSupported(value: VerifyUpdateSupport) {\n if (value) {\n this._isUpdateSupported = value\n }\n }\n\n protected _isUserWithinRollout: VerifyUpdateSupport = updateInfo => this.isStagingMatch(updateInfo)\n\n /**\n * Allows developer to override default logic for determining if the user is below the rollout threshold.\n * The default logic compares the staging percentage with numerical representation of user ID.\n * An override can define custom logic, or bypass it if needed.\n */\n get isUserWithinRollout(): VerifyUpdateSupport {\n return this._isUserWithinRollout\n }\n\n set isUserWithinRollout(value: VerifyUpdateSupport) {\n if (value) {\n this._isUserWithinRollout = value\n }\n }\n\n private clientPromise: Promise<Provider<any>> | null = null\n\n protected readonly stagingUserIdPromise = new Lazy<string>(() => this.getOrCreateStagingUserId())\n\n // public, allow to read old config for anyone\n /** @internal */\n configOnDisk = new Lazy<any>(() => this.loadUpdateConfig())\n\n private checkForUpdatesPromise: Promise<UpdateCheckResult> | null = null\n private downloadPromise: Promise<Array<string>> | null = null\n\n protected readonly app: AppAdapter\n\n protected updateInfoAndProvider: UpdateInfoAndProvider | null = null\n\n /** @internal */\n readonly httpExecutor: ElectronHttpExecutor\n\n protected constructor(options: AllPublishOptions | null | undefined, app?: AppAdapter) {\n super()\n\n this.on(\"error\", (error: Error) => {\n this._logger.error(`Error: ${error.stack || error.message}`)\n })\n\n if (app == null) {\n this.app = new ElectronAppAdapter()\n this.httpExecutor = new ElectronHttpExecutor((authInfo, callback) => this.emit(\"login\", authInfo, callback))\n } else {\n this.app = app\n this.httpExecutor = null as any\n }\n\n const currentVersionString = this.app.version\n const currentVersion = parseVersion(currentVersionString)\n if (currentVersion == null) {\n throw newError(`App version is not a valid semver version: \"${currentVersionString}\"`, \"ERR_UPDATER_INVALID_VERSION\")\n }\n this.currentVersion = currentVersion\n this.allowPrerelease = hasPrereleaseComponents(currentVersion)\n\n if (options != null) {\n this.setFeedURL(options)\n\n if (typeof options !== \"string\" && options.requestHeaders) {\n this.requestHeaders = options.requestHeaders\n }\n }\n }\n\n //noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols\n getFeedURL(): string | null | undefined {\n return \"Deprecated. Do not use it.\"\n }\n\n /**\n * Configure update provider. If value is `string`, [GenericServerOptions](https://www.electron.build/publish#genericserveroptions) will be set with value as `url`.\n * @param options If you want to override configuration in the `app-update.yml`.\n */\n setFeedURL(options: PublishConfiguration | AllPublishOptions | string) {\n const runtimeOptions = this.createProviderRuntimeOptions()\n // https://github.com/electron-userland/electron-builder/issues/1105\n let provider: Provider<any>\n if (typeof options === \"string\") {\n provider = new GenericProvider({ provider: \"generic\", url: options }, this, {\n ...runtimeOptions,\n isUseMultipleRangeRequest: isUrlProbablySupportMultiRangeRequests(options),\n })\n } else {\n provider = createClient(options, this, runtimeOptions)\n }\n this.clientPromise = Promise.resolve(provider)\n }\n\n /**\n * Asks the server whether there is an update.\n * @returns null if the updater is disabled, otherwise info about the latest version\n */\n checkForUpdates(): Promise<UpdateCheckResult | null> {\n if (!this.isUpdaterActive()) {\n return Promise.resolve(null)\n }\n\n let checkForUpdatesPromise = this.checkForUpdatesPromise\n if (checkForUpdatesPromise != null) {\n this._logger.info(\"Checking for update (already in progress)\")\n return checkForUpdatesPromise\n }\n\n const nullizePromise = () => (this.checkForUpdatesPromise = null)\n\n this._logger.info(\"Checking for update\")\n checkForUpdatesPromise = this.doCheckForUpdates()\n .then(it => {\n nullizePromise()\n return it\n })\n .catch((e: any) => {\n nullizePromise()\n this.emit(\"error\", e, `Cannot check for updates: ${(e.stack || e).toString()}`)\n throw e\n })\n\n this.checkForUpdatesPromise = checkForUpdatesPromise\n return checkForUpdatesPromise\n }\n\n public isUpdaterActive(): boolean {\n const isEnabled = this.app.isPackaged || this.forceDevUpdateConfig\n if (!isEnabled) {\n this._logger.info(\"Skip checkForUpdates because application is not packed and dev update config is not forced\")\n return false\n }\n return true\n }\n\n // noinspection JSUnusedGlobalSymbols\n checkForUpdatesAndNotify(downloadNotification?: DownloadNotification): Promise<UpdateCheckResult | null> {\n return this.checkForUpdates().then(it => {\n if (!it?.downloadPromise) {\n if (this._logger.debug != null) {\n this._logger.debug(\"checkForUpdatesAndNotify called, downloadPromise is null\")\n }\n return it\n }\n\n void it.downloadPromise.then(() => {\n const notificationContent = AppUpdater.formatDownloadNotification(it.updateInfo.version, this.app.name, downloadNotification)\n new (require(\"electron\").Notification)(notificationContent).show()\n })\n\n return it\n })\n }\n\n private static formatDownloadNotification(version: string, appName: string, downloadNotification?: DownloadNotification): DownloadNotification {\n if (downloadNotification == null) {\n downloadNotification = {\n title: \"A new update is ready to install\",\n body: `{appName} version {version} has been downloaded and will be automatically installed on exit`,\n }\n }\n downloadNotification = {\n title: downloadNotification.title.replace(\"{appName}\", appName).replace(\"{version}\", version),\n body: downloadNotification.body.replace(\"{appName}\", appName).replace(\"{version}\", version),\n }\n return downloadNotification\n }\n\n private async isStagingMatch(updateInfo: UpdateInfo): Promise<boolean> {\n const rawStagingPercentage = updateInfo.stagingPercentage\n let stagingPercentage = rawStagingPercentage\n if (stagingPercentage == null) {\n return true\n }\n\n stagingPercentage = parseInt(stagingPercentage as any, 10)\n if (isNaN(stagingPercentage)) {\n this._logger.warn(`Staging percentage is NaN: ${rawStagingPercentage}`)\n return true\n }\n\n // convert from user 0-100 to internal 0-1\n stagingPercentage = stagingPercentage / 100\n\n const stagingUserId = await this.stagingUserIdPromise.value\n const val = UUID.parse(stagingUserId).readUInt32BE(12)\n const percentage = val / 0xffffffff\n this._logger.info(`Staging percentage: ${stagingPercentage}, percentage: ${percentage}, user id: ${stagingUserId}`)\n return percentage < stagingPercentage\n }\n\n private computeFinalHeaders(headers: OutgoingHttpHeaders) {\n if (this.requestHeaders != null) {\n Object.assign(headers, this.requestHeaders)\n }\n return headers\n }\n\n private async isUpdateAvailable(updateInfo: UpdateInfo): Promise<boolean> {\n const latestVersion = parseVersion(updateInfo.version)\n if (latestVersion == null) {\n throw newError(\n `This file could not be downloaded, or the latest version (from update server) does not have a valid semver version: \"${updateInfo.version}\"`,\n \"ERR_UPDATER_INVALID_VERSION\"\n )\n }\n\n const currentVersion = this.currentVersion\n if (isVersionsEqual(latestVersion, currentVersion)) {\n return false\n }\n\n if (!(await Promise.resolve(this.isUpdateSupported(updateInfo)))) {\n return false\n }\n\n const isUserWithinRollout = await Promise.resolve(this.isUserWithinRollout(updateInfo))\n if (!isUserWithinRollout) {\n return false\n }\n\n // https://github.com/electron-userland/electron-builder/pull/3111#issuecomment-405033227\n // https://github.com/electron-userland/electron-builder/pull/3111#issuecomment-405030797\n const isLatestVersionNewer = isVersionGreaterThan(latestVersion, currentVersion)\n const isLatestVersionOlder = isVersionLessThan(latestVersion, currentVersion)\n\n if (isLatestVersionNewer) {\n return true\n }\n return this.allowDowngrade && isLatestVersionOlder\n }\n\n private checkIfUpdateSupported(updateInfo: UpdateInfo) {\n const minimumSystemVersion = updateInfo?.minimumSystemVersion\n const currentOSVersion = release()\n if (minimumSystemVersion) {\n try {\n if (isVersionLessThan(currentOSVersion, minimumSystemVersion)) {\n this._logger.info(`Current OS version ${currentOSVersion} is less than the minimum OS version required ${minimumSystemVersion} for version ${currentOSVersion}`)\n return false\n }\n } catch (e: any) {\n this._logger.warn(`Failed to compare current OS version(${currentOSVersion}) with minimum OS version(${minimumSystemVersion}): ${(e.message || e).toString()}`)\n }\n }\n return true\n }\n\n protected async getUpdateInfoAndProvider(): Promise<UpdateInfoAndProvider> {\n await this.app.whenReady()\n\n if (this.clientPromise == null) {\n this.clientPromise = this.configOnDisk.value.then(it => createClient(it, this, this.createProviderRuntimeOptions()))\n }\n\n const client = await this.clientPromise\n const stagingUserId = await this.stagingUserIdPromise.value\n client.setRequestHeaders(this.computeFinalHeaders({ \"x-user-staging-id\": stagingUserId }))\n return {\n info: await client.getLatestVersion(),\n provider: client,\n }\n }\n\n private createProviderRuntimeOptions() {\n return {\n isUseMultipleRangeRequest: true,\n platform: this._testOnlyOptions == null ? (process.platform as ProviderPlatform) : this._testOnlyOptions.platform,\n executor: this.httpExecutor,\n }\n }\n\n private async doCheckForUpdates(): Promise<UpdateCheckResult> {\n this.emit(\"checking-for-update\")\n\n const result = await this.getUpdateInfoAndProvider()\n const updateInfo = result.info\n if (!(await this.isUpdateAvailable(updateInfo))) {\n this._logger.info(\n `Update for version ${this.currentVersion.format()} is not available (latest version: ${updateInfo.version}, downgrade is ${\n this.allowDowngrade ? \"allowed\" : \"disallowed\"\n }).`\n )\n this.emit(\"update-not-available\", updateInfo)\n return {\n isUpdateAvailable: false,\n versionInfo: updateInfo,\n updateInfo,\n }\n }\n\n this.updateInfoAndProvider = result\n this.onUpdateAvailable(updateInfo)\n\n const cancellationToken = new CancellationToken()\n //noinspection ES6MissingAwait\n return {\n isUpdateAvailable: true,\n versionInfo: updateInfo,\n updateInfo,\n cancellationToken,\n downloadPromise: this.autoDownload ? this.downloadUpdate(cancellationToken) : null,\n }\n }\n\n protected onUpdateAvailable(updateInfo: UpdateInfo): void {\n this._logger.info(\n `Found version ${updateInfo.version} (url: ${asArray(updateInfo.files)\n .map(it => it.url)\n .join(\", \")})`\n )\n this.emit(\"update-available\", updateInfo)\n }\n\n /**\n * Start downloading update manually. You can use this method if `autoDownload` option is set to `false`.\n * @returns {Promise<Array<string>>} Paths to downloaded files.\n */\n downloadUpdate(cancellationToken: CancellationToken = new CancellationToken()): Promise<Array<string>> {\n const updateInfoAndProvider = this.updateInfoAndProvider\n if (updateInfoAndProvider == null) {\n const error = new Error(\"Please check update first\")\n this.dispatchError(error)\n return Promise.reject(error)\n }\n\n if (this.downloadPromise != null) {\n this._logger.info(\"Downloading update (already in progress)\")\n return this.downloadPromise\n }\n\n this._logger.info(\n `Downloading update from ${asArray(updateInfoAndProvider.info.files)\n .map(it => it.url)\n .join(\", \")}`\n )\n const errorHandler = (e: Error): Error => {\n // https://github.com/electron-userland/electron-builder/issues/1150#issuecomment-436891159\n if (!(e instanceof CancellationError)) {\n try {\n this.dispatchError(e)\n } catch (nestedError: any) {\n this._logger.warn(`Cannot dispatch error event: ${nestedError.stack || nestedError}`)\n }\n }\n\n return e\n }\n\n this.downloadPromise = this.doDownloadUpdate({\n updateInfoAndProvider,\n requestHeaders: this.computeRequestHeaders(updateInfoAndProvider.provider),\n cancellationToken,\n disableWebInstaller: this.disableWebInstaller,\n disableDifferentialDownload: this.disableDifferentialDownload,\n })\n .catch((e: any) => {\n throw errorHandler(e)\n })\n .finally(() => {\n this.downloadPromise = null\n })\n\n return this.downloadPromise\n }\n\n protected dispatchError(e: Error): void {\n this.emit(\"error\", e, (e.stack || e).toString())\n }\n\n protected dispatchUpdateDownloaded(event: UpdateDownloadedEvent): void {\n this.emit(UPDATE_DOWNLOADED, event)\n }\n\n protected abstract doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>>\n\n /**\n * Restarts the app and installs the update after it has been downloaded.\n * It should only be called after `update-downloaded` has been emitted.\n *\n * **Note:** `autoUpdater.quitAndInstall()` will close all application windows first and only emit `before-quit` event on `app` after that.\n * This is different from the normal quit event sequence.\n *\n * @param isSilent *windows-only* Runs the installer in silent mode. Defaults to `false`.\n * @param isForceRunAfter Run the app after finish even on silent install. Not applicable for macOS.\n * Ignored if `isSilent` is set to `false`(In this case you can still set `autoRunAppAfterInstall` to `false` to prevent run the app after finish).\n */\n abstract quitAndInstall(isSilent?: boolean, isForceRunAfter?: boolean): void\n\n private async loadUpdateConfig(): Promise<any> {\n if (this._appUpdateConfigPath == null) {\n this._appUpdateConfigPath = this.app.appUpdateConfigPath\n }\n return load(await readFile(this._appUpdateConfigPath, \"utf-8\"))\n }\n\n private computeRequestHeaders(provider: Provider<any>): OutgoingHttpHeaders {\n const fileExtraDownloadHeaders = provider.fileExtraDownloadHeaders\n if (fileExtraDownloadHeaders != null) {\n const requestHeaders = this.requestHeaders\n return requestHeaders == null\n ? fileExtraDownloadHeaders\n : {\n ...fileExtraDownloadHeaders,\n ...requestHeaders,\n }\n }\n return this.computeFinalHeaders({ accept: \"*/*\" })\n }\n\n private async getOrCreateStagingUserId(): Promise<string> {\n const file = path.join(this.app.userDataPath, \".updaterId\")\n try {\n const id = await readFile(file, \"utf-8\")\n if (UUID.check(id)) {\n return id\n } else {\n this._logger.warn(`Staging user id file exists, but content was invalid: ${id}`)\n }\n } catch (e: any) {\n if (e.code !== \"ENOENT\") {\n this._logger.warn(`Couldn't read staging user ID, creating a blank one: ${e}`)\n }\n }\n\n const id = UUID.v5(randomBytes(4096), UUID.OID)\n this._logger.info(`Generated new staging user ID: ${id}`)\n try {\n await outputFile(file, id)\n } catch (e: any) {\n this._logger.warn(`Couldn't write out staging user ID: ${e}`)\n }\n return id\n }\n\n /** @internal */\n get isAddNoCacheQuery(): boolean {\n const headers = this.requestHeaders\n // https://github.com/electron-userland/electron-builder/issues/3021\n if (headers == null) {\n return true\n }\n\n for (const headerName of Object.keys(headers)) {\n const s = headerName.toLowerCase()\n if (s === \"authorization\" || s === \"private-token\") {\n return false\n }\n }\n return true\n }\n\n /**\n * @private\n * @internal\n */\n _testOnlyOptions: TestOnlyUpdaterOptions | null = null\n\n private async getOrCreateDownloadHelper(): Promise<DownloadedUpdateHelper> {\n let result = this.downloadedUpdateHelper\n if (result == null) {\n const dirName = (await this.configOnDisk.value).updaterCacheDirName\n const logger = this._logger\n if (dirName == null) {\n logger.error(\"updaterCacheDirName is not specified in app-update.yml Was app build using at least electron-builder 20.34.0?\")\n }\n const cacheDir = path.join(this.app.baseCachePath, dirName || this.app.name)\n if (logger.debug != null) {\n logger.debug(`updater cache dir: ${cacheDir}`)\n }\n\n result = new DownloadedUpdateHelper(cacheDir)\n this.downloadedUpdateHelper = result\n }\n return result\n }\n\n protected async executeDownload(taskOptions: DownloadExecutorTask): Promise<Array<string>> {\n const fileInfo = taskOptions.fileInfo\n const downloadOptions: DownloadOptions = {\n headers: taskOptions.downloadUpdateOptions.requestHeaders,\n cancellationToken: taskOptions.downloadUpdateOptions.cancellationToken,\n sha2: (fileInfo.info as any).sha2,\n sha512: fileInfo.info.sha512,\n }\n\n if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) {\n downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it)\n }\n\n const updateInfo = taskOptions.downloadUpdateOptions.updateInfoAndProvider.info\n const version = updateInfo.version\n const packageInfo = fileInfo.packageInfo\n\n function getCacheUpdateFileName(): string {\n // NodeJS URL doesn't decode automatically\n const urlPath = decodeURIComponent(taskOptions.fileInfo.url.pathname)\n if (urlPath.toLowerCase().endsWith(`.${taskOptions.fileExtension.toLowerCase()}`)) {\n return path.basename(urlPath)\n } else {\n // url like /latest — use basename so a server-supplied path like \"../../etc/evil\"\n // cannot escape the cache directory via path.join\n return path.basename(taskOptions.fileInfo.info.url)\n }\n }\n\n const downloadedUpdateHelper = await this.getOrCreateDownloadHelper()\n const cacheDir = downloadedUpdateHelper.cacheDirForPendingUpdate\n await mkdir(cacheDir, { recursive: true })\n const updateFileName = getCacheUpdateFileName()\n let updateFile = path.join(cacheDir, updateFileName)\n const packageFile = packageInfo == null ? null : path.join(cacheDir, `package-${version}${path.extname(packageInfo.path) || \".7z\"}`)\n\n const done = async (isSaveCache: boolean) => {\n await downloadedUpdateHelper.setDownloadedFile(updateFile, packageFile, updateInfo, fileInfo, updateFileName, isSaveCache)\n await taskOptions.done!({\n ...updateInfo,\n downloadedFile: updateFile,\n })\n const currentBlockMapFile = path.join(cacheDir, \"current.blockmap\")\n if (await pathExists(currentBlockMapFile)) {\n await copyFile(currentBlockMapFile, path.join(downloadedUpdateHelper.cacheDir, \"current.blockmap\"))\n }\n return packageFile == null ? [updateFile] : [updateFile, packageFile]\n }\n\n const log = this._logger\n const cachedUpdateFile = await downloadedUpdateHelper.validateDownloadedPath(updateFile, updateInfo, fileInfo, log)\n if (cachedUpdateFile != null) {\n updateFile = cachedUpdateFile\n return await done(false)\n }\n\n const removeFileIfAny = async () => {\n await downloadedUpdateHelper.clear().catch(() => {\n // ignore\n })\n return await unlink(updateFile).catch(() => {\n // ignore\n })\n }\n\n const tempUpdateFile = await createTempUpdateFile(`temp-${updateFileName}`, cacheDir, log)\n try {\n await taskOptions.task(tempUpdateFile, downloadOptions, packageFile, removeFileIfAny)\n await retry(() => rename(tempUpdateFile, updateFile), {\n retries: 60,\n interval: 500,\n shouldRetry: (error: Error) => {\n if (error instanceof Error && /^EBUSY:/.test(error.message)) {\n return true\n }\n log.warn(`Cannot rename temp file to final file: ${error.message || error.stack}`)\n return false\n },\n })\n } catch (e: any) {\n await removeFileIfAny()\n\n if (e instanceof CancellationError) {\n log.info(\"cancelled\")\n this.emit(\"update-cancelled\", updateInfo)\n }\n throw e\n }\n\n log.info(`New version ${version} has been downloaded to ${updateFile}`)\n return await done(true)\n }\n protected async differentialDownloadInstaller(\n fileInfo: ResolvedUpdateFileInfo,\n downloadUpdateOptions: DownloadUpdateOptions,\n installerPath: string,\n provider: Provider<any>,\n oldInstallerFileName: string\n ): Promise<boolean> {\n try {\n if (this._testOnlyOptions != null && !this._testOnlyOptions.isUseDifferentialDownload) {\n return true\n }\n const provider = downloadUpdateOptions.updateInfoAndProvider.provider\n const blockmapFileUrls = await provider.getBlockMapFiles(\n fileInfo.url,\n this.app.version,\n downloadUpdateOptions.updateInfoAndProvider.info.version,\n this.previousBlockmapBaseUrlOverride\n )\n this._logger.info(`Download block maps (old: \"${blockmapFileUrls[0]}\", new: ${blockmapFileUrls[1]})`)\n\n const downloadBlockMap = async (url: URL): Promise<BlockMap> => {\n const data = await this.httpExecutor.downloadToBuffer(url, {\n headers: downloadUpdateOptions.requestHeaders,\n cancellationToken: downloadUpdateOptions.cancellationToken,\n })\n\n if (data == null || data.length === 0) {\n throw new Error(`Blockmap \"${url.href}\" is empty`)\n }\n\n try {\n return JSON.parse(gunzipSync(data).toString())\n } catch (e: any) {\n throw new Error(`Cannot parse blockmap \"${url.href}\", error: ${e}`)\n }\n }\n\n const downloadOptions: DifferentialDownloaderOptions = {\n newUrl: fileInfo.url,\n oldFile: path.join(this.downloadedUpdateHelper!.cacheDir, oldInstallerFileName),\n logger: this._logger,\n newFile: installerPath,\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 const saveBlockMapToCacheDir = async (blockMapData: BlockMap, cacheDir: string) => {\n const blockMapFile = path.join(cacheDir, \"current.blockmap\")\n await outputFile(blockMapFile, gzipSync(JSON.stringify(blockMapData)))\n }\n\n const getBlockMapFromCacheDir = async (cacheDir: string) => {\n const blockMapFile = path.join(cacheDir, \"current.blockmap\")\n try {\n if (await pathExists(blockMapFile)) {\n return JSON.parse(gunzipSync(await readFile(blockMapFile)).toString())\n }\n } catch (e: any) {\n this._logger.warn(`Cannot parse blockmap \"${blockMapFile}\", error: ${e}`)\n }\n return null\n }\n\n const newBlockMapData = await downloadBlockMap(blockmapFileUrls[1])\n await saveBlockMapToCacheDir(newBlockMapData, this.downloadedUpdateHelper!.cacheDirForPendingUpdate)\n\n // get old blockmap from cache dir first, if not found, download it\n let oldBlockMapData = await getBlockMapFromCacheDir(this.downloadedUpdateHelper!.cacheDir)\n if (oldBlockMapData == null) {\n oldBlockMapData = await downloadBlockMap(blockmapFileUrls[0])\n }\n\n await new GenericDifferentialDownloader(fileInfo.info, this.httpExecutor, downloadOptions).download(oldBlockMapData, newBlockMapData)\n return false\n } catch (e: any) {\n this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`)\n if (this._testOnlyOptions != null) {\n // test mode\n throw e\n }\n return true\n }\n }\n}\n\nexport interface DownloadUpdateOptions {\n readonly updateInfoAndProvider: UpdateInfoAndProvider\n readonly requestHeaders: OutgoingHttpHeaders\n readonly cancellationToken: CancellationToken\n readonly disableWebInstaller?: boolean\n readonly disableDifferentialDownload?: boolean\n}\n\nfunction hasPrereleaseComponents(version: SemVer) {\n const versionPrereleaseComponent = getVersionPreleaseComponents(version)\n return versionPrereleaseComponent != null && versionPrereleaseComponent.length > 0\n}\n\n/** @private */\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\nexport interface UpdateInfoAndProvider {\n info: UpdateInfo\n provider: Provider<any>\n}\n\nexport interface DownloadExecutorTask {\n readonly fileExtension: string\n readonly fileInfo: ResolvedUpdateFileInfo\n readonly downloadUpdateOptions: DownloadUpdateOptions\n readonly task: (destinationFile: string, downloadOptions: DownloadOptions, packageFile: string | null, removeTempDirIfAny: () => Promise<any>) => Promise<any>\n\n readonly done?: (event: UpdateDownloadedEvent) => Promise<any>\n}\n\nexport interface DownloadNotification {\n body: string\n title: string\n}\n\n/** @private */\nexport interface TestOnlyUpdaterOptions {\n platform: ProviderPlatform\n\n isUseDifferentialDownload?: boolean\n}\n"]}
1
+ {"version":3,"file":"AppUpdater.js","sourceRoot":"","sources":["../src/AppUpdater.ts"],"names":[],"mappings":";;;AAAA,+DAa6B;AAC7B,mCAAoC;AACpC,2BAA4B;AAC5B,mCAAqC;AACrC,uCAAoG;AAEpG,qCAA8B;AAC9B,uCAA+B;AAC/B,6BAA4B;AAC5B,mCAA8K;AAE9K,qEAAuF;AACvF,6DAAyD;AACzD,iEAA2F;AAC3F,iEAA6D;AAC7D,uDAAwF;AAKxF,+BAA2C;AAE3C,0GAAsG;AACtG,mCAAuJ;AAevJ,MAAsB,UAAW,SAAS,qBAAyD;IAwFjG;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,IAAI,OAAO,CAAC,KAAoB;QAC9B,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC1B,qCAAqC;YACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,MAAM,IAAA,+BAAQ,EAAC,sCAAsC,KAAK,EAAE,EAAE,6BAA6B,CAAC,CAAA;YAC9F,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAA,+BAAQ,EAAC,qCAAqC,EAAE,6BAA6B,CAAC,CAAA;YACtF,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QACrB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;IAC5B,CAAC;IAOD;;OAEG;IACH,aAAa,CAAC,KAAa;QACzB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC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AAU;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;AAqBD,SAAS,sBAAsB,CAAC,EAAE,UAAU,EAAE,WAAW,EAA0B;IACjF,OAAO,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;AACvE,CAAC","sourcesContent":["import {\n AllPublishOptions,\n asArray,\n CancellationToken,\n newError,\n PublishConfiguration,\n UpdateInfo,\n UUID,\n DownloadOptions,\n CancellationError,\n ProgressInfo,\n BlockMap,\n retry,\n} from \"builder-util-runtime\"\nimport { randomBytes } from \"crypto\"\nimport { release } from \"os\"\nimport { EventEmitter } from \"events\"\nimport { copyFile, mkdir, outputFile, pathExists, readFile, remove, rename, unlink } from \"fs-extra\"\nimport { OutgoingHttpHeaders } from \"http\"\nimport { load } from \"js-yaml\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { eq as isVersionsEqual, gt as isVersionGreaterThan, lt as isVersionLessThan, parse as parseVersion, prerelease as getVersionPreleaseComponents, SemVer } from \"semver\"\nimport { AppAdapter } from \"./AppAdapter\"\nimport { createTempUpdateFile, DownloadedUpdateHelper } from \"./DownloadedUpdateHelper\"\nimport { ElectronAppAdapter } from \"./ElectronAppAdapter\"\nimport { ElectronHttpExecutor, getNetSession, LoginCallback } from \"./electronHttpExecutor\"\nimport { GenericProvider } from \"./providers/GenericProvider\"\nimport { createClient, isUrlProbablySupportMultiRangeRequests } from \"./providerFactory\"\nimport { Provider, ProviderPlatform } from \"./providers/Provider\"\nimport type { TypedEmitter } from \"tiny-typed-emitter\"\nimport Session = Electron.Session\nimport type { AuthInfo } from \"electron\"\nimport { gunzipSync, gzipSync } from \"zlib\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader\"\nimport { GenericDifferentialDownloader } from \"./differentialDownloader/GenericDifferentialDownloader\"\nimport { DOWNLOAD_PROGRESS, Logger, ResolvedUpdateFileInfo, UPDATE_DOWNLOADED, UpdateCheckResult, UpdateDownloadedEvent, UpdaterSignal } from \"./types\"\nimport { VerifyUpdateSupport } from \"./main\"\n\nexport type AppUpdaterEvents = {\n error: (error: Error, message?: string) => void\n login: (info: AuthInfo, callback: LoginCallback) => void\n \"checking-for-update\": () => void\n \"update-not-available\": (info: UpdateInfo) => void\n \"update-available\": (info: UpdateInfo) => void\n \"update-downloaded\": (event: UpdateDownloadedEvent) => void\n \"download-progress\": (info: ProgressInfo) => void\n \"update-cancelled\": (info: UpdateInfo) => void\n \"appimage-filename-updated\": (path: string) => void\n}\n\nexport abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter<AppUpdaterEvents>) {\n /**\n * Whether to automatically download an update when it is found.\n * @default true\n */\n autoDownload = true\n\n /**\n * Whether to automatically install a downloaded update on app quit (if `quitAndInstall` was not called before).\n * @default true\n */\n autoInstallOnAppQuit = true\n\n /**\n * Whether to run the app after finish install when run the installer is NOT in silent mode.\n * @default true\n */\n autoRunAppAfterInstall = true\n\n /**\n * *GitHub provider only.* Whether to allow update to pre-release versions. Defaults to `true` if application version contains prerelease components (e.g. `0.12.1-alpha.1`, here `alpha` is a prerelease component), otherwise `false`.\n *\n * If `true`, downgrade will be allowed (`allowDowngrade` will be set to `true`).\n */\n allowPrerelease = false\n\n /**\n * *GitHub provider only.* Get all release notes (from current version to latest), not just the latest.\n * @default false\n */\n fullChangelog = false\n\n /**\n * Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).\n *\n * Taken in account only if channel differs (pre-release version component in terms of semantic versioning).\n *\n * @default false\n */\n allowDowngrade = false\n\n /**\n * Web installer files might not have signature verification, this switch prevents to load them unless it is needed.\n *\n * Currently false to prevent breaking the current API, but it should be changed to default true at some point that\n * breaking changes are allowed.\n *\n * @default false\n */\n disableWebInstaller = false\n\n /**\n * *NSIS only* Disable differential downloads and always perform full download of installer.\n *\n * @default false\n */\n disableDifferentialDownload = false\n\n /**\n * Allows developer to force the updater to work in \"dev\" mode, looking for \"dev-app-update.yml\" instead of \"app-update.yml\"\n * Dev: `path.join(this.app.getAppPath(), \"dev-app-update.yml\")`\n * Prod: `path.join(process.resourcesPath!, \"app-update.yml\")`\n *\n * @default false\n */\n forceDevUpdateConfig = false\n\n /**\n * The base URL of the old block map file.\n *\n * When null, the updater will use the base URL of the update file to download the update.\n * When set, the updater will use this string as the base URL of the old block map file.\n * Some servers like github cannot download the old block map file from latest release,\n * so you need to compute the old block map file base URL manually.\n *\n * @default null\n */\n public previousBlockmapBaseUrlOverride: string | null = null\n\n /**\n * The current application version.\n */\n readonly currentVersion: SemVer\n\n private _channel: string | null = null\n\n protected downloadedUpdateHelper: DownloadedUpdateHelper | null = null\n\n /**\n * Get the update channel. Doesn't return `channel` from the update configuration, only if was previously set.\n */\n get channel(): string | null {\n return this._channel\n }\n\n /**\n * Set the update channel. Overrides `channel` in the update configuration.\n *\n * `allowDowngrade` will be automatically set to `true`. If this behavior is not suitable for you, simple set `allowDowngrade` explicitly after.\n */\n set channel(value: string | null) {\n if (this._channel != null) {\n // noinspection SuspiciousTypeOfGuard\n if (typeof value !== \"string\") {\n throw newError(`Channel must be a string, but got: ${value}`, \"ERR_UPDATER_INVALID_CHANNEL\")\n } else if (value.length === 0) {\n throw newError(`Channel must be not an empty string`, \"ERR_UPDATER_INVALID_CHANNEL\")\n }\n }\n\n this._channel = value\n this.allowDowngrade = true\n }\n\n /**\n * The request headers.\n */\n requestHeaders: OutgoingHttpHeaders | null = null\n\n /**\n * Shortcut for explicitly adding auth tokens to request headers\n */\n addAuthHeader(token: string) {\n this.requestHeaders = Object.assign({}, this.requestHeaders, {\n authorization: token,\n })\n }\n\n protected _logger: Logger = console\n\n // noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols\n get netSession(): Session {\n return getNetSession()\n }\n\n /**\n * The logger. You can pass [electron-log](https://github.com/megahertz/electron-log), [winston](https://github.com/winstonjs/winston) or another logger with the following interface: `{ info(), warn(), error() }`.\n * Set it to `null` if you would like to disable a logging feature.\n */\n get logger(): Logger | null {\n return this._logger\n }\n\n set logger(value: Logger | null) {\n this._logger = value == null ? new NoOpLogger() : value\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * For type safety you can use signals, e.g. `autoUpdater.signals.updateDownloaded(() => {})` instead of `autoUpdater.on('update-available', () => {})`\n */\n readonly signals = new UpdaterSignal(this)\n\n private _appUpdateConfigPath: string | null = null\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * test only\n * @private\n */\n set updateConfigPath(value: string | null) {\n this.clientPromise = null\n this._appUpdateConfigPath = value\n this.configOnDisk = new Lazy<any>(() => this.loadUpdateConfig())\n }\n\n protected _isUpdateSupported: VerifyUpdateSupport = updateInfo => this.checkIfUpdateSupported(updateInfo)\n\n /**\n * Allows developer to override default logic for determining if an update is supported.\n * The default logic compares the `UpdateInfo` minimum system version against the `os.release()` with `semver` package\n */\n get isUpdateSupported(): VerifyUpdateSupport {\n return this._isUpdateSupported\n }\n\n set isUpdateSupported(value: VerifyUpdateSupport) {\n if (value) {\n this._isUpdateSupported = value\n }\n }\n\n protected _isUserWithinRollout: VerifyUpdateSupport = updateInfo => this.isStagingMatch(updateInfo)\n\n /**\n * Allows developer to override default logic for determining if the user is below the rollout threshold.\n * The default logic compares the staging percentage with numerical representation of user ID.\n * An override can define custom logic, or bypass it if needed.\n */\n get isUserWithinRollout(): VerifyUpdateSupport {\n return this._isUserWithinRollout\n }\n\n set isUserWithinRollout(value: VerifyUpdateSupport) {\n if (value) {\n this._isUserWithinRollout = value\n }\n }\n\n private clientPromise: Promise<Provider<any>> | null = null\n\n protected readonly stagingUserIdPromise = new Lazy<string>(() => this.getOrCreateStagingUserId())\n\n // public, allow to read old config for anyone\n /** @internal */\n configOnDisk = new Lazy<any>(() => this.loadUpdateConfig())\n\n private checkForUpdatesPromise: Promise<UpdateCheckResult> | null = null\n private downloadPromise: Promise<DownloadExecutorResult> | null = null\n\n protected readonly app: AppAdapter\n\n protected updateInfoAndProvider: UpdateInfoAndProvider | null = null\n\n /** @internal */\n readonly httpExecutor: ElectronHttpExecutor\n\n protected constructor(options: AllPublishOptions | null | undefined, app?: AppAdapter) {\n super()\n\n this.on(\"error\", (error: Error) => {\n this._logger.error(`Error: ${error.stack || error.message}`)\n })\n\n if (app == null) {\n this.app = new ElectronAppAdapter()\n this.httpExecutor = new ElectronHttpExecutor((authInfo, callback) => this.emit(\"login\", authInfo, callback))\n } else {\n this.app = app\n this.httpExecutor = null as any\n }\n\n const currentVersionString = this.app.version\n const currentVersion = parseVersion(currentVersionString)\n if (currentVersion == null) {\n throw newError(`App version is not a valid semver version: \"${currentVersionString}\"`, \"ERR_UPDATER_INVALID_VERSION\")\n }\n this.currentVersion = currentVersion\n this.allowPrerelease = hasPrereleaseComponents(currentVersion)\n\n if (options != null) {\n this.setFeedURL(options)\n\n if (typeof options !== \"string\" && options.requestHeaders) {\n this.requestHeaders = options.requestHeaders\n }\n }\n }\n\n //noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols\n getFeedURL(): string | null | undefined {\n return \"Deprecated. Do not use it.\"\n }\n\n /**\n * Configure update provider. If value is `string`, [GenericServerOptions](https://www.electron.build/publish#genericserveroptions) will be set with value as `url`.\n * @param options If you want to override configuration in the `app-update.yml`.\n */\n setFeedURL(options: PublishConfiguration | AllPublishOptions | string) {\n const runtimeOptions = this.createProviderRuntimeOptions()\n // https://github.com/electron-userland/electron-builder/issues/1105\n let provider: Provider<any>\n if (typeof options === \"string\") {\n provider = new GenericProvider({ provider: \"generic\", url: options }, this, {\n ...runtimeOptions,\n isUseMultipleRangeRequest: isUrlProbablySupportMultiRangeRequests(options),\n })\n } else {\n provider = createClient(options, this, runtimeOptions)\n }\n this.clientPromise = Promise.resolve(provider)\n }\n\n /**\n * Asks the server whether there is an update.\n * @returns null if the updater is disabled, otherwise info about the latest version\n */\n checkForUpdates(): Promise<UpdateCheckResult | null> {\n if (!this.isUpdaterActive()) {\n return Promise.resolve(null)\n }\n\n let checkForUpdatesPromise = this.checkForUpdatesPromise\n if (checkForUpdatesPromise != null) {\n this._logger.info(\"Checking for update (already in progress)\")\n return checkForUpdatesPromise\n }\n\n const nullizePromise = () => (this.checkForUpdatesPromise = null)\n\n this._logger.info(\"Checking for update\")\n checkForUpdatesPromise = this.doCheckForUpdates()\n .then(it => {\n nullizePromise()\n return it\n })\n .catch((e: any) => {\n nullizePromise()\n this.emit(\"error\", e, `Cannot check for updates: ${(e.stack || e).toString()}`)\n throw e\n })\n\n this.checkForUpdatesPromise = checkForUpdatesPromise\n return checkForUpdatesPromise\n }\n\n public isUpdaterActive(): boolean {\n const isEnabled = this.app.isPackaged || this.forceDevUpdateConfig\n if (!isEnabled) {\n this._logger.info(\"Skip checkForUpdates because application is not packed and dev update config is not forced\")\n return false\n }\n return true\n }\n\n // noinspection JSUnusedGlobalSymbols\n checkForUpdatesAndNotify(downloadNotification?: DownloadNotification): Promise<UpdateCheckResult | null> {\n return this.checkForUpdates().then(it => {\n if (!it?.downloadPromise) {\n if (this._logger.debug != null) {\n this._logger.debug(\"checkForUpdatesAndNotify called, downloadPromise is null\")\n }\n return it\n }\n\n void it.downloadPromise.then(() => {\n const notificationContent = AppUpdater.formatDownloadNotification(it.updateInfo.version, this.app.name, downloadNotification)\n new (require(\"electron\").Notification)(notificationContent).show()\n })\n\n return it\n })\n }\n\n private static formatDownloadNotification(version: string, appName: string, downloadNotification?: DownloadNotification): DownloadNotification {\n if (downloadNotification == null) {\n downloadNotification = {\n title: \"A new update is ready to install\",\n body: `{appName} version {version} has been downloaded and will be automatically installed on exit`,\n }\n }\n downloadNotification = {\n title: downloadNotification.title.replace(\"{appName}\", appName).replace(\"{version}\", version),\n body: downloadNotification.body.replace(\"{appName}\", appName).replace(\"{version}\", version),\n }\n return downloadNotification\n }\n\n private async isStagingMatch(updateInfo: UpdateInfo): Promise<boolean> {\n const rawStagingPercentage = updateInfo.stagingPercentage\n let stagingPercentage = rawStagingPercentage\n if (stagingPercentage == null) {\n return true\n }\n\n stagingPercentage = parseInt(stagingPercentage as any, 10)\n if (isNaN(stagingPercentage)) {\n this._logger.warn(`Staging percentage is NaN: ${rawStagingPercentage}`)\n return true\n }\n\n // convert from user 0-100 to internal 0-1\n stagingPercentage = stagingPercentage / 100\n\n const stagingUserId = await this.stagingUserIdPromise.value\n const val = UUID.parse(stagingUserId).readUInt32BE(12)\n const percentage = val / 0xffffffff\n this._logger.info(`Staging percentage: ${stagingPercentage}, percentage: ${percentage}, user id: ${stagingUserId}`)\n return percentage < stagingPercentage\n }\n\n private computeFinalHeaders(headers: OutgoingHttpHeaders) {\n if (this.requestHeaders != null) {\n Object.assign(headers, this.requestHeaders)\n }\n return headers\n }\n\n private async isUpdateAvailable(updateInfo: UpdateInfo): Promise<boolean> {\n const latestVersion = parseVersion(updateInfo.version)\n if (latestVersion == null) {\n throw newError(\n `This file could not be downloaded, or the latest version (from update server) does not have a valid semver version: \"${updateInfo.version}\"`,\n \"ERR_UPDATER_INVALID_VERSION\"\n )\n }\n\n const currentVersion = this.currentVersion\n if (isVersionsEqual(latestVersion, currentVersion)) {\n return false\n }\n\n if (!(await Promise.resolve(this.isUpdateSupported(updateInfo)))) {\n return false\n }\n\n const isUserWithinRollout = await Promise.resolve(this.isUserWithinRollout(updateInfo))\n if (!isUserWithinRollout) {\n return false\n }\n\n // https://github.com/electron-userland/electron-builder/pull/3111#issuecomment-405033227\n // https://github.com/electron-userland/electron-builder/pull/3111#issuecomment-405030797\n const isLatestVersionNewer = isVersionGreaterThan(latestVersion, currentVersion)\n const isLatestVersionOlder = isVersionLessThan(latestVersion, currentVersion)\n\n if (isLatestVersionNewer) {\n return true\n }\n return this.allowDowngrade && isLatestVersionOlder\n }\n\n private checkIfUpdateSupported(updateInfo: UpdateInfo) {\n const minimumSystemVersion = updateInfo?.minimumSystemVersion\n const currentOSVersion = release()\n if (minimumSystemVersion) {\n try {\n if (isVersionLessThan(currentOSVersion, minimumSystemVersion)) {\n this._logger.info(`Current OS version ${currentOSVersion} is less than the minimum OS version required ${minimumSystemVersion} for version ${currentOSVersion}`)\n return false\n }\n } catch (e: any) {\n this._logger.warn(`Failed to compare current OS version(${currentOSVersion}) with minimum OS version(${minimumSystemVersion}): ${(e.message || e).toString()}`)\n }\n }\n return true\n }\n\n protected async getUpdateInfoAndProvider(): Promise<UpdateInfoAndProvider> {\n await this.app.whenReady()\n\n if (this.clientPromise == null) {\n this.clientPromise = this.configOnDisk.value.then(it => createClient(it, this, this.createProviderRuntimeOptions()))\n }\n\n const client = await this.clientPromise\n const stagingUserId = await this.stagingUserIdPromise.value\n client.setRequestHeaders(this.computeFinalHeaders({ \"x-user-staging-id\": stagingUserId }))\n return {\n info: await client.getLatestVersion(),\n provider: client,\n }\n }\n\n private createProviderRuntimeOptions() {\n return {\n isUseMultipleRangeRequest: true,\n platform: this._testOnlyOptions == null ? (process.platform as ProviderPlatform) : this._testOnlyOptions.platform,\n executor: this.httpExecutor,\n }\n }\n\n private async doCheckForUpdates(): Promise<UpdateCheckResult> {\n this.emit(\"checking-for-update\")\n\n const result = await this.getUpdateInfoAndProvider()\n const updateInfo = result.info\n if (!(await this.isUpdateAvailable(updateInfo))) {\n this._logger.info(\n `Update for version ${this.currentVersion.format()} is not available (latest version: ${updateInfo.version}, downgrade is ${\n this.allowDowngrade ? \"allowed\" : \"disallowed\"\n }).`\n )\n this.emit(\"update-not-available\", updateInfo)\n return {\n isUpdateAvailable: false,\n versionInfo: updateInfo,\n updateInfo,\n }\n }\n\n this.updateInfoAndProvider = result\n this.onUpdateAvailable(updateInfo)\n\n const cancellationToken = new CancellationToken()\n //noinspection ES6MissingAwait\n return {\n isUpdateAvailable: true,\n versionInfo: updateInfo,\n updateInfo,\n cancellationToken,\n downloadPromise: this.autoDownload ? this.downloadUpdate(cancellationToken) : null,\n }\n }\n\n protected onUpdateAvailable(updateInfo: UpdateInfo): void {\n this._logger.info(\n `Found version ${updateInfo.version} (url: ${asArray(updateInfo.files)\n .map(it => it.url)\n .join(\", \")})`\n )\n this.emit(\"update-available\", updateInfo)\n }\n\n /**\n * Start downloading update manually. You can use this method if `autoDownload` option is set to `false`.\n * @returns {Promise<Array<string>>} Paths to downloaded files.\n */\n downloadUpdate(cancellationToken: CancellationToken = new CancellationToken()): Promise<Array<string>> {\n const updateInfoAndProvider = this.updateInfoAndProvider\n if (updateInfoAndProvider == null) {\n const error = new Error(\"Please check update first\")\n this.dispatchError(error)\n return Promise.reject(error)\n }\n\n if (this.downloadPromise != null) {\n this._logger.info(\"Downloading update (already in progress)\")\n return this.downloadPromise.then(toDownloadedFilesArray)\n }\n\n this._logger.info(\n `Downloading update from ${asArray(updateInfoAndProvider.info.files)\n .map(it => it.url)\n .join(\", \")}`\n )\n const errorHandler = (e: Error): Error => {\n // https://github.com/electron-userland/electron-builder/issues/1150#issuecomment-436891159\n if (!(e instanceof CancellationError)) {\n try {\n this.dispatchError(e)\n } catch (nestedError: any) {\n this._logger.warn(`Cannot dispatch error event: ${nestedError.stack || nestedError}`)\n }\n }\n\n return e\n }\n\n this.downloadPromise = this.doDownloadUpdate({\n updateInfoAndProvider,\n requestHeaders: this.computeRequestHeaders(updateInfoAndProvider.provider),\n cancellationToken,\n disableWebInstaller: this.disableWebInstaller,\n disableDifferentialDownload: this.disableDifferentialDownload,\n })\n .catch((e: any) => {\n throw errorHandler(e)\n })\n .finally(() => {\n this.downloadPromise = null\n })\n\n return this.downloadPromise.then(toDownloadedFilesArray)\n }\n\n protected dispatchError(e: Error): void {\n this.emit(\"error\", e, (e.stack || e).toString())\n }\n\n protected dispatchUpdateDownloaded(event: UpdateDownloadedEvent): void {\n this.emit(UPDATE_DOWNLOADED, event)\n }\n\n protected abstract doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<DownloadExecutorResult>\n\n /**\n * Restarts the app and installs the update after it has been downloaded.\n * It should only be called after `update-downloaded` has been emitted.\n *\n * **Note:** `autoUpdater.quitAndInstall()` will close all application windows first and only emit `before-quit` event on `app` after that.\n * This is different from the normal quit event sequence.\n *\n * @param isSilent *windows-only* Runs the installer in silent mode. Defaults to `false`.\n * @param isForceRunAfter Run the app after finish even on silent install. Not applicable for macOS.\n * Ignored if `isSilent` is set to `false`(In this case you can still set `autoRunAppAfterInstall` to `false` to prevent run the app after finish).\n */\n abstract quitAndInstall(isSilent?: boolean, isForceRunAfter?: boolean): void\n\n private async loadUpdateConfig(): Promise<any> {\n if (this._appUpdateConfigPath == null) {\n this._appUpdateConfigPath = this.app.appUpdateConfigPath\n }\n return load(await readFile(this._appUpdateConfigPath, \"utf-8\"))\n }\n\n private computeRequestHeaders(provider: Provider<any>): OutgoingHttpHeaders {\n const fileExtraDownloadHeaders = provider.fileExtraDownloadHeaders\n if (fileExtraDownloadHeaders != null) {\n const requestHeaders = this.requestHeaders\n return requestHeaders == null\n ? fileExtraDownloadHeaders\n : {\n ...fileExtraDownloadHeaders,\n ...requestHeaders,\n }\n }\n return this.computeFinalHeaders({ accept: \"*/*\" })\n }\n\n private async getOrCreateStagingUserId(): Promise<string> {\n const file = path.join(this.app.userDataPath, \".updaterId\")\n try {\n const id = await readFile(file, \"utf-8\")\n if (UUID.check(id)) {\n return id\n } else {\n this._logger.warn(`Staging user id file exists, but content was invalid: ${id}`)\n }\n } catch (e: any) {\n if (e.code !== \"ENOENT\") {\n this._logger.warn(`Couldn't read staging user ID, creating a blank one: ${e}`)\n }\n }\n\n const id = UUID.v5(randomBytes(4096), UUID.OID)\n this._logger.info(`Generated new staging user ID: ${id}`)\n try {\n await outputFile(file, id)\n } catch (e: any) {\n this._logger.warn(`Couldn't write out staging user ID: ${e}`)\n }\n return id\n }\n\n /** @internal */\n get isAddNoCacheQuery(): boolean {\n const headers = this.requestHeaders\n // https://github.com/electron-userland/electron-builder/issues/3021\n if (headers == null) {\n return true\n }\n\n for (const headerName of Object.keys(headers)) {\n const s = headerName.toLowerCase()\n if (s === \"authorization\" || s === \"private-token\") {\n return false\n }\n }\n return true\n }\n\n /**\n * @private\n * @internal\n */\n _testOnlyOptions: TestOnlyUpdaterOptions | null = null\n\n private async getOrCreateDownloadHelper(): Promise<DownloadedUpdateHelper> {\n let result = this.downloadedUpdateHelper\n if (result == null) {\n const dirName = (await this.configOnDisk.value).updaterCacheDirName\n const logger = this._logger\n if (dirName == null) {\n logger.error(\"updaterCacheDirName is not specified in app-update.yml Was app build using at least electron-builder 20.34.0?\")\n }\n const cacheDir = path.join(this.app.baseCachePath, dirName || this.app.name)\n if (logger.debug != null) {\n logger.debug(`updater cache dir: ${cacheDir}`)\n }\n\n result = new DownloadedUpdateHelper(cacheDir)\n this.downloadedUpdateHelper = result\n }\n return result\n }\n\n protected async executeDownload(taskOptions: DownloadExecutorTask): Promise<DownloadExecutorResult> {\n const fileInfo = taskOptions.fileInfo\n const downloadOptions: DownloadOptions = {\n headers: taskOptions.downloadUpdateOptions.requestHeaders,\n cancellationToken: taskOptions.downloadUpdateOptions.cancellationToken,\n sha2: (fileInfo.info as any).sha2,\n sha512: fileInfo.info.sha512,\n }\n\n if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) {\n downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it)\n }\n\n const updateInfo = taskOptions.downloadUpdateOptions.updateInfoAndProvider.info\n const version = updateInfo.version\n const packageInfo = fileInfo.packageInfo\n\n function getCacheUpdateFileName(): string {\n // NodeJS URL doesn't decode automatically\n const urlPath = decodeURIComponent(taskOptions.fileInfo.url.pathname)\n if (urlPath.toLowerCase().endsWith(`.${taskOptions.fileExtension.toLowerCase()}`)) {\n return path.basename(urlPath)\n } else {\n // url like /latest — use basename so a server-supplied path like \"../../etc/evil\"\n // cannot escape the cache directory via path.join\n return path.basename(taskOptions.fileInfo.info.url)\n }\n }\n\n const downloadedUpdateHelper = await this.getOrCreateDownloadHelper()\n const cacheDir = downloadedUpdateHelper.cacheDirForPendingUpdate\n await mkdir(cacheDir, { recursive: true })\n const updateFileName = getCacheUpdateFileName()\n let updateFile = path.join(cacheDir, updateFileName)\n const packageFile = packageInfo == null ? null : path.join(cacheDir, `package-${version}${path.extname(packageInfo.path) || \".7z\"}`)\n\n const pendingBlockMapFile = path.join(cacheDir, \"current.blockmap\")\n const cachedBlockMapFile = path.join(downloadedUpdateHelper.cacheDir, \"current.blockmap\")\n const done = async (isSaveCache: boolean) => {\n await downloadedUpdateHelper.setDownloadedFile(updateFile, packageFile, updateInfo, fileInfo, updateFileName, isSaveCache)\n await taskOptions.done!({\n ...updateInfo,\n downloadedFile: updateFile,\n })\n if (await pathExists(pendingBlockMapFile)) {\n await copyFile(pendingBlockMapFile, cachedBlockMapFile)\n } else if (!taskOptions.downloadUpdateOptions.disableDifferentialDownload) {\n // this download did not produce a blockmap, but `taskOptions.done` above refreshes the cached installer —\n // remove the cached blockmap too, so a stale one cannot sit next to a fresh file and poison the next\n // differential download with a wrong copy plan (https://github.com/electron-userland/electron-builder/issues/10097).\n // The differential downloader re-fetches the old blockmap from the server when no cached one exists.\n await remove(cachedBlockMapFile)\n }\n return packageFile == null ? { updateFile } : { updateFile, packageFile }\n }\n\n const log = this._logger\n const cachedUpdateFile = await downloadedUpdateHelper.validateDownloadedPath(updateFile, updateInfo, fileInfo, log)\n if (cachedUpdateFile != null) {\n updateFile = cachedUpdateFile\n return await done(false)\n }\n\n const removeFileIfAny = async () => {\n await downloadedUpdateHelper.clear().catch(() => {\n // ignore\n })\n return await unlink(updateFile).catch(() => {\n // ignore\n })\n }\n\n // a fresh download starts — drop any blockmap left over from a previous update round, so that when this round\n // does not produce a new one (e.g. the differential download is skipped), the leftover cannot be promoted to the\n // cache next to a file it does not describe\n await remove(pendingBlockMapFile)\n\n const tempUpdateFile = await createTempUpdateFile(`temp-${updateFileName}`, cacheDir, log)\n try {\n await taskOptions.task(tempUpdateFile, downloadOptions, packageFile, removeFileIfAny)\n await retry(() => rename(tempUpdateFile, updateFile), {\n retries: 60,\n interval: 500,\n shouldRetry: (error: Error) => {\n if (error instanceof Error && /^EBUSY:/.test(error.message)) {\n return true\n }\n log.warn(`Cannot rename temp file to final file: ${error.message || error.stack}`)\n return false\n },\n })\n } catch (e: any) {\n await removeFileIfAny()\n\n if (e instanceof CancellationError) {\n log.info(\"cancelled\")\n this.emit(\"update-cancelled\", updateInfo)\n } else if (e.code === \"ERR_CHECKSUM_MISMATCH\") {\n // a differential-download failure never escapes the task (it falls back to a full download),\n // so a checksum mismatch here means the fully downloaded file itself failed verification\n log.warn(\n `sha512 checksum mismatch after full download of ${updateFileName}: the downloaded file is corrupted or the published update metadata does not match the uploaded file`\n )\n }\n throw e\n }\n\n log.info(`New version ${version} has been downloaded to ${updateFile}`)\n return await done(true)\n }\n protected async differentialDownloadInstaller(\n fileInfo: ResolvedUpdateFileInfo,\n downloadUpdateOptions: DownloadUpdateOptions,\n installerPath: string,\n provider: Provider<any>,\n oldInstallerFileName: string\n ): Promise<boolean> {\n let isOldBlockMapFromCache = false\n try {\n if (this._testOnlyOptions != null && !this._testOnlyOptions.isUseDifferentialDownload) {\n return true\n }\n const provider = downloadUpdateOptions.updateInfoAndProvider.provider\n const blockmapFileUrls = await provider.getBlockMapFiles(\n fileInfo.url,\n this.app.version,\n downloadUpdateOptions.updateInfoAndProvider.info.version,\n this.previousBlockmapBaseUrlOverride\n )\n this._logger.info(`Download block maps (old: \"${blockmapFileUrls[0]}\", new: ${blockmapFileUrls[1]})`)\n\n const downloadBlockMap = async (url: URL): Promise<BlockMap> => {\n const data = await this.httpExecutor.downloadToBuffer(url, {\n headers: downloadUpdateOptions.requestHeaders,\n cancellationToken: downloadUpdateOptions.cancellationToken,\n })\n\n if (data == null || data.length === 0) {\n throw new Error(`Blockmap \"${url.href}\" is empty`)\n }\n\n try {\n return JSON.parse(gunzipSync(data).toString())\n } catch (e: any) {\n throw new Error(`Cannot parse blockmap \"${url.href}\", error: ${e}`)\n }\n }\n\n const downloadOptions: DifferentialDownloaderOptions = {\n newUrl: fileInfo.url,\n oldFile: path.join(this.downloadedUpdateHelper!.cacheDir, oldInstallerFileName),\n logger: this._logger,\n newFile: installerPath,\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 const saveBlockMapToCacheDir = async (blockMapData: BlockMap, cacheDir: string) => {\n const blockMapFile = path.join(cacheDir, \"current.blockmap\")\n await outputFile(blockMapFile, gzipSync(JSON.stringify(blockMapData)))\n }\n\n const getBlockMapFromCacheDir = async (cacheDir: string) => {\n const blockMapFile = path.join(cacheDir, \"current.blockmap\")\n try {\n if (await pathExists(blockMapFile)) {\n return JSON.parse(gunzipSync(await readFile(blockMapFile)).toString())\n }\n } catch (e: any) {\n this._logger.warn(`Cannot parse blockmap \"${blockMapFile}\", error: ${e}`)\n }\n return null\n }\n\n const newBlockMapData = await downloadBlockMap(blockmapFileUrls[1])\n await saveBlockMapToCacheDir(newBlockMapData, this.downloadedUpdateHelper!.cacheDirForPendingUpdate)\n\n // get old blockmap from cache dir first, if not found, download it\n let oldBlockMapData = await getBlockMapFromCacheDir(this.downloadedUpdateHelper!.cacheDir)\n isOldBlockMapFromCache = oldBlockMapData != null\n if (oldBlockMapData == null) {\n this._logger.info(`No cached blockmap for the old installer, downloading it from \"${blockmapFileUrls[0]}\"`)\n oldBlockMapData = await downloadBlockMap(blockmapFileUrls[0])\n }\n\n await new GenericDifferentialDownloader(fileInfo.info, this.httpExecutor, downloadOptions).download(oldBlockMapData, newBlockMapData)\n return false\n } catch (e: any) {\n if (e.code === \"ERR_CHECKSUM_MISMATCH\") {\n this._logger.warn(\n `sha512 checksum mismatch after differential download (old blockmap ${\n isOldBlockMapFromCache ? \"was read from the local cache\" : \"was downloaded from the server\"\n }): cached \"${oldInstallerFileName}\" is likely out of sync with the old blockmap, e.g. because one of them was replaced or evicted independently of the other`\n )\n }\n this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`)\n if (this._testOnlyOptions != null) {\n // test mode\n throw e\n }\n return true\n }\n }\n}\n\nexport interface DownloadUpdateOptions {\n readonly updateInfoAndProvider: UpdateInfoAndProvider\n readonly requestHeaders: OutgoingHttpHeaders\n readonly cancellationToken: CancellationToken\n readonly disableWebInstaller?: boolean\n readonly disableDifferentialDownload?: boolean\n}\n\nfunction hasPrereleaseComponents(version: SemVer) {\n const versionPrereleaseComponent = getVersionPreleaseComponents(version)\n return versionPrereleaseComponent != null && versionPrereleaseComponent.length > 0\n}\n\n/** @private */\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\nexport interface UpdateInfoAndProvider {\n info: UpdateInfo\n provider: Provider<any>\n}\n\nexport interface DownloadExecutorTask {\n readonly fileExtension: string\n readonly fileInfo: ResolvedUpdateFileInfo\n readonly downloadUpdateOptions: DownloadUpdateOptions\n readonly task: (destinationFile: string, downloadOptions: DownloadOptions, packageFile: string | null, removeTempDirIfAny: () => Promise<any>) => Promise<any>\n\n readonly done?: (event: UpdateDownloadedEvent) => Promise<any>\n}\n\nexport interface DownloadExecutorResult {\n readonly updateFile: string\n readonly packageFile?: string\n}\n\nfunction toDownloadedFilesArray({ updateFile, packageFile }: DownloadExecutorResult): Array<string> {\n return packageFile == null ? [updateFile] : [updateFile, packageFile]\n}\n\nexport interface DownloadNotification {\n body: string\n title: string\n}\n\n/** @private */\nexport interface TestOnlyUpdaterOptions {\n platform: ProviderPlatform\n\n isUseDifferentialDownload?: boolean\n}\n"]}
@@ -1,13 +1,13 @@
1
1
  import { AllPublishOptions } from "builder-util-runtime";
2
2
  import { StdioOptions } from "child_process";
3
3
  import { AppAdapter } from "./AppAdapter";
4
- import { AppUpdater, DownloadExecutorTask } from "./AppUpdater";
4
+ import { AppUpdater, DownloadExecutorResult, DownloadExecutorTask } from "./AppUpdater";
5
5
  export declare abstract class BaseUpdater extends AppUpdater {
6
6
  protected quitAndInstallCalled: boolean;
7
7
  private quitHandlerAdded;
8
8
  protected constructor(options?: AllPublishOptions | null, app?: AppAdapter);
9
9
  quitAndInstall(isSilent?: boolean, isForceRunAfter?: boolean): void;
10
- protected executeDownload(taskOptions: DownloadExecutorTask): Promise<Array<string>>;
10
+ protected executeDownload(taskOptions: DownloadExecutorTask): Promise<DownloadExecutorResult>;
11
11
  protected get installerPath(): string | null;
12
12
  protected abstract doInstall(options: InstallOptions): boolean;
13
13
  install(isSilent?: boolean, isForceRunAfter?: boolean): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseUpdater.js","sourceRoot":"","sources":["../src/BaseUpdater.ts"],"names":[],"mappings":";;;AACA,iDAA4E;AAC5E,6BAA4B;AAE5B,6CAA+D;AAE/D,MAAsB,WAAY,SAAQ,uBAAU;IAIlD,YAAsB,OAAkC,EAAE,GAAgB;QACxE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;QAJX,yBAAoB,GAAG,KAAK,CAAA;QAC9B,qBAAgB,GAAG,KAAK,CAAA;IAIhC,CAAC;IAED,cAAc,CAAC,QAAQ,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAA;QACvD,+FAA+F;QAC/F,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;QACpG,IA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AC1B,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,qBAAqB,MAAM,EAAE,CAAC,CAAA;QAC9D,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,oEAAoE;IACpE,4GAA4G;IAClG,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,OAAiB,EAAE,EAAE,MAAW,SAAS,EAAE,QAAsB,QAAQ;QAC7G,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,GAAG,eAAe,IAAI,EAAE,CAAC,CAAA;QACzD,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC;gBACH,MAAM,MAAM,GAAiB,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBAC3D,MAAM,CAAC,GAAG,IAAA,qBAAK,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;gBAClC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBACpB,MAAM,CAAC,KAAK,CAAC,CAAA;gBACf,CAAC,CAAC,CAAA;gBACF,CAAC,CAAC,KAAK,EAAE,CAAA;gBACT,IAAI,CAAC,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,CAAC,IAAI,CAAC,CAAA;gBACf,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA9JD,kCA8JC","sourcesContent":["import { AllPublishOptions } from \"builder-util-runtime\"\nimport { spawn, SpawnOptions, spawnSync, StdioOptions } from \"child_process\"\nimport * as path from \"path\"\nimport { AppAdapter } from \"./AppAdapter\"\nimport { AppUpdater, DownloadExecutorTask } from \"./AppUpdater\"\n\nexport abstract class BaseUpdater extends AppUpdater {\n protected quitAndInstallCalled = false\n private quitHandlerAdded = false\n\n protected constructor(options?: AllPublishOptions | null, app?: AppAdapter) {\n super(options, app)\n }\n\n quitAndInstall(isSilent = false, isForceRunAfter = false): void {\n this._logger.info(`Install on explicit quitAndInstall`)\n // If NOT in silent mode use `autoRunAppAfterInstall` to determine whether to force run the app\n const isInstalled = this.install(isSilent, isSilent ? isForceRunAfter : this.autoRunAppAfterInstall)\n if (isInstalled) {\n setImmediate(() => {\n // this event is normally emitted when calling quitAndInstall, this emulates that\n require(\"electron\").autoUpdater.emit(\"before-quit-for-update\")\n this.app.quit()\n })\n } else {\n this.quitAndInstallCalled = false\n }\n }\n\n protected executeDownload(taskOptions: DownloadExecutorTask): Promise<Array<string>> {\n return super.executeDownload({\n ...taskOptions,\n done: event => {\n this.dispatchUpdateDownloaded(event)\n this.addQuitHandler()\n return Promise.resolve()\n },\n })\n }\n\n protected get installerPath(): string | null {\n return this.downloadedUpdateHelper == null ? null : this.downloadedUpdateHelper.file\n }\n\n // must be sync\n protected abstract doInstall(options: InstallOptions): boolean\n\n // must be sync (because quit even handler is not async)\n install(isSilent = false, isForceRunAfter = false): boolean {\n if (this.quitAndInstallCalled) {\n this._logger.warn(\"install call ignored: quitAndInstallCalled is set to true\")\n return false\n }\n\n const downloadedUpdateHelper = this.downloadedUpdateHelper\n const installerPath = this.installerPath\n const downloadedFileInfo = downloadedUpdateHelper == null ? null : downloadedUpdateHelper.downloadedFileInfo\n if (installerPath == null || downloadedFileInfo == null) {\n this.dispatchError(new Error(\"No update filepath provided, can't quit and install\"))\n return false\n }\n\n // prevent calling several times\n this.quitAndInstallCalled = true\n\n try {\n this._logger.info(`Install: isSilent: ${isSilent}, isForceRunAfter: ${isForceRunAfter}`)\n return this.doInstall({\n isSilent,\n isForceRunAfter,\n isAdminRightsRequired: downloadedFileInfo.isAdminRightsRequired,\n })\n } catch (e: any) {\n this.dispatchError(e)\n return false\n }\n }\n\n protected addQuitHandler(): void {\n if (this.quitHandlerAdded || !this.autoInstallOnAppQuit) {\n return\n }\n\n this.quitHandlerAdded = true\n\n this.app.onQuit(exitCode => {\n if (this.quitAndInstallCalled) {\n this._logger.info(\"Update installer has already been triggered. Quitting application.\")\n return\n }\n\n if (!this.autoInstallOnAppQuit) {\n this._logger.info(\"Update will not be installed on quit because autoInstallOnAppQuit is set to false.\")\n return\n }\n\n if (exitCode !== 0) {\n this._logger.info(`Update will be not installed on quit because application is quitting with exit code ${exitCode}`)\n return\n }\n\n this._logger.info(\"Auto install update on quit\")\n this.install(true, false)\n })\n }\n\n /**\n * Strips relative-path entries from a PATH string.\n * Prevents PATH-poisoning where a writable directory earlier in PATH shadows\n * a trusted package manager binary.\n */\n protected sanitizeEnvPath(envPath: string): string {\n return envPath\n .split(path.delimiter)\n .filter((dir: string) => path.isAbsolute(dir))\n .join(path.delimiter)\n }\n\n protected spawnSyncLog(cmd: string, args: string[] = [], env = {}): string {\n this._logger.info(`Executing: ${cmd} with args: ${args}`)\n const mergedEnv: NodeJS.ProcessEnv = { ...process.env, ...env }\n const response = spawnSync(cmd, args, {\n env: { ...mergedEnv, PATH: this.sanitizeEnvPath(mergedEnv.PATH ?? \"\") },\n encoding: \"utf-8\",\n shell: true,\n })\n\n const { error, status, stdout, stderr } = response\n if (error != null) {\n this._logger.error(stderr)\n throw error\n } else if (status != null && status !== 0) {\n this._logger.error(stderr)\n throw new Error(`Command ${cmd} exited with code ${status}`)\n }\n\n return stdout.trim()\n }\n\n /**\n * This handles both node 8 and node 10 way of emitting error when spawning a process\n * - node 8: Throws the error\n * - node 10: Emit the error(Need to listen with on)\n */\n // https://github.com/electron-userland/electron-builder/issues/1129\n // Node 8 sends errors: https://nodejs.org/dist/latest-v8.x/docs/api/errors.html#errors_common_system_errors\n protected async spawnLog(cmd: string, args: string[] = [], env: any = undefined, stdio: StdioOptions = \"ignore\"): Promise<boolean> {\n this._logger.info(`Executing: ${cmd} with args: ${args}`)\n return new Promise<boolean>((resolve, reject) => {\n try {\n const params: SpawnOptions = { stdio, env, detached: true }\n const p = spawn(cmd, args, params)\n p.on(\"error\", error => {\n reject(error)\n })\n p.unref()\n if (p.pid !== undefined) {\n resolve(true)\n }\n } catch (error) {\n reject(error)\n }\n })\n }\n}\n\nexport interface InstallOptions {\n readonly isSilent: boolean\n readonly isForceRunAfter: boolean\n readonly isAdminRightsRequired: boolean\n}\n"]}
1
+ {"version":3,"file":"BaseUpdater.js","sourceRoot":"","sources":["../src/BaseUpdater.ts"],"names":[],"mappings":";;;AACA,iDAA4E;AAC5E,6BAA4B;AAE5B,6CAAuF;AAEvF,MAAsB,WAAY,SAAQ,uBAAU;IAIlD,YAAsB,OAAkC,EAAE,GAAgB;QACxE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;QAJX,yBAAoB,GAAG,KAAK,CAAA;QAC9B,qBAAgB,GAAG,KAAK,CAAA;IAIhC,CAAC;IAED,cAAc,CAAC,QAAQ,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAA;QACvD,+FAA+F;QAC/F,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;QACpG,IAAI,WAAW,EAAE,CAAC;YAChB,YAAY,CAAC,GAAG,EAAE;gBAChB,iFAAiF;gBACjF,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;gBAC9D,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;YACjB,CAAC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAA;QACnC,CAAC;IACH,CAAC;IAES,eAAe,CAAC,WAAiC;QACzD,OAAO,KAAK,CAAC,eAAe,CAAC;YAC3B,GAAG,WAAW;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CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC;gBACH,MAAM,MAAM,GAAiB,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBAC3D,MAAM,CAAC,GAAG,IAAA,qBAAK,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;gBAClC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBACpB,MAAM,CAAC,KAAK,CAAC,CAAA;gBACf,CAAC,CAAC,CAAA;gBACF,CAAC,CAAC,KAAK,EAAE,CAAA;gBACT,IAAI,CAAC,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,CAAC,IAAI,CAAC,CAAA;gBACf,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA9JD,kCA8JC","sourcesContent":["import { AllPublishOptions } from \"builder-util-runtime\"\nimport { spawn, SpawnOptions, spawnSync, StdioOptions } from \"child_process\"\nimport * as path from \"path\"\nimport { AppAdapter } from \"./AppAdapter\"\nimport { AppUpdater, DownloadExecutorResult, DownloadExecutorTask } from \"./AppUpdater\"\n\nexport abstract class BaseUpdater extends AppUpdater {\n protected quitAndInstallCalled = false\n private quitHandlerAdded = false\n\n protected constructor(options?: AllPublishOptions | null, app?: AppAdapter) {\n super(options, app)\n }\n\n quitAndInstall(isSilent = false, isForceRunAfter = false): void {\n this._logger.info(`Install on explicit quitAndInstall`)\n // If NOT in silent mode use `autoRunAppAfterInstall` to determine whether to force run the app\n const isInstalled = this.install(isSilent, isSilent ? isForceRunAfter : this.autoRunAppAfterInstall)\n if (isInstalled) {\n setImmediate(() => {\n // this event is normally emitted when calling quitAndInstall, this emulates that\n require(\"electron\").autoUpdater.emit(\"before-quit-for-update\")\n this.app.quit()\n })\n } else {\n this.quitAndInstallCalled = false\n }\n }\n\n protected executeDownload(taskOptions: DownloadExecutorTask): Promise<DownloadExecutorResult> {\n return super.executeDownload({\n ...taskOptions,\n done: event => {\n this.dispatchUpdateDownloaded(event)\n this.addQuitHandler()\n return Promise.resolve()\n },\n })\n }\n\n protected get installerPath(): string | null {\n return this.downloadedUpdateHelper == null ? null : this.downloadedUpdateHelper.file\n }\n\n // must be sync\n protected abstract doInstall(options: InstallOptions): boolean\n\n // must be sync (because quit even handler is not async)\n install(isSilent = false, isForceRunAfter = false): boolean {\n if (this.quitAndInstallCalled) {\n this._logger.warn(\"install call ignored: quitAndInstallCalled is set to true\")\n return false\n }\n\n const downloadedUpdateHelper = this.downloadedUpdateHelper\n const installerPath = this.installerPath\n const downloadedFileInfo = downloadedUpdateHelper == null ? null : downloadedUpdateHelper.downloadedFileInfo\n if (installerPath == null || downloadedFileInfo == null) {\n this.dispatchError(new Error(\"No update filepath provided, can't quit and install\"))\n return false\n }\n\n // prevent calling several times\n this.quitAndInstallCalled = true\n\n try {\n this._logger.info(`Install: isSilent: ${isSilent}, isForceRunAfter: ${isForceRunAfter}`)\n return this.doInstall({\n isSilent,\n isForceRunAfter,\n isAdminRightsRequired: downloadedFileInfo.isAdminRightsRequired,\n })\n } catch (e: any) {\n this.dispatchError(e)\n return false\n }\n }\n\n protected addQuitHandler(): void {\n if (this.quitHandlerAdded || !this.autoInstallOnAppQuit) {\n return\n }\n\n this.quitHandlerAdded = true\n\n this.app.onQuit(exitCode => {\n if (this.quitAndInstallCalled) {\n this._logger.info(\"Update installer has already been triggered. Quitting application.\")\n return\n }\n\n if (!this.autoInstallOnAppQuit) {\n this._logger.info(\"Update will not be installed on quit because autoInstallOnAppQuit is set to false.\")\n return\n }\n\n if (exitCode !== 0) {\n this._logger.info(`Update will be not installed on quit because application is quitting with exit code ${exitCode}`)\n return\n }\n\n this._logger.info(\"Auto install update on quit\")\n this.install(true, false)\n })\n }\n\n /**\n * Strips relative-path entries from a PATH string.\n * Prevents PATH-poisoning where a writable directory earlier in PATH shadows\n * a trusted package manager binary.\n */\n protected sanitizeEnvPath(envPath: string): string {\n return envPath\n .split(path.delimiter)\n .filter((dir: string) => path.isAbsolute(dir))\n .join(path.delimiter)\n }\n\n protected spawnSyncLog(cmd: string, args: string[] = [], env = {}): string {\n this._logger.info(`Executing: ${cmd} with args: ${args}`)\n const mergedEnv: NodeJS.ProcessEnv = { ...process.env, ...env }\n const response = spawnSync(cmd, args, {\n env: { ...mergedEnv, PATH: this.sanitizeEnvPath(mergedEnv.PATH ?? \"\") },\n encoding: \"utf-8\",\n shell: true,\n })\n\n const { error, status, stdout, stderr } = response\n if (error != null) {\n this._logger.error(stderr)\n throw error\n } else if (status != null && status !== 0) {\n this._logger.error(stderr)\n throw new Error(`Command ${cmd} exited with code ${status}`)\n }\n\n return stdout.trim()\n }\n\n /**\n * This handles both node 8 and node 10 way of emitting error when spawning a process\n * - node 8: Throws the error\n * - node 10: Emit the error(Need to listen with on)\n */\n // https://github.com/electron-userland/electron-builder/issues/1129\n // Node 8 sends errors: https://nodejs.org/dist/latest-v8.x/docs/api/errors.html#errors_common_system_errors\n protected async spawnLog(cmd: string, args: string[] = [], env: any = undefined, stdio: StdioOptions = \"ignore\"): Promise<boolean> {\n this._logger.info(`Executing: ${cmd} with args: ${args}`)\n return new Promise<boolean>((resolve, reject) => {\n try {\n const params: SpawnOptions = { stdio, env, detached: true }\n const p = spawn(cmd, args, params)\n p.on(\"error\", error => {\n reject(error)\n })\n p.unref()\n if (p.pid !== undefined) {\n resolve(true)\n }\n } catch (error) {\n reject(error)\n }\n })\n }\n}\n\nexport interface InstallOptions {\n readonly isSilent: boolean\n readonly isForceRunAfter: boolean\n readonly isAdminRightsRequired: boolean\n}\n"]}
@@ -1,13 +1,13 @@
1
1
  import { AllPublishOptions } from "builder-util-runtime";
2
2
  import { AppAdapter } from "./AppAdapter";
3
- import { DownloadUpdateOptions } from "./AppUpdater";
3
+ import { DownloadExecutorResult, DownloadUpdateOptions } from "./AppUpdater";
4
4
  import { InstallOptions } from "./BaseUpdater";
5
5
  import { Logger } from "./types";
6
6
  import { LinuxUpdater } from "./LinuxUpdater";
7
7
  export declare class DebUpdater extends LinuxUpdater {
8
8
  constructor(options?: AllPublishOptions | null, app?: AppAdapter);
9
9
  /*** @private */
10
- protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>>;
10
+ protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<DownloadExecutorResult>;
11
11
  protected doInstall(options: InstallOptions): boolean;
12
12
  static installWithCommandRunner(packageManager: "dpkg" | "apt", installerPath: string, commandRunner: (commandWithArgs: string[]) => void, logger: Logger): void;
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DebUpdater.js","sourceRoot":"","sources":["../src/DebUpdater.ts"],"names":[],"mappings":";;;AAIA,mDAA+C;AAC/C,mCAAmD;AACnD,iDAA6C;AAE7C,MAAa,UAAW,SAAQ,2BAAY;IAC1C,YAAY,OAAkC,EAAE,GAAgB;QAC9D,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,gBAAgB;IACN,gBAAgB,CAAC,qBAA4C;QACrE,MAAM,QAAQ,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,QAAQ,CAAA;QACrE,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,QAAQ,CAAC,YAAY,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAE,CAAA;QACzI,OAAO,IAAI,CAAC,eAAe,CAAC;YAC1B,aAAa,EAAE,KAAK;YACpB,QAAQ;YACR,qBAAqB;YACrB,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE;gBAC1C,IAAI,IAAI,CAAC,aAAa,CAAC,yBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC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C;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,cAA8B,EAAE,aAAqB,EAAE,aAAkD,EAAE,MAAc;;QACvJ,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACH,oDAAoD;gBACpD,aAAa,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAA;YAC9C,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,0CAA0C;gBAC1C,MAAM,CAAC,IAAI,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC,CAAA;gBACnC,MAAM,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAA;gBACvF,aAAa,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;YACnD,CAAC;QACH,CAAC;aAAM,IAAI,cAAc,KAAK,KAAK,EAAE,CAAC;YACpC,qEAAqE;YACrE,MAAM,CAAC,IAAI,CAAC,oGAAoG,CAAC,CAAA;YACjH,aAAa,CAAC;gBACZ,KAAK;gBACL,SAAS;gBACT,IAAI;gBACJ,yBAAyB,EAAE,4BAA4B;gBACvD,oBAAoB,EAAE,+BAA+B;gBACrD,8BAA8B;gBAC9B,aAAa;aACd,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,mBAAmB,cAAc,gBAAgB,CAAC,CAAA;QACpE,CAAC;IACH,CAAC;CACF;AAzED,gCAyEC","sourcesContent":["import { AllPublishOptions } from \"builder-util-runtime\"\nimport { AppAdapter } from \"./AppAdapter\"\nimport { DownloadUpdateOptions } from \"./AppUpdater\"\nimport { InstallOptions } from \"./BaseUpdater\"\nimport { findFile } from \"./providers/Provider\"\nimport { DOWNLOAD_PROGRESS, Logger } from \"./types\"\nimport { LinuxUpdater } from \"./LinuxUpdater\"\n\nexport class DebUpdater extends LinuxUpdater {\n constructor(options?: AllPublishOptions | null, app?: AppAdapter) {\n super(options, app)\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), \"deb\", [\"AppImage\", \"rpm\", \"pacman\"])!\n return this.executeDownload({\n fileExtension: \"deb\",\n fileInfo,\n downloadUpdateOptions,\n task: async (updateFile, downloadOptions) => {\n if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) {\n downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it)\n }\n await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)\n },\n })\n }\n\n protected doInstall(options: InstallOptions): boolean {\n const installerPath = this.installerPath\n if (installerPath == null) {\n this.dispatchError(new Error(\"No update filepath provided, can't quit and install\"))\n return false\n }\n if (!this.hasCommand(\"dpkg\") && !this.hasCommand(\"apt\")) {\n this.dispatchError(new Error(\"Neither dpkg nor apt command found. Cannot install .deb package.\"))\n return false\n }\n const priorityList = [\"dpkg\", \"apt\"]\n const packageManager = this.detectPackageManager(priorityList)\n try {\n DebUpdater.installWithCommandRunner(packageManager as any, installerPath, this.runCommandWithSudoIfNeeded.bind(this), this._logger)\n } catch (error: any) {\n this.dispatchError(error)\n return false\n }\n if (options.isForceRunAfter) {\n this.app.relaunch()\n }\n return true\n }\n\n static installWithCommandRunner(packageManager: \"dpkg\" | \"apt\", installerPath: string, commandRunner: (commandWithArgs: string[]) => void, logger: Logger) {\n if (packageManager === \"dpkg\") {\n try {\n // Primary: Install unsigned .deb directly with dpkg\n commandRunner([\"dpkg\", \"-i\", installerPath])\n } catch (error: any) {\n // Handle missing dependencies via apt-get\n logger.warn(error.message ?? error)\n logger.warn(\"dpkg installation failed, trying to fix broken dependencies with apt-get\")\n commandRunner([\"apt-get\", \"install\", \"-f\", \"-y\"])\n }\n } else if (packageManager === \"apt\") {\n // Fallback: Use apt for direct install (less safe for unsigned .deb)\n logger.warn(\"Using apt to install a local .deb. This may fail for unsigned packages unless properly configured.\")\n commandRunner([\n \"apt\",\n \"install\",\n \"-y\",\n \"--allow-unauthenticated\", // needed for unsigned .debs\n \"--allow-downgrades\", // allow lower version installs\n \"--allow-change-held-packages\",\n installerPath,\n ])\n } else {\n throw new Error(`Package manager ${packageManager} not supported`)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"DebUpdater.js","sourceRoot":"","sources":["../src/DebUpdater.ts"],"names":[],"mappings":";;;AAIA,mDAA+C;AAC/C,mCAAmD;AACnD,iDAA6C;AAE7C,MAAa,UAAW,SAAQ,2BAAY;IAC1C,YAAY,OAAkC,EAAE,GAAgB;QAC9D,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,gBAAgB;IACN,gBAAgB,CAAC,qBAA4C;QACrE,MAAM,QAAQ,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,QAAQ,CAAA;QACrE,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,QAAQ,CAAC,YAAY,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAE,CAAA;QACzI,OAAO,IAAI,CAAC,eAAe,CAAC;YAC1B,aAAa,EAAE,KAAK;YACpB,QAAQ;YACR,qBAAqB;YACrB,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE;gBAC1C,IAAI,IAAI,CAAC,aAAa,CAAC,yBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC9C,eAAe,CAAC,UAAU,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAiB,EAAE,EAAE,CAAC,CAAA;gBACrE,CAAC;gBACD,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE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pD,aAAa,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAA;YAC9C,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,0CAA0C;gBAC1C,MAAM,CAAC,IAAI,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC,CAAA;gBACnC,MAAM,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAA;gBACvF,aAAa,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;YACnD,CAAC;QACH,CAAC;aAAM,IAAI,cAAc,KAAK,KAAK,EAAE,CAAC;YACpC,qEAAqE;YACrE,MAAM,CAAC,IAAI,CAAC,oGAAoG,CAAC,CAAA;YACjH,aAAa,CAAC;gBACZ,KAAK;gBACL,SAAS;gBACT,IAAI;gBACJ,yBAAyB,EAAE,4BAA4B;gBACvD,oBAAoB,EAAE,+BAA+B;gBACrD,8BAA8B;gBAC9B,aAAa;aACd,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,mBAAmB,cAAc,gBAAgB,CAAC,CAAA;QACpE,CAAC;IACH,CAAC;CACF;AAzED,gCAyEC","sourcesContent":["import { AllPublishOptions } from \"builder-util-runtime\"\nimport { AppAdapter } from \"./AppAdapter\"\nimport { DownloadExecutorResult, DownloadUpdateOptions } from \"./AppUpdater\"\nimport { InstallOptions } from \"./BaseUpdater\"\nimport { findFile } from \"./providers/Provider\"\nimport { DOWNLOAD_PROGRESS, Logger } from \"./types\"\nimport { LinuxUpdater } from \"./LinuxUpdater\"\n\nexport class DebUpdater extends LinuxUpdater {\n constructor(options?: AllPublishOptions | null, app?: AppAdapter) {\n super(options, app)\n }\n\n /*** @private */\n protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<DownloadExecutorResult> {\n const provider = downloadUpdateOptions.updateInfoAndProvider.provider\n const fileInfo = findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), \"deb\", [\"AppImage\", \"rpm\", \"pacman\"])!\n return this.executeDownload({\n fileExtension: \"deb\",\n fileInfo,\n downloadUpdateOptions,\n task: async (updateFile, downloadOptions) => {\n if (this.listenerCount(DOWNLOAD_PROGRESS) > 0) {\n downloadOptions.onProgress = it => this.emit(DOWNLOAD_PROGRESS, it)\n }\n await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)\n },\n })\n }\n\n protected doInstall(options: InstallOptions): boolean {\n const installerPath = this.installerPath\n if (installerPath == null) {\n this.dispatchError(new Error(\"No update filepath provided, can't quit and install\"))\n return false\n }\n if (!this.hasCommand(\"dpkg\") && !this.hasCommand(\"apt\")) {\n this.dispatchError(new Error(\"Neither dpkg nor apt command found. Cannot install .deb package.\"))\n return false\n }\n const priorityList = [\"dpkg\", \"apt\"]\n const packageManager = this.detectPackageManager(priorityList)\n try {\n DebUpdater.installWithCommandRunner(packageManager as any, installerPath, this.runCommandWithSudoIfNeeded.bind(this), this._logger)\n } catch (error: any) {\n this.dispatchError(error)\n return false\n }\n if (options.isForceRunAfter) {\n this.app.relaunch()\n }\n return true\n }\n\n static installWithCommandRunner(packageManager: \"dpkg\" | \"apt\", installerPath: string, commandRunner: (commandWithArgs: string[]) => void, logger: Logger) {\n if (packageManager === \"dpkg\") {\n try {\n // Primary: Install unsigned .deb directly with dpkg\n commandRunner([\"dpkg\", \"-i\", installerPath])\n } catch (error: any) {\n // Handle missing dependencies via apt-get\n logger.warn(error.message ?? error)\n logger.warn(\"dpkg installation failed, trying to fix broken dependencies with apt-get\")\n commandRunner([\"apt-get\", \"install\", \"-f\", \"-y\"])\n }\n } else if (packageManager === \"apt\") {\n // Fallback: Use apt for direct install (less safe for unsigned .deb)\n logger.warn(\"Using apt to install a local .deb. This may fail for unsigned packages unless properly configured.\")\n commandRunner([\n \"apt\",\n \"install\",\n \"-y\",\n \"--allow-unauthenticated\", // needed for unsigned .debs\n \"--allow-downgrades\", // allow lower version installs\n \"--allow-change-held-packages\",\n installerPath,\n ])\n } else {\n throw new Error(`Package manager ${packageManager} not supported`)\n }\n }\n}\n"]}