electron-updater
Advanced tools
Comparing version 6.1.4 to 6.1.5
@@ -14,3 +14,3 @@ /// <reference types="node" /> | ||
import { AuthInfo } from "electron"; | ||
export declare type AppUpdaterEvents = { | ||
export type AppUpdaterEvents = { | ||
error: (error: Error, message?: string) => void; | ||
@@ -17,0 +17,0 @@ login: (info: AuthInfo, callback: LoginCallback) => void; |
@@ -19,2 +19,58 @@ "use strict"; | ||
class AppUpdater extends events_1.EventEmitter { | ||
/** | ||
* Get the update channel. Not applicable for GitHub. Doesn't return `channel` from the update configuration, only if was previously set. | ||
*/ | ||
get channel() { | ||
return this._channel; | ||
} | ||
/** | ||
* Set the update channel. Not applicable for GitHub. Overrides `channel` in the update configuration. | ||
* | ||
* `allowDowngrade` will be automatically set to `true`. If this behavior is not suitable for you, simple set `allowDowngrade` explicitly after. | ||
*/ | ||
set channel(value) { | ||
if (this._channel != null) { | ||
// noinspection SuspiciousTypeOfGuard | ||
if (typeof value !== "string") { | ||
throw (0, builder_util_runtime_1.newError)(`Channel must be a string, but got: ${value}`, "ERR_UPDATER_INVALID_CHANNEL"); | ||
} | ||
else if (value.length === 0) { | ||
throw (0, builder_util_runtime_1.newError)(`Channel must be not an empty string`, "ERR_UPDATER_INVALID_CHANNEL"); | ||
} | ||
} | ||
this._channel = value; | ||
this.allowDowngrade = true; | ||
} | ||
/** | ||
* Shortcut for explicitly adding auth tokens to request headers | ||
*/ | ||
addAuthHeader(token) { | ||
this.requestHeaders = Object.assign({}, this.requestHeaders, { | ||
authorization: token, | ||
}); | ||
} | ||
// noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols | ||
get netSession() { | ||
return (0, electronHttpExecutor_1.getNetSession)(); | ||
} | ||
/** | ||
* 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() }`. | ||
* Set it to `null` if you would like to disable a logging feature. | ||
*/ | ||
get logger() { | ||
return this._logger; | ||
} | ||
set logger(value) { | ||
this._logger = value == null ? new NoOpLogger() : value; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* test only | ||
* @private | ||
*/ | ||
set updateConfigPath(value) { | ||
this.clientPromise = null; | ||
this._appUpdateConfigPath = value; | ||
this.configOnDisk = new lazy_val_1.Lazy(() => this.loadUpdateConfig()); | ||
} | ||
constructor(options, app) { | ||
@@ -121,58 +177,2 @@ super(); | ||
} | ||
/** | ||
* Get the update channel. Not applicable for GitHub. Doesn't return `channel` from the update configuration, only if was previously set. | ||
*/ | ||
get channel() { | ||
return this._channel; | ||
} | ||
/** | ||
* Set the update channel. Not applicable for GitHub. Overrides `channel` in the update configuration. | ||
* | ||
* `allowDowngrade` will be automatically set to `true`. If this behavior is not suitable for you, simple set `allowDowngrade` explicitly after. | ||
*/ | ||
set channel(value) { | ||
if (this._channel != null) { | ||
// noinspection SuspiciousTypeOfGuard | ||
if (typeof value !== "string") { | ||
throw (0, builder_util_runtime_1.newError)(`Channel must be a string, but got: ${value}`, "ERR_UPDATER_INVALID_CHANNEL"); | ||
} | ||
else if (value.length === 0) { | ||
throw (0, builder_util_runtime_1.newError)(`Channel must be not an empty string`, "ERR_UPDATER_INVALID_CHANNEL"); | ||
} | ||
} | ||
this._channel = value; | ||
this.allowDowngrade = true; | ||
} | ||
/** | ||
* Shortcut for explicitly adding auth tokens to request headers | ||
*/ | ||
addAuthHeader(token) { | ||
this.requestHeaders = Object.assign({}, this.requestHeaders, { | ||
authorization: token, | ||
}); | ||
} | ||
// noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols | ||
get netSession() { | ||
return (0, electronHttpExecutor_1.getNetSession)(); | ||
} | ||
/** | ||
* 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() }`. | ||
* Set it to `null` if you would like to disable a logging feature. | ||
*/ | ||
get logger() { | ||
return this._logger; | ||
} | ||
set logger(value) { | ||
this._logger = value == null ? new NoOpLogger() : value; | ||
} | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* test only | ||
* @private | ||
*/ | ||
set updateConfigPath(value) { | ||
this.clientPromise = null; | ||
this._appUpdateConfigPath = value; | ||
this.configOnDisk = new lazy_val_1.Lazy(() => this.loadUpdateConfig()); | ||
} | ||
//noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols | ||
@@ -179,0 +179,0 @@ getFeedURL() { |
@@ -8,3 +8,3 @@ "use strict"; | ||
OperationKind[OperationKind["DOWNLOAD"] = 1] = "DOWNLOAD"; | ||
})(OperationKind = exports.OperationKind || (exports.OperationKind = {})); | ||
})(OperationKind || (exports.OperationKind = OperationKind = {})); | ||
function computeOperations(oldBlockMap, newBlockMap, logger) { | ||
@@ -11,0 +11,0 @@ const nameToOldBlocks = buildBlockFileMap(oldBlockMap.files); |
@@ -7,3 +7,3 @@ /// <reference types="node" /> | ||
import ClientRequest = Electron.ClientRequest; | ||
export declare type LoginCallback = (username: string, password: string) => void; | ||
export type LoginCallback = (username: string, password: string) => void; | ||
export declare const NET_SESSION_NAME = "electron-updater"; | ||
@@ -10,0 +10,0 @@ export declare function getNetSession(): Session; |
@@ -29,6 +29,6 @@ /// <reference types="node" /> | ||
} | ||
export declare type UpdaterEvents = "login" | "checking-for-update" | "update-available" | "update-not-available" | "update-cancelled" | "download-progress" | "update-downloaded" | "error"; | ||
export type UpdaterEvents = "login" | "checking-for-update" | "update-available" | "update-not-available" | "update-cancelled" | "download-progress" | "update-downloaded" | "error"; | ||
export declare const DOWNLOAD_PROGRESS = "download-progress"; | ||
export declare const UPDATE_DOWNLOADED = "update-downloaded"; | ||
export declare type LoginHandler = (authInfo: any, callback: LoginCallback) => void; | ||
export type LoginHandler = (authInfo: any, callback: LoginCallback) => void; | ||
export declare class UpdaterSignal { | ||
@@ -54,2 +54,2 @@ private emitter; | ||
} | ||
export declare type verifyUpdateCodeSignature = (publisherName: string[], path: string) => Promise<string | null>; | ||
export type verifyUpdateCodeSignature = (publisherName: string[], path: string) => Promise<string | null>; |
@@ -131,6 +131,11 @@ "use strict"; | ||
const errorCode = e.code; | ||
this._logger.info(`Cannot run installer: error code: ${errorCode}, error message: "${e.message}", will be executed again using elevate if EACCES"`); | ||
this._logger.info(`Cannot run installer: error code: ${errorCode}, error message: "${e.message}", will be executed again using elevate if EACCES, and will try to use electron.shell.openItem if ENOENT`); | ||
if (errorCode === "UNKNOWN" || errorCode === "EACCES") { | ||
callUsingElevation(); | ||
} | ||
else if (errorCode === "ENOENT") { | ||
require("electron") | ||
.shell.openPath(options.installerPath) | ||
.catch((err) => this.dispatchError(err)); | ||
} | ||
else { | ||
@@ -137,0 +142,0 @@ this.dispatchError(e); |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { ResolvedUpdateFileInfo } from "../main"; | ||
export declare type ProviderPlatform = "darwin" | "linux" | "win32"; | ||
export type ProviderPlatform = "darwin" | "linux" | "win32"; | ||
export interface ProviderRuntimeOptions { | ||
@@ -11,0 +11,0 @@ isUseMultipleRangeRequest: boolean; |
{ | ||
"name": "electron-updater", | ||
"version": "6.1.4", | ||
"version": "6.1.5", | ||
"description": "Cross platform updater for electron applications", | ||
@@ -19,3 +19,2 @@ "main": "out/main.js", | ||
"dependencies": { | ||
"builder-util-runtime": "9.2.1", | ||
"fs-extra": "^10.1.0", | ||
@@ -27,3 +26,4 @@ "js-yaml": "^4.1.0", | ||
"semver": "^7.3.8", | ||
"tiny-typed-emitter": "^2.1.0" | ||
"tiny-typed-emitter": "^2.1.0", | ||
"builder-util-runtime": "9.2.1" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
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
448275
4080