| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getDefaultChannelName = getDefaultChannelName;
- exports.getCustomChannelName = getCustomChannelName;
- exports.getCurrentPlatform = getCurrentPlatform;
- exports.isUseOldMacProvider = isUseOldMacProvider;
- exports.getChannelFilename = getChannelFilename;
- exports.newBaseUrl = newBaseUrl;
- exports.newUrlFromBase = newUrlFromBase;
- Object.defineProperty(exports, "AppUpdater", {
- enumerable: true,
- get: function () {
- return _AppUpdater().AppUpdater;
- }
- });
- Object.defineProperty(exports, "NoOpLogger", {
- enumerable: true,
- get: function () {
- return _AppUpdater().NoOpLogger;
- }
- });
- Object.defineProperty(exports, "CancellationToken", {
- enumerable: true,
- get: function () {
- return _builderUtilRuntime().CancellationToken;
- }
- });
- Object.defineProperty(exports, "Provider", {
- enumerable: true,
- get: function () {
- return _Provider().Provider;
- }
- });
- exports.UpdaterSignal = exports.UPDATE_DOWNLOADED = exports.DOWNLOAD_PROGRESS = void 0;
- function _url() {
- const data = require("url");
- _url = function () {
- return data;
- };
- return data;
- }
- function _AppUpdater() {
- const data = require("./AppUpdater");
- _AppUpdater = function () {
- return data;
- };
- return data;
- }
- function _builderUtilRuntime() {
- const data = require("builder-util-runtime");
- _builderUtilRuntime = function () {
- return data;
- };
- return data;
- }
- function _Provider() {
- const data = require("./providers/Provider");
- _Provider = function () {
- return data;
- };
- return data;
- }
- // autoUpdater to mimic electron bundled autoUpdater
- let _autoUpdater;
- function _load_autoUpdater() {
- // tslint:disable:prefer-conditional-expression
- if (process.platform === "win32") {
- _autoUpdater = new (require("./NsisUpdater").NsisUpdater)();
- } else if (process.platform === "darwin") {
- _autoUpdater = new (require("./MacUpdater").MacUpdater)();
- } else {
- _autoUpdater = new (require("./AppImageUpdater").AppImageUpdater)();
- }
- return _autoUpdater;
- }
- Object.defineProperty(exports, "autoUpdater", {
- enumerable: true,
- get: () => {
- return _autoUpdater || _load_autoUpdater();
- }
- }); // due to historical reasons for windows we use channel name without platform specifier
- function getDefaultChannelName() {
- return `latest${getChannelFilePrefix()}`;
- }
- function getChannelFilePrefix() {
- const currentPlatform = getCurrentPlatform();
- if (currentPlatform === "linux") {
- const arch = process.env.TEST_UPDATER_ARCH || process.arch;
- const archSuffix = arch === "x64" ? "" : `-${arch}`;
- return "-linux" + archSuffix;
- } else {
- return currentPlatform === "darwin" ? "-mac" : "";
- }
- }
- function getCustomChannelName(channel) {
- return `${channel}${getChannelFilePrefix()}`;
- }
- function getCurrentPlatform() {
- return process.env.TEST_UPDATER_PLATFORM || process.platform;
- }
- function isUseOldMacProvider() {
- // getCurrentPlatform() === "darwin"
- return false;
- }
- function getChannelFilename(channel) {
- return `${channel}.yml`;
- }
- const DOWNLOAD_PROGRESS = "download-progress";
- exports.DOWNLOAD_PROGRESS = DOWNLOAD_PROGRESS;
- const UPDATE_DOWNLOADED = "update-downloaded";
- exports.UPDATE_DOWNLOADED = UPDATE_DOWNLOADED;
- class UpdaterSignal {
- constructor(emitter) {
- this.emitter = emitter;
- }
- /**
- * Emitted when an authenticating proxy is [asking for user credentials](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login).
- */
- login(handler) {
- addHandler(this.emitter, "login", handler);
- }
- progress(handler) {
- addHandler(this.emitter, DOWNLOAD_PROGRESS, handler);
- }
- updateDownloaded(handler) {
- addHandler(this.emitter, UPDATE_DOWNLOADED, handler);
- }
- updateCancelled(handler) {
- addHandler(this.emitter, "update-cancelled", handler);
- }
- }
- exports.UpdaterSignal = UpdaterSignal;
- const isLogEvent = false;
- function addHandler(emitter, event, handler) {
- if (isLogEvent) {
- emitter.on(event, (...args) => {
- console.log("%s %s", event, args);
- handler.apply(null, args);
- });
- } else {
- emitter.on(event, handler);
- }
- } // if baseUrl path doesn't ends with /, this path will be not prepended to passed pathname for new URL(input, base)
- /** @internal */
- function newBaseUrl(url) {
- const result = new (_url().URL)(url);
- if (!result.pathname.endsWith("/")) {
- result.pathname += "/";
- }
- return result;
- } // addRandomQueryToAvoidCaching is false by default because in most cases URL already contains version number,
- // so, it makes sense only for Generic Provider for channel files
- function newUrlFromBase(pathname, baseUrl, addRandomQueryToAvoidCaching = false) {
- const result = new (_url().URL)(pathname, baseUrl); // search is not propagated (search is an empty string if not specified)
- const search = baseUrl.search;
- if (search != null && search.length !== 0) {
- result.search = search;
- } else if (addRandomQueryToAvoidCaching) {
- result.search = `noCache=${Date.now().toString(32)}`;
- }
- return result;
- }
- //# sourceMappingURL=main.js.map
|