electron-updater
Advanced tools
Comparing version 1.14.4 to 1.15.0
@@ -46,2 +46,9 @@ "use strict"; | ||
} | ||
/** | ||
* Emitted when an authenticating proxy is asking for user credentials. | ||
* @see [Electron docs](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login) | ||
*/ | ||
login(handler) { | ||
addHandler(this.emitter, "login", handler); | ||
} | ||
progress(handler) { | ||
@@ -48,0 +55,0 @@ addHandler(this.emitter, DOWNLOAD_PROGRESS, handler); |
@@ -144,3 +144,3 @@ "use strict"; | ||
this.app = require("electron").app; | ||
(_electronBuilderHttp || _load_electronBuilderHttp()).executorHolder.httpExecutor = new (_electronHttpExecutor || _load_electronHttpExecutor()).ElectronHttpExecutor(); | ||
(_electronBuilderHttp || _load_electronBuilderHttp()).executorHolder.httpExecutor = new (_electronHttpExecutor || _load_electronHttpExecutor()).ElectronHttpExecutor((authInfo, callback) => this.emit("login", authInfo, callback)); | ||
this.untilAppReady = new (_bluebirdLst2 || _load_bluebirdLst2()).default(resolve => { | ||
@@ -147,0 +147,0 @@ if (this.app.isReady()) { |
@@ -0,2 +1,20 @@ | ||
declare module "electron-updater/out/electronHttpExecutor" { | ||
/// <reference types="electron" /> | ||
import { DownloadOptions, HttpExecutor } from "electron-builder-http" | ||
import { CancellationToken } from "electron-builder-http/out/CancellationToken" | ||
export const NET_SESSION_NAME = "electron-updater" | ||
export type LoginCallback = (username: string, password: string) => void | ||
export class ElectronHttpExecutor extends HttpExecutor<Electron.RequestOptions, Electron.ClientRequest> { | ||
private proxyLoginCallback | ||
constructor(proxyLoginCallback?: (authInfo: Electron.LoginAuthInfo, callback: LoginCallback) => void) | ||
download(url: string, destination: string, options: DownloadOptions): Promise<string> | ||
doApiRequest<T>(options: Electron.RequestOptions, cancellationToken: CancellationToken, requestProcessor: (request: Electron.ClientRequest, reject: (error: Error) => void) => void, redirectCount?: number): Promise<T> | ||
protected doRequest(options: any, callback: (response: any) => void): any | ||
private addProxyLoginHandler(request) | ||
} | ||
} | ||
declare module "electron-updater/out/api" { | ||
/// <reference types="electron" /> | ||
/// <reference types="node" /> | ||
@@ -9,2 +27,3 @@ import { RequestHeaders } from "electron-builder-http" | ||
import { Url } from "url" | ||
import { LoginCallback } from "electron-updater/out/electronHttpExecutor" | ||
@@ -40,2 +59,3 @@ export interface FileInfo { | ||
export const DOWNLOAD_PROGRESS = "download-progress" | ||
export type LoginHandler = (event: Event, request: Electron.LoginRequest, authInfo: Electron.LoginAuthInfo, callback: LoginCallback) => void | ||
@@ -45,2 +65,7 @@ export class UpdaterSignal { | ||
constructor(emitter: EventEmitter) | ||
/** | ||
* Emitted when an authenticating proxy is asking for user credentials. | ||
* @see [Electron docs](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login) | ||
*/ | ||
login(handler: LoginHandler): void | ||
progress(handler: (info: ProgressInfo) => void): void | ||
@@ -66,15 +91,2 @@ updateDownloaded(handler: (info: VersionInfo) => void): void | ||
declare module "electron-updater/out/electronHttpExecutor" { | ||
/// <reference types="electron" /> | ||
import { DownloadOptions, HttpExecutor } from "electron-builder-http" | ||
import { CancellationToken } from "electron-builder-http/out/CancellationToken" | ||
export const NET_SESSION_NAME = "electron-updater" | ||
export class ElectronHttpExecutor extends HttpExecutor<Electron.RequestOptions, Electron.ClientRequest> { | ||
download(url: string, destination: string, options: DownloadOptions): Promise<string> | ||
doApiRequest<T>(options: Electron.RequestOptions, cancellationToken: CancellationToken, requestProcessor: (request: Electron.ClientRequest, reject: (error: Error) => void) => void, redirectCount?: number): Promise<T> | ||
protected doRequest(options: any, callback: (response: any) => void): any | ||
} | ||
} | ||
declare module "electron-updater/out/GenericProvider" { | ||
@@ -81,0 +93,0 @@ import { Provider, FileInfo } from "electron-updater/out/api" |
@@ -53,2 +53,6 @@ "use strict"; | ||
class ElectronHttpExecutor extends (_electronBuilderHttp || _load_electronBuilderHttp()).HttpExecutor { | ||
constructor(proxyLoginCallback) { | ||
super(); | ||
this.proxyLoginCallback = proxyLoginCallback; | ||
} | ||
download(url, destination, options) { | ||
@@ -86,3 +90,3 @@ var _this = this; | ||
return cancellationToken.createPromise((resolve, reject, onCancel) => { | ||
const request = (_electron || _load_electron()).net.request(options, response => { | ||
const request = (_electron || _load_electron()).net.request(Object.assign({ session: (_electron || _load_electron()).session.fromPartition(NET_SESSION_NAME) }, options), response => { | ||
try { | ||
@@ -94,2 +98,3 @@ this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor); | ||
}); | ||
this.addProxyLoginHandler(request); | ||
this.addTimeOutHandler(request, reject); | ||
@@ -102,6 +107,12 @@ request.on("error", reject); | ||
doRequest(options, callback) { | ||
options.session = (_electron || _load_electron()).session.fromPartition(NET_SESSION_NAME); | ||
return (_electron || _load_electron()).net.request(options, callback); | ||
const request = (_electron || _load_electron()).net.request(Object.assign({ session: (_electron || _load_electron()).session.fromPartition(NET_SESSION_NAME) }, options), callback); | ||
this.addProxyLoginHandler(request); | ||
return request; | ||
} | ||
addProxyLoginHandler(request) { | ||
if (this.proxyLoginCallback != null) { | ||
request.on("login", this.proxyLoginCallback); | ||
} | ||
} | ||
} | ||
exports.ElectronHttpExecutor = ElectronHttpExecutor; //# sourceMappingURL=electronHttpExecutor.js.map |
{ | ||
"name": "electron-updater", | ||
"version": "1.14.4", | ||
"version": "1.15.0", | ||
"description": "Cross platform updater for electron applications", | ||
@@ -16,7 +16,7 @@ "main": "out/main.js", | ||
"bluebird-lst": "^1.0.2", | ||
"fs-extra-p": "^4.1.0", | ||
"fs-extra-p": "^4.3.0", | ||
"js-yaml": "^3.8.3", | ||
"semver": "^5.3.0", | ||
"source-map-support": "^0.4.15", | ||
"electron-builder-http": "~17.2.0", | ||
"electron-builder-http": "~17.4.0", | ||
"electron-is-dev": "^0.1.2", | ||
@@ -23,0 +23,0 @@ "xelement": "^1.0.14", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137369
1418
+ Addedelectron-builder-http@17.4.0(transitive)
- Removedelectron-builder-http@17.2.0(transitive)
Updatedfs-extra-p@^4.3.0