electron-updater 7.0.0-alpha.3 → 7.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +1 -1
  2. package/dist/AppAdapter.d.ts +5 -0
  3. package/dist/AppAdapter.d.ts.map +1 -1
  4. package/dist/AppAdapter.js.map +1 -1
  5. package/dist/AppImageUpdater.d.ts +1 -0
  6. package/dist/AppImageUpdater.d.ts.map +1 -1
  7. package/dist/AppImageUpdater.js +4 -0
  8. package/dist/AppImageUpdater.js.map +1 -1
  9. package/dist/AppUpdater.d.ts +71 -14
  10. package/dist/AppUpdater.d.ts.map +1 -1
  11. package/dist/AppUpdater.js +78 -10
  12. package/dist/AppUpdater.js.map +1 -1
  13. package/dist/BaseUpdater.d.ts +26 -1
  14. package/dist/BaseUpdater.d.ts.map +1 -1
  15. package/dist/BaseUpdater.js +155 -6
  16. package/dist/BaseUpdater.js.map +1 -1
  17. package/dist/DebUpdater.d.ts +1 -1
  18. package/dist/DebUpdater.d.ts.map +1 -1
  19. package/dist/DebUpdater.js +13 -6
  20. package/dist/DebUpdater.js.map +1 -1
  21. package/dist/DownloadedUpdateHelper.d.ts +27 -2
  22. package/dist/DownloadedUpdateHelper.d.ts.map +1 -1
  23. package/dist/DownloadedUpdateHelper.js +69 -15
  24. package/dist/DownloadedUpdateHelper.js.map +1 -1
  25. package/dist/ElectronAppAdapter.d.ts +1 -0
  26. package/dist/ElectronAppAdapter.d.ts.map +1 -1
  27. package/dist/ElectronAppAdapter.js +16 -0
  28. package/dist/ElectronAppAdapter.js.map +1 -1
  29. package/dist/MacUpdater.d.ts +2 -2
  30. package/dist/MacUpdater.d.ts.map +1 -1
  31. package/dist/MacUpdater.js +15 -5
  32. package/dist/MacUpdater.js.map +1 -1
  33. package/dist/NsisUpdater.d.ts +3 -0
  34. package/dist/NsisUpdater.d.ts.map +1 -1
  35. package/dist/NsisUpdater.js +42 -4
  36. package/dist/NsisUpdater.js.map +1 -1
  37. package/dist/RpmUpdater.d.ts +1 -1
  38. package/dist/RpmUpdater.d.ts.map +1 -1
  39. package/dist/RpmUpdater.js +22 -8
  40. package/dist/RpmUpdater.js.map +1 -1
  41. package/dist/differentialDownloader/multipleRangeDownloader.d.ts.map +1 -1
  42. package/dist/differentialDownloader/multipleRangeDownloader.js +1 -0
  43. package/dist/differentialDownloader/multipleRangeDownloader.js.map +1 -1
  44. package/dist/providerFactory.d.ts.map +1 -1
  45. package/dist/providerFactory.js +1 -0
  46. package/dist/providerFactory.js.map +1 -1
  47. package/dist/providers/GitHubProvider.d.ts +1 -1
  48. package/dist/providers/GitHubProvider.d.ts.map +1 -1
  49. package/dist/providers/GitHubProvider.js +43 -20
  50. package/dist/providers/GitHubProvider.js.map +1 -1
  51. package/dist/providers/GitLabProvider.d.ts +0 -1
  52. package/dist/providers/GitLabProvider.d.ts.map +1 -1
  53. package/dist/providers/GitLabProvider.js +6 -21
  54. package/dist/providers/GitLabProvider.js.map +1 -1
  55. package/dist/providers/PrivateGitHubProvider.d.ts.map +1 -1
  56. package/dist/providers/PrivateGitHubProvider.js +2 -2
  57. package/dist/providers/PrivateGitHubProvider.js.map +1 -1
  58. package/dist/providers/Provider.d.ts +1 -0
  59. package/dist/providers/Provider.d.ts.map +1 -1
  60. package/dist/providers/Provider.js +4 -0
  61. package/dist/providers/Provider.js.map +1 -1
  62. package/dist/types.d.ts +28 -0
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/types.js.map +1 -1
  65. package/dist/windowsExecutableCodeSignatureVerifier.d.ts.map +1 -1
  66. package/dist/windowsExecutableCodeSignatureVerifier.js +6 -3
  67. package/dist/windowsExecutableCodeSignatureVerifier.js.map +1 -1
  68. package/package.json +2 -2
package/README.md CHANGED
@@ -12,4 +12,4 @@ Supported OS:
12
12
 
13
13
  ## Credits
14
14
 
15
- Thanks to [Evolve Labs](https://www.evolvehq.com) for donating the npm package name.
15
+ Thanks to Evolve Labs for donating the npm package name.
@@ -18,6 +18,11 @@ export interface AppAdapter {
18
18
  relaunch(): void;
19
19
  quit(): void;
20
20
  onQuit(handler: (exitCode: number) => void): void;
21
+ /**
22
+ * Best-effort notification that the OS session is ending (shutdown / reboot / log off).
23
+ * Optional because not every adapter (or platform) can detect it.
24
+ */
25
+ onSessionEnd?(handler: () => void): void;
21
26
  }
22
27
  export declare function getAppCacheDir(): string;
23
28
  //# sourceMappingURL=AppAdapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppAdapter.d.ts","sourceRoot":"","sources":["../src/AppAdapter.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAE5B;;OAEG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IAEpC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAE9B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAE1B,QAAQ,IAAI,IAAI,CAAA;IAEhB,IAAI,IAAI,IAAI,CAAA;IAEZ,MAAM,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAA;CAClD;AAED,wBAAgB,cAAc,WAY7B"}
1
+ {"version":3,"file":"AppAdapter.d.ts","sourceRoot":"","sources":["../src/AppAdapter.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAE5B;;OAEG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IAEp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AA;AACf,CAAC","sourcesContent":["import * as path from \"path\"\nimport { homedir as getHomedir } from \"os\"\n\nexport interface AppAdapter {\n readonly version: string\n readonly name: string\n\n readonly isPackaged: boolean\n\n /**\n * Path to update metadata file.\n */\n readonly appUpdateConfigPath: string\n\n /**\n * Path to user data directory.\n */\n readonly userDataPath: string\n\n /**\n * Path to cache directory.\n */\n readonly baseCachePath: string\n\n whenReady(): Promise<void>\n\n relaunch(): void\n\n quit(): void\n\n onQuit(handler: (exitCode: number) => void): void\n}\n\nexport function getAppCacheDir() {\n const homedir = getHomedir()\n // https://github.com/electron/electron/issues/1404#issuecomment-194391247\n let result: string\n if (process.platform === \"win32\") {\n result = process.env[\"LOCALAPPDATA\"] || path.join(homedir, \"AppData\", \"Local\")\n } else if (process.platform === \"darwin\") {\n result = path.join(homedir, \"Library\", \"Caches\")\n } else {\n result = process.env[\"XDG_CACHE_HOME\"] || path.join(homedir, \".cache\")\n }\n return result\n}\n"]}
1
+ {"version":3,"file":"AppAdapter.js","sourceRoot":"","sources":["../src/AppAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,IAAI,CAAA;AAsC1C,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAC5B,0EAA0E;IAC1E,IAAI,MAAc,CAAA;IAClB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IAChF,CAAC;SAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;IAClD,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IACxE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import * as path from \"path\"\nimport { homedir as getHomedir } from \"os\"\n\nexport interface AppAdapter {\n readonly version: string\n readonly name: string\n\n readonly isPackaged: boolean\n\n /**\n * Path to update metadata file.\n */\n readonly appUpdateConfigPath: string\n\n /**\n * Path to user data directory.\n */\n readonly userDataPath: string\n\n /**\n * Path to cache directory.\n */\n readonly baseCachePath: string\n\n whenReady(): Promise<void>\n\n relaunch(): void\n\n quit(): void\n\n onQuit(handler: (exitCode: number) => void): void\n\n /**\n * Best-effort notification that the OS session is ending (shutdown / reboot / log off).\n * Optional because not every adapter (or platform) can detect it.\n */\n onSessionEnd?(handler: () => void): void\n}\n\nexport function getAppCacheDir() {\n const homedir = getHomedir()\n // https://github.com/electron/electron/issues/1404#issuecomment-194391247\n let result: string\n if (process.platform === \"win32\") {\n result = process.env[\"LOCALAPPDATA\"] || path.join(homedir, \"AppData\", \"Local\")\n } else if (process.platform === \"darwin\") {\n result = path.join(homedir, \"Library\", \"Caches\")\n } else {\n result = process.env[\"XDG_CACHE_HOME\"] || path.join(homedir, \".cache\")\n }\n return result\n}\n"]}
@@ -4,6 +4,7 @@ import { BaseUpdater, InstallOptions } from "./BaseUpdater.js";
4
4
  export declare class AppImageUpdater extends BaseUpdater {
5
5
  constructor(options?: AllPublishOptions | null, app?: any);
6
6
  isUpdaterActive(): boolean;
7
+ protected get isAutoInstallOnNextLaunchSupported(): boolean;
7
8
  /*** @private */
8
9
  protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>>;
9
10
  private downloadDifferential;
@@ -1 +1 @@
1
- {"version":3,"file":"AppImageUpdater.d.ts","sourceRoot":"","sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,MAAM,sBAAsB,CAAA;AAKlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAM9D,qBAAa,eAAgB,SAAQ,WAAW;gBAClC,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG;IAIlD,eAAe,IAAI,OAAO;IAYjC,gBAAgB;IAChB,SAAS,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAsBlF,oBAAoB;IAyBlC,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;CA+CtD"}
1
+ {"version":3,"file":"AppImageUpdater.d.ts","sourceRoot":"","sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,MAAM,sBAAsB,CAAA;AAKlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAM9D,qBAAa,eAAgB,SAAQ,WAAW;gBAClC,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG;IAIlD,eAAe,IAAI,OAAO;IAajC,SAAS,KAAK,kCAAkC,IAAI,OAAO,CAE1D;IAED,gBAAgB;IAChB,SAAS,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAsBlF,oBAAoB;IAyBlC,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;CA+CtD"}
@@ -23,6 +23,10 @@ export class AppImageUpdater extends BaseUpdater {
23
23
  }
24
24
  return super.isUpdaterActive();
25
25
  }
26
+ // replacing the AppImage file needs no elevation, so the automatic install at startup is allowed
27
+ get isAutoInstallOnNextLaunchSupported() {
28
+ return true;
29
+ }
26
30
  /*** @private */
27
31
  doDownloadUpdate(downloadUpdateOptions) {
28
32
  const provider = downloadUpdateOptions.updateInfoAndProvider.provider;
@@ -1 +1 @@
1
- {"version":3,"file":"AppImageUpdater.js","sourceRoot":"","sources":["../src/AppImageUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAA;AAE9D,OAAO,EAAE,8CAA8C,EAAE,MAAM,4EAA4E,CAAA;AAC3I,OAAO,EAAE,QAAQ,EAAY,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAA0B,MAAM,YAAY,CAAA;AAEtE,MAAM,OAAO,eAAgB,SAAQ,WAAW;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,OAAO,KAAK,CAAA;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,CAAC,CAAA;QACxC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { AllPublishOptions, newError } from \"builder-util-runtime\"\nimport { execFileSync } from \"child_process\"\nimport fsExtra from \"fs-extra\"\nimport { unlinkSync } from \"fs\"\nimport * as path from \"path\"\nimport { DownloadUpdateOptions } from \"./AppUpdater.js\"\nimport { BaseUpdater, InstallOptions } from \"./BaseUpdater.js\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader.js\"\nimport { FileWithEmbeddedBlockMapDifferentialDownloader } from \"./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js\"\nimport { findFile, Provider } from \"./providers/Provider.js\"\nimport { DOWNLOAD_PROGRESS, ResolvedUpdateFileInfo } from \"./types.js\"\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 fsExtra.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,OAAO,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAA;AAE9D,OAAO,EAAE,8CAA8C,EAAE,MAAM,4EAA4E,CAAA;AAC3I,OAAO,EAAE,QAAQ,EAAY,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAA0B,MAAM,YAAY,CAAA;AAEtE,MAAM,OAAO,eAAgB,SAAQ,WAAW;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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uB,EAAE,MAAM;SAChC,CAAA;QAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YAC5B,mEAAmE;YACnE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;QACrC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,2BAA2B,GAAG,MAAM,CAAA;YACxC,YAAY,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QACxC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { AllPublishOptions, newError } from \"builder-util-runtime\"\nimport { execFileSync } from \"child_process\"\nimport fsExtra from \"fs-extra\"\nimport { unlinkSync } from \"fs\"\nimport * as path from \"path\"\nimport { DownloadUpdateOptions } from \"./AppUpdater.js\"\nimport { BaseUpdater, InstallOptions } from \"./BaseUpdater.js\"\nimport { DifferentialDownloaderOptions } from \"./differentialDownloader/DifferentialDownloader.js\"\nimport { FileWithEmbeddedBlockMapDifferentialDownloader } from \"./differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js\"\nimport { findFile, Provider } from \"./providers/Provider.js\"\nimport { DOWNLOAD_PROGRESS, ResolvedUpdateFileInfo } from \"./types.js\"\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 // replacing the AppImage file needs no elevation, so the automatic install at startup is allowed\n protected get isAutoInstallOnNextLaunchSupported(): boolean {\n return true\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 fsExtra.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"]}
@@ -9,7 +9,7 @@ import { Provider, ProviderPlatform } from "./providers/Provider.js";
9
9
  import type { TypedEmitter } from "tiny-typed-emitter";
10
10
  type Session = Electron.Session;
11
11
  import type { AuthInfo } from "electron";
12
- import { Logger, ResolvedUpdateFileInfo, UpdateCheckResult, UpdateDownloadedEvent, UpdaterSignal } from "./types.js";
12
+ import { AutoInstallEvent, Logger, QuitAndInstallOptions, ResolvedUpdateFileInfo, UpdateCheckResult, UpdateDownloadedEvent, UpdaterSignal } from "./types.js";
13
13
  import { VerifyUpdateSupport } from "./index.js";
14
14
  export type AppUpdaterEvents = {
15
15
  error: (error: Error, message?: string) => void;
@@ -30,10 +30,44 @@ export declare abstract class AppUpdater extends AppUpdater_base {
30
30
  */
31
31
  autoDownload: boolean;
32
32
  /**
33
- * Whether to automatically install a downloaded update on app quit (if `quitAndInstall` was not called before).
34
- * @default true
33
+ * When a downloaded update is automatically installed (if `quitAndInstall` was not called before).
34
+ *
35
+ * - `"onQuit"` (default) — install on app quit by spawning the installer while the app exits.
36
+ * - `"onNextLaunch"` — defer the install: any app quit persists an install-on-next-launch marker for the downloaded
37
+ * update; on the next launch the updater re-validates the cached installer against freshly fetched update info and
38
+ * installs it (see `installPendingUpdateIfAvailable`). This avoids the class of failures where the on-quit installer
39
+ * process is killed by the OS before it finishes — most notably Windows terminating the detached NSIS installer during
40
+ * session end (log off / shutdown / restart), which can leave the app uninstalled but not re-installed
41
+ * (see https://github.com/electron-userland/electron-builder/issues/7807). The automatic install at startup only runs
42
+ * for targets that can install without an elevation prompt: NSIS (per-user, `isAdminRightsRequired === false`) and
43
+ * AppImage. Linux package targets (deb, rpm, pacman) always elevate via pkexec/sudo, and NSIS per-machine installs
44
+ * trigger a UAC prompt, so for those the pending update is kept and `installPendingUpdateIfAvailable()` must be called
45
+ * explicitly at a moment the app controls.
46
+ * - `"manual"` — never auto-install; the downloaded update stays cached until an explicit `quitAndInstall()`.
47
+ *
48
+ * `"onNextLaunch"` is planned to become the DEFAULT in v28 to resolve this class of bug once and for all.
49
+ * @default "onQuit"
50
+ */
51
+ autoInstallEvent: AutoInstallEvent;
52
+ /**
53
+ * Installs an update that a previous launch marked as pending (see `autoInstallEvent: "onNextLaunch"` and
54
+ * `quitAndInstall({ waitUntilNextLaunch: true })`), then quits the app.
55
+ *
56
+ * The cached installer is never trusted blindly: a fresh update-info fetch is performed first and the cached file
57
+ * is validated against it (checksum, and code signature where applicable). The pending update is only installed
58
+ * when its version is an installable change from the running app — newer, or older when `allowDowngrade` is set
59
+ * (a loop guard, mirroring `isUpdateAvailable`); otherwise the pending state is cleared.
60
+ *
61
+ * Unlike the automatic startup install, an explicit call is also allowed for targets whose install requires
62
+ * elevation: NSIS per-machine installations (`isAdminRightsRequired === true`) and Linux package targets
63
+ * (deb, rpm, pacman — installed via pkexec/sudo).
64
+ *
65
+ * On macOS this resolves to `false`: Squirrel.Mac already stages downloaded updates natively and applies them when
66
+ * the app is relaunched after quit, so there is no pending-install state managed by electron-updater.
67
+ *
68
+ * @returns `true` if a pending update was validated and its installation was initiated (the app will quit).
35
69
  */
36
- autoInstallOnAppQuit: boolean;
70
+ installPendingUpdateIfAvailable(): Promise<boolean>;
37
71
  /**
38
72
  * Whether to run the app after finish install when run the installer is NOT in silent mode.
39
73
  * @default true
@@ -59,14 +93,38 @@ export declare abstract class AppUpdater extends AppUpdater_base {
59
93
  */
60
94
  allowDowngrade: boolean;
61
95
  /**
62
- * Web installer files might not have signature verification, this switch prevents to load them unless it is needed.
96
+ * *Linux only.* Whether to allow installing unverified (unsigned / failing-GPG) `.deb` and `.rpm` packages during auto-update.
63
97
  *
64
- * Currently false to prevent breaking the current API, but it should be changed to default true at some point that
65
- * breaking changes are allowed.
98
+ * electron-builder does not sign Linux packages, so this defaults to `true` to preserve working auto-updates: the
99
+ * package manager's signature/GPG checks are bypassed where a bypass flag exists (`--allow-unauthenticated` for the
100
+ * apt fallback, `--allow-unsigned-rpm` for zypper, `--nogpgcheck` for dnf/yum), which is the historical behavior.
66
101
  *
67
- * @default false
102
+ * What `false` enforces depends on the package manager used on the target system:
103
+ * - dpkg (the default for `.deb`): no effect — dpkg performs no signature verification (a warning is logged);
104
+ * enforcing `.deb` signatures requires a debsig-verify/debsigs policy on the target system.
105
+ * - apt (`.deb` fallback): `--allow-unauthenticated` is omitted.
106
+ * - zypper: enforced — unsigned/untrusted packages fail to install.
107
+ * - dnf/yum: enforced via `--setopt=localpkg_gpgcheck=1` (local package files are not GPG-checked by default).
108
+ * - bare rpm (fallback): cannot be enforced via the CLI (a warning is logged); admins must configure
109
+ * `%_pkgverify_level signature` on the target system.
110
+ *
111
+ * pacman and AppImage targets are not affected by this option: `pacman -U` has no per-invocation bypass flag
112
+ * (local-file policy is `LocalFileSigLevel` in `pacman.conf`), and AppImage updates are verified only via the
113
+ * update-manifest checksum.
114
+ *
115
+ * @default true
116
+ */
117
+ allowUnverifiedLinuxPackages: boolean;
118
+ private _disableWebInstaller;
119
+ /**
120
+ * Whether to block NSIS web-installer packages. Web installer files might not have signature verification, so they are disabled by default as of v27.
121
+ *
122
+ * v27 grace period: apps that do not explicitly set this property will warn (but still download) if a web-installer update is received. In v28 the warning becomes an error and the download is blocked (`ERR_UPDATER_WEB_INSTALLER_DISABLED`). Apps that explicitly set this to `true` throw immediately. Set it to `false` only if you intentionally publish and rely on NSIS web-installer packages.
123
+ *
124
+ * @default true
68
125
  */
69
- disableWebInstaller: boolean;
126
+ get disableWebInstaller(): boolean;
127
+ set disableWebInstaller(value: boolean);
70
128
  /**
71
129
  * *NSIS only* Disable differential downloads and always perform full download of installer.
72
130
  *
@@ -193,15 +251,14 @@ export declare abstract class AppUpdater extends AppUpdater_base {
193
251
  * **Note:** `autoUpdater.quitAndInstall()` will close all application windows first and only emit `before-quit` event on `app` after that.
194
252
  * This is different from the normal quit event sequence.
195
253
  *
196
- * @param isSilent *windows-only* Runs the installer in silent mode. Defaults to `false`.
197
- * @param isForceRunAfter Run the app after finish even on silent install. Not applicable for macOS.
198
- * Ignored if `isSilent` is set to `false`(In this case you can still set `autoRunAppAfterInstall` to `false` to prevent run the app after finish).
254
+ * @param options See {@link QuitAndInstallOptions}. When omitted, the installer runs non-silent and the deferred
255
+ * install-on-next-launch flow is not used (same behavior as before the options object was introduced).
199
256
  */
200
- abstract quitAndInstall(isSilent?: boolean, isForceRunAfter?: boolean): void;
257
+ abstract quitAndInstall(options?: QuitAndInstallOptions): void;
201
258
  private loadUpdateConfig;
202
259
  private computeRequestHeaders;
203
260
  private getOrCreateStagingUserId;
204
- private getOrCreateDownloadHelper;
261
+ protected getOrCreateDownloadHelper(): Promise<DownloadedUpdateHelper>;
205
262
  protected executeDownload(taskOptions: DownloadExecutorTask): Promise<Array<string>>;
206
263
  protected differentialDownloadInstaller(fileInfo: ResolvedUpdateFileInfo, downloadUpdateOptions: DownloadUpdateOptions, installerPath: string, provider: Provider<any>, oldInstallerFileName: string): Promise<boolean>;
207
264
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppUpdater.d.ts","sourceRoot":"","sources":["../src/AppUpdater.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAEjB,iBAAiB,EAEjB,oBAAoB,EACpB,UAAU,EAEV,eAAe,EAEf,YAAY,EAGb,MAAM,sBAAsB,CAAA;AAK7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAiJ,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC9K,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAwB,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAE1F,OAAO,EAAuC,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAG9F,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,KAAK,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC,OAAO,EAAqB,MAAM,EAAE,sBAAsB,EAAqB,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1J,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAIhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,KAAK,I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AAC,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAE9J,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CAC/D;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAe;AACf,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,gBAAgB,CAAA;IAE1B,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC"}
@@ -15,9 +15,44 @@ import { GenericProvider } from "./providers/GenericProvider.js";
15
15
  import { createClient, isUrlProbablySupportMultiRangeRequests } from "./providerFactory.js";
16
16
  import { gunzipSync, gzipSync } from "zlib";
17
17
  import { GenericDifferentialDownloader } from "./differentialDownloader/GenericDifferentialDownloader.js";
18
- import { DOWNLOAD_PROGRESS, UPDATE_DOWNLOADED, UpdaterSignal } from "./types.js";
18
+ import { DOWNLOAD_PROGRESS, UPDATE_DOWNLOADED, UpdaterSignal, } from "./types.js";
19
19
  const require = createRequire(import.meta.url);
20
20
  export class AppUpdater extends EventEmitter {
21
+ /**
22
+ * Installs an update that a previous launch marked as pending (see `autoInstallEvent: "onNextLaunch"` and
23
+ * `quitAndInstall({ waitUntilNextLaunch: true })`), then quits the app.
24
+ *
25
+ * The cached installer is never trusted blindly: a fresh update-info fetch is performed first and the cached file
26
+ * is validated against it (checksum, and code signature where applicable). The pending update is only installed
27
+ * when its version is an installable change from the running app — newer, or older when `allowDowngrade` is set
28
+ * (a loop guard, mirroring `isUpdateAvailable`); otherwise the pending state is cleared.
29
+ *
30
+ * Unlike the automatic startup install, an explicit call is also allowed for targets whose install requires
31
+ * elevation: NSIS per-machine installations (`isAdminRightsRequired === true`) and Linux package targets
32
+ * (deb, rpm, pacman — installed via pkexec/sudo).
33
+ *
34
+ * On macOS this resolves to `false`: Squirrel.Mac already stages downloaded updates natively and applies them when
35
+ * the app is relaunched after quit, so there is no pending-install state managed by electron-updater.
36
+ *
37
+ * @returns `true` if a pending update was validated and its installation was initiated (the app will quit).
38
+ */
39
+ installPendingUpdateIfAvailable() {
40
+ this._logger.info("installPendingUpdateIfAvailable is not supported by this updater implementation, skipping");
41
+ return Promise.resolve(false);
42
+ }
43
+ /**
44
+ * Whether to block NSIS web-installer packages. Web installer files might not have signature verification, so they are disabled by default as of v27.
45
+ *
46
+ * v27 grace period: apps that do not explicitly set this property will warn (but still download) if a web-installer update is received. In v28 the warning becomes an error and the download is blocked (`ERR_UPDATER_WEB_INSTALLER_DISABLED`). Apps that explicitly set this to `true` throw immediately. Set it to `false` only if you intentionally publish and rely on NSIS web-installer packages.
47
+ *
48
+ * @default true
49
+ */
50
+ get disableWebInstaller() {
51
+ return this._disableWebInstaller ?? true;
52
+ }
53
+ set disableWebInstaller(value) {
54
+ this._disableWebInstaller = value;
55
+ }
21
56
  /**
22
57
  * Get the update channel. Doesn't return `channel` from the update configuration, only if was previously set.
23
58
  */
@@ -107,10 +142,25 @@ export class AppUpdater extends EventEmitter {
107
142
  */
108
143
  this.autoDownload = true;
109
144
  /**
110
- * Whether to automatically install a downloaded update on app quit (if `quitAndInstall` was not called before).
111
- * @default true
145
+ * When a downloaded update is automatically installed (if `quitAndInstall` was not called before).
146
+ *
147
+ * - `"onQuit"` (default) — install on app quit by spawning the installer while the app exits.
148
+ * - `"onNextLaunch"` — defer the install: any app quit persists an install-on-next-launch marker for the downloaded
149
+ * update; on the next launch the updater re-validates the cached installer against freshly fetched update info and
150
+ * installs it (see `installPendingUpdateIfAvailable`). This avoids the class of failures where the on-quit installer
151
+ * process is killed by the OS before it finishes — most notably Windows terminating the detached NSIS installer during
152
+ * session end (log off / shutdown / restart), which can leave the app uninstalled but not re-installed
153
+ * (see https://github.com/electron-userland/electron-builder/issues/7807). The automatic install at startup only runs
154
+ * for targets that can install without an elevation prompt: NSIS (per-user, `isAdminRightsRequired === false`) and
155
+ * AppImage. Linux package targets (deb, rpm, pacman) always elevate via pkexec/sudo, and NSIS per-machine installs
156
+ * trigger a UAC prompt, so for those the pending update is kept and `installPendingUpdateIfAvailable()` must be called
157
+ * explicitly at a moment the app controls.
158
+ * - `"manual"` — never auto-install; the downloaded update stays cached until an explicit `quitAndInstall()`.
159
+ *
160
+ * `"onNextLaunch"` is planned to become the DEFAULT in v28 to resolve this class of bug once and for all.
161
+ * @default "onQuit"
112
162
  */
113
- this.autoInstallOnAppQuit = true;
163
+ this.autoInstallEvent = "onQuit";
114
164
  /**
115
165
  * Whether to run the app after finish install when run the installer is NOT in silent mode.
116
166
  * @default true
@@ -136,14 +186,29 @@ export class AppUpdater extends EventEmitter {
136
186
  */
137
187
  this.allowDowngrade = false;
138
188
  /**
139
- * Web installer files might not have signature verification, this switch prevents to load them unless it is needed.
189
+ * *Linux only.* Whether to allow installing unverified (unsigned / failing-GPG) `.deb` and `.rpm` packages during auto-update.
140
190
  *
141
- * Currently false to prevent breaking the current API, but it should be changed to default true at some point that
142
- * breaking changes are allowed.
191
+ * electron-builder does not sign Linux packages, so this defaults to `true` to preserve working auto-updates: the
192
+ * package manager's signature/GPG checks are bypassed where a bypass flag exists (`--allow-unauthenticated` for the
193
+ * apt fallback, `--allow-unsigned-rpm` for zypper, `--nogpgcheck` for dnf/yum), which is the historical behavior.
143
194
  *
144
- * @default false
195
+ * What `false` enforces depends on the package manager used on the target system:
196
+ * - dpkg (the default for `.deb`): no effect — dpkg performs no signature verification (a warning is logged);
197
+ * enforcing `.deb` signatures requires a debsig-verify/debsigs policy on the target system.
198
+ * - apt (`.deb` fallback): `--allow-unauthenticated` is omitted.
199
+ * - zypper: enforced — unsigned/untrusted packages fail to install.
200
+ * - dnf/yum: enforced via `--setopt=localpkg_gpgcheck=1` (local package files are not GPG-checked by default).
201
+ * - bare rpm (fallback): cannot be enforced via the CLI (a warning is logged); admins must configure
202
+ * `%_pkgverify_level signature` on the target system.
203
+ *
204
+ * pacman and AppImage targets are not affected by this option: `pacman -U` has no per-invocation bypass flag
205
+ * (local-file policy is `LocalFileSigLevel` in `pacman.conf`), and AppImage updates are verified only via the
206
+ * update-manifest checksum.
207
+ *
208
+ * @default true
145
209
  */
146
- this.disableWebInstaller = false;
210
+ this.allowUnverifiedLinuxPackages = true;
211
+ this._disableWebInstaller = undefined;
147
212
  /**
148
213
  * *NSIS only* Disable differential downloads and always perform full download of installer.
149
214
  *
@@ -461,7 +526,7 @@ export class AppUpdater extends EventEmitter {
461
526
  updateInfoAndProvider,
462
527
  requestHeaders: this.computeRequestHeaders(updateInfoAndProvider.provider),
463
528
  cancellationToken,
464
- disableWebInstaller: this.disableWebInstaller,
529
+ disableWebInstaller: this._disableWebInstaller,
465
530
  disableDifferentialDownload: this.disableDifferentialDownload,
466
531
  })
467
532
  .catch((e) => {
@@ -557,6 +622,9 @@ export class AppUpdater extends EventEmitter {
557
622
  }
558
623
  async executeDownload(taskOptions) {
559
624
  const fileInfo = taskOptions.fileInfo;
625
+ if (fileInfo.info.sha512 == null && fileInfo.info.sha2 != null) {
626
+ this._logger.warn("Update artifact is validated with a SHA-256 (sha2) checksum only. SHA-256 update checksums are deprecated; electron-builder v28 will require SHA-512 and reject SHA-256-only update metadata (fail-closed). Regenerate latest*.yml with a current electron-builder and avoid pinning electronUpdaterCompatibility to a legacy (<2.15 / 1.x) range.");
627
+ }
560
628
  const downloadOptions = {
561
629
  headers: taskOptions.downloadUpdateOptions.requestHeaders,
562
630
  cancellationToken: taskOptions.downloadUpdateOptions.cancellationToken,