Skip to content

Commit

Permalink
feat(electron-updater): export updaters for configurability (#4250)
Browse files Browse the repository at this point in the history
* feat(electron-updater): Pass thorugh requestHeaders

From value passed to constructor

* feat(electron-updater): Expose updaters for configurability

So configuration can be passed in
  • Loading branch information
jeffreypriebe authored and develar committed Sep 23, 2019
1 parent 2eabee0 commit 9df845e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/builder-util-runtime/src/publishOptions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { OutgoingHttpHeaders } from "http"

export type PublishProvider = "github" | "bintray" | "s3" | "spaces" | "generic" | "custom" | "snapStore"

// typescript-json-schema generates only PublishConfiguration if it is specified in the list, so, it is not added here
Expand Down Expand Up @@ -30,6 +32,11 @@ export interface PublishConfiguration {
* @default true
*/
readonly publishAutoUpdate?: boolean

/**
* Any custom request headers
*/
readonly requestHeaders?: OutgoingHttpHeaders
}

// https://github.com/electron-userland/electron-builder/issues/3261
Expand Down
4 changes: 4 additions & 0 deletions packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ export abstract class AppUpdater extends EventEmitter {

if (options != null) {
this.setFeedURL(options)

if (typeof options !== 'string' && options.requestHeaders) {
this.requestHeaders = options.requestHeaders
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/electron-updater/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export { AppUpdater, NoOpLogger } from "./AppUpdater"
export { UpdateInfo }
export { CancellationToken } from "builder-util-runtime"
export { Provider } from "./providers/Provider"
export { AppImageUpdater } from "./AppImageUpdater"
export { MacUpdater } from "./MacUpdater"
export { NsisUpdater } from "./NsisUpdater"

// autoUpdater to mimic electron bundled autoUpdater
let _autoUpdater: any
Expand Down

0 comments on commit 9df845e

Please sign in to comment.