Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nsis): add option to disable differential download #7950

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-icons-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

feat(nsis): add option to disable differential download
3 changes: 3 additions & 0 deletions docs/api/electron-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -1788,6 +1788,9 @@ return path.join(target.outDir, <code>__${target.name}-${getArtifactArchName(arc
<p>Currently false to prevent breaking the current API, but it should be changed to default true at some point that breaking changes are allowed.</p>
</li>
<li>
<p><code id="AppUpdater-disableDifferentialDownload">disableDifferentialDownload</code> = <code>false</code> Boolean - <em>NSIS only</em> Disable differential downloads and always perform full download of installer.</p>
</li>
<li>
<p><code id="AppUpdater-forceDevUpdateConfig">forceDevUpdateConfig</code> = <code>false</code> Boolean - Allows developer to force the updater to work in “dev” mode, looking for “dev-app-update.yml” instead of “app-update.yml” Dev: <code>path.join(this.app.getAppPath(), &quot;dev-app-update.yml&quot;)</code> Prod: <code>path.join(process.resourcesPath!, &quot;app-update.yml&quot;)</code></p>
</li>
<li>
Expand Down
9 changes: 9 additions & 0 deletions packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
*/
disableWebInstaller = false

/**
* *NSIS only* Disable differential downloads and always perform full download of installer.
*
* @default false
*/
disableDifferentialDownload = false

/**
* Allows developer to force the updater to work in "dev" mode, looking for "dev-app-update.yml" instead of "app-update.yml"
* Dev: `path.join(this.app.getAppPath(), "dev-app-update.yml")`
Expand Down Expand Up @@ -493,6 +500,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
requestHeaders: this.computeRequestHeaders(updateInfoAndProvider.provider),
cancellationToken,
disableWebInstaller: this.disableWebInstaller,
disableDifferentialDownload: this.disableDifferentialDownload,
}).catch((e: any) => {
throw errorHandler(e)
})
Expand Down Expand Up @@ -696,6 +704,7 @@ export interface DownloadUpdateOptions {
readonly requestHeaders: OutgoingHttpHeaders
readonly cancellationToken: CancellationToken
readonly disableWebInstaller?: boolean
readonly disableDifferentialDownload?: boolean
}

function hasPrereleaseComponents(version: SemVer) {
Expand Down
6 changes: 5 additions & 1 deletion packages/electron-updater/src/NsisUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export class NsisUpdater extends BaseUpdater {
"disableWebInstaller is set to false, you should set it to true if you do not plan on using a web installer. This will default to true in a future version."
)
}
if (isWebInstaller || (await this.differentialDownloadInstaller(fileInfo, downloadUpdateOptions, destinationFile, provider))) {
if (
isWebInstaller ||
downloadUpdateOptions.disableDifferentialDownload ||
(await this.differentialDownloadInstaller(fileInfo, downloadUpdateOptions, destinationFile, provider))
) {
await this.httpExecutor.download(fileInfo.url, destinationFile, downloadOptions)
}

Expand Down
Loading