mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-21 10:16:32 +00:00
Merge pull request #2369 from resin-io/feature-settings
feat: Use settings for feature control
This commit is contained in:
commit
de501f5ba3
@ -64,9 +64,7 @@ window.localStorage.debug = process.env.DEBUG
|
|||||||
* @constant
|
* @constant
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
const BLACKLISTED_DRIVES = process.env.ETCHER_BLACKLISTED_DRIVES
|
const BLACKLISTED_DRIVES = settings.get('driveBlacklist')
|
||||||
? process.env.ETCHER_BLACKLISTED_DRIVES.split(',')
|
|
||||||
: []
|
|
||||||
|
|
||||||
const app = angular.module('Etcher', [
|
const app = angular.module('Etcher', [
|
||||||
require('angular-ui-router'),
|
require('angular-ui-router'),
|
||||||
@ -362,7 +360,7 @@ app.controller('HeaderController', function (OSOpenExternalService) {
|
|||||||
* HeaderController.shouldShowHelp()
|
* HeaderController.shouldShowHelp()
|
||||||
*/
|
*/
|
||||||
this.shouldShowHelp = () => {
|
this.shouldShowHelp = () => {
|
||||||
return !process.env.ETCHER_DISABLE_EXTERNAL_LINKS
|
return !settings.get('disableExternalLinks')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const settings = require('../../../models/settings')
|
||||||
|
|
||||||
module.exports = function (
|
module.exports = function (
|
||||||
$uibModalInstance
|
$uibModalInstance
|
||||||
) {
|
) {
|
||||||
@ -43,6 +45,7 @@ module.exports = function (
|
|||||||
*/
|
*/
|
||||||
this.getFolderConstraint = () => {
|
this.getFolderConstraint = () => {
|
||||||
// TODO(Shou): get this dynamically from the mountpoint of a specific port in Etcher Pro
|
// TODO(Shou): get this dynamically from the mountpoint of a specific port in Etcher Pro
|
||||||
return process.env.ETCHER_FILE_BROWSER_CONSTRAIN_FOLDER
|
// TODO: Make this handle multiple constraints
|
||||||
|
return settings.get('fileBrowserConstraintPath')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ const react = require('react')
|
|||||||
const propTypes = require('prop-types')
|
const propTypes = require('prop-types')
|
||||||
const { react2angular } = require('react2angular')
|
const { react2angular } = require('react2angular')
|
||||||
const analytics = require('../modules/analytics')
|
const analytics = require('../modules/analytics')
|
||||||
|
const settings = require('../models/settings')
|
||||||
const packageJSON = require('../../../../package.json')
|
const packageJSON = require('../../../../package.json')
|
||||||
|
|
||||||
const MODULE_NAME = 'Etcher.Components.SafeWebview'
|
const MODULE_NAME = 'Etcher.Components.SafeWebview'
|
||||||
@ -217,7 +218,7 @@ class SafeWebview extends react.PureComponent {
|
|||||||
event.disposition === 'foreground-tab',
|
event.disposition === 'foreground-tab',
|
||||||
|
|
||||||
// Don't open links if they're disabled by the env var
|
// Don't open links if they're disabled by the env var
|
||||||
!process.env.ETCHER_DISABLE_EXTERNAL_LINKS
|
!settings.get('disableExternalLinks')
|
||||||
])) {
|
])) {
|
||||||
electron.shell.openExternal(url.href)
|
electron.shell.openExternal(url.href)
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ const currentWindow = electron.remote.getCurrentWindow()
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
exports.shouldCheckForUpdates = (options) => {
|
exports.shouldCheckForUpdates = (options) => {
|
||||||
if (process.env.ELECTRON_RESIN_UPDATE_LOCK) {
|
if (settings.get('resinUpdateLock')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,14 @@ const JSON_INDENT = 2
|
|||||||
* - `$XDG_CONFIG_HOME/etcher` or `~/.config/etcher` on Linux
|
* - `$XDG_CONFIG_HOME/etcher` or `~/.config/etcher` on Linux
|
||||||
* - `~/Library/Application Support/etcher` on macOS
|
* - `~/Library/Application Support/etcher` on macOS
|
||||||
* See https://electronjs.org/docs/api/app#appgetpathname
|
* See https://electronjs.org/docs/api/app#appgetpathname
|
||||||
|
* NOTE: The ternary is due to this module being loaded both,
|
||||||
|
* in Electron's main and renderer processes
|
||||||
* @constant
|
* @constant
|
||||||
* @type {String}
|
* @type {String}
|
||||||
*/
|
*/
|
||||||
const USER_DATA_DIR = electron.remote.app.getPath('userData')
|
const USER_DATA_DIR = electron.app
|
||||||
|
? electron.app.getPath('userData')
|
||||||
|
: electron.remote.app.getPath('userData')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Configuration file path
|
* @summary Configuration file path
|
||||||
@ -64,15 +68,21 @@ const CONFIG_PATH = path.join(USER_DATA_DIR, 'config.json')
|
|||||||
*/
|
*/
|
||||||
const readConfigFile = (filename) => {
|
const readConfigFile = (filename) => {
|
||||||
return new Bluebird((resolve, reject) => {
|
return new Bluebird((resolve, reject) => {
|
||||||
fs.readFile(filename, (error, buffer) => {
|
fs.readFile(filename, { encoding: 'utf8' }, (error, contents) => {
|
||||||
|
let data = {}
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error.code === 'ENOENT') {
|
if (error.code === 'ENOENT') {
|
||||||
resolve({})
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resolve(JSON.parse(buffer.toString()))
|
try {
|
||||||
|
data = JSON.parse(contents)
|
||||||
|
} catch (parseError) {
|
||||||
|
console.error(parseError)
|
||||||
|
}
|
||||||
|
resolve(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -184,6 +184,22 @@ exports.get = (key) => {
|
|||||||
return _.cloneDeep(_.get(settings, [ key ]))
|
return _.cloneDeep(_.get(settings, [ key ]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Check if setting value exists
|
||||||
|
* @function
|
||||||
|
* @public
|
||||||
|
*
|
||||||
|
* @param {String} key - setting key
|
||||||
|
* @returns {Boolean} exists
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const hasValue = settings.has('unmountOnSuccess');
|
||||||
|
*/
|
||||||
|
exports.has = (key) => {
|
||||||
|
/* eslint-disable no-eq-null */
|
||||||
|
return settings[key] != null
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Get all setting values
|
* @summary Get all setting values
|
||||||
* @function
|
* @function
|
||||||
|
@ -25,6 +25,7 @@ const supportedFormats = require('../../../shared/supported-formats')
|
|||||||
const errors = require('../../../shared/errors')
|
const errors = require('../../../shared/errors')
|
||||||
const fileExtensions = require('../../../shared/file-extensions')
|
const fileExtensions = require('../../../shared/file-extensions')
|
||||||
const utils = require('../../../shared/utils')
|
const utils = require('../../../shared/utils')
|
||||||
|
const settings = require('./settings')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Verify and throw if any state fields are nil
|
* @summary Verify and throw if any state fields are nil
|
||||||
@ -184,7 +185,7 @@ const storeReducer = (state = DEFAULT_STATE, action) => {
|
|||||||
return accState
|
return accState
|
||||||
}, newState)
|
}, newState)
|
||||||
|
|
||||||
const shouldAutoselectAll = Boolean(process.env.ETCHER_DISABLE_EXPLICIT_DRIVE_SELECTION)
|
const shouldAutoselectAll = Boolean(settings.get('disableExplicitDriveSelection'))
|
||||||
const AUTOSELECT_DRIVE_COUNT = 1
|
const AUTOSELECT_DRIVE_COUNT = 1
|
||||||
const nonStaleSelectedDevices = nonStaleNewState.getIn([ 'selection', 'devices' ]).toJS()
|
const nonStaleSelectedDevices = nonStaleNewState.getIn([ 'selection', 'devices' ]).toJS()
|
||||||
const hasSelectedDevices = nonStaleSelectedDevices.length >= AUTOSELECT_DRIVE_COUNT
|
const hasSelectedDevices = nonStaleSelectedDevices.length >= AUTOSELECT_DRIVE_COUNT
|
||||||
|
@ -23,9 +23,9 @@ const settings = require('../models/settings')
|
|||||||
|
|
||||||
resinCorvus.install({
|
resinCorvus.install({
|
||||||
services: {
|
services: {
|
||||||
sentry: process.env.ANALYTICS_SENTRY_TOKEN ||
|
sentry: settings.get('analyticsSentryToken') ||
|
||||||
_.get(packageJSON, [ 'analytics', 'sentry', 'token' ]),
|
_.get(packageJSON, [ 'analytics', 'sentry', 'token' ]),
|
||||||
mixpanel: process.env.ANALYTICS_MIXPANEL_TOKEN ||
|
mixpanel: settings.get('analyticsMixpanelToken') ||
|
||||||
_.get(packageJSON, [ 'analytics', 'mixpanel', 'token' ])
|
_.get(packageJSON, [ 'analytics', 'mixpanel', 'token' ])
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
@ -23,7 +23,7 @@ const permissions = require('../../../shared/permissions')
|
|||||||
const scanner = SDK.createScanner({
|
const scanner = SDK.createScanner({
|
||||||
blockdevice: {
|
blockdevice: {
|
||||||
get includeSystemDrives () {
|
get includeSystemDrives () {
|
||||||
return settings.get('unsafeMode') && !process.env.ETCHER_HIDE_UNSAFE_MODE
|
return settings.get('unsafeMode') && !settings.get('disableUnsafeMode')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
usbboot: {}
|
usbboot: {}
|
||||||
|
@ -21,6 +21,7 @@ const EventEmitter = require('events')
|
|||||||
const createInactivityTimer = require('inactivity-timer')
|
const createInactivityTimer = require('inactivity-timer')
|
||||||
const debug = require('debug')('etcher:update-lock')
|
const debug = require('debug')('etcher:update-lock')
|
||||||
const analytics = require('./analytics')
|
const analytics = require('./analytics')
|
||||||
|
const settings = require('../models/settings')
|
||||||
|
|
||||||
/* eslint-disable no-magic-numbers, callback-return */
|
/* eslint-disable no-magic-numbers, callback-return */
|
||||||
|
|
||||||
@ -29,8 +30,8 @@ const analytics = require('./analytics')
|
|||||||
* @type {Number}
|
* @type {Number}
|
||||||
* @constant
|
* @constant
|
||||||
*/
|
*/
|
||||||
const INTERACTION_TIMEOUT_MS = process.env.ETCHER_INTERACTION_TIMEOUT_MS
|
const INTERACTION_TIMEOUT_MS = settings.has('interactionTimeout')
|
||||||
? parseInt(process.env.ETCHER_INTERACTION_TIMEOUT_MS, 10)
|
? parseInt(settings.get('interactionTimeout'), 10)
|
||||||
: 5 * 60 * 1000
|
: 5 * 60 * 1000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +61,7 @@ class UpdateLock extends EventEmitter {
|
|||||||
* this.on('inactive', onInactive)
|
* this.on('inactive', onInactive)
|
||||||
*/
|
*/
|
||||||
static onInactive () {
|
static onInactive () {
|
||||||
if (process.env.ELECTRON_RESIN_UPDATE_LOCK) {
|
if (settings.get('resinUpdateLock')) {
|
||||||
UpdateLock.check((checkError, isLocked) => {
|
UpdateLock.check((checkError, isLocked) => {
|
||||||
debug('inactive-check', Boolean(checkError))
|
debug('inactive-check', Boolean(checkError))
|
||||||
if (checkError) {
|
if (checkError) {
|
||||||
@ -89,7 +90,7 @@ class UpdateLock extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
static acquire (callback) {
|
static acquire (callback) {
|
||||||
debug('lock')
|
debug('lock')
|
||||||
if (process.env.ELECTRON_RESIN_UPDATE_LOCK) {
|
if (settings.get('resinUpdateLock')) {
|
||||||
electron.ipcRenderer.once('resin-update-lock', (event, error) => {
|
electron.ipcRenderer.once('resin-update-lock', (event, error) => {
|
||||||
callback(error)
|
callback(error)
|
||||||
})
|
})
|
||||||
@ -110,7 +111,7 @@ class UpdateLock extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
static release (callback) {
|
static release (callback) {
|
||||||
debug('unlock')
|
debug('unlock')
|
||||||
if (process.env.ELECTRON_RESIN_UPDATE_LOCK) {
|
if (settings.get('resinUpdateLock')) {
|
||||||
electron.ipcRenderer.once('resin-update-lock', (event, error) => {
|
electron.ipcRenderer.once('resin-update-lock', (event, error) => {
|
||||||
callback(error)
|
callback(error)
|
||||||
})
|
})
|
||||||
@ -133,7 +134,7 @@ class UpdateLock extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
static check (callback) {
|
static check (callback) {
|
||||||
debug('check')
|
debug('check')
|
||||||
if (process.env.ELECTRON_RESIN_UPDATE_LOCK) {
|
if (settings.get('resinUpdateLock')) {
|
||||||
electron.ipcRenderer.once('resin-update-lock', (event, error, isLocked) => {
|
electron.ipcRenderer.once('resin-update-lock', (event, error, isLocked) => {
|
||||||
callback(error, isLocked)
|
callback(error, isLocked)
|
||||||
})
|
})
|
||||||
@ -160,7 +161,7 @@ class UpdateLock extends EventEmitter {
|
|||||||
|
|
||||||
// When extending, check that we have the lock,
|
// When extending, check that we have the lock,
|
||||||
// and acquire it, if not
|
// and acquire it, if not
|
||||||
if (process.env.ELECTRON_RESIN_UPDATE_LOCK) {
|
if (settings.get('resinUpdateLock')) {
|
||||||
UpdateLock.check((checkError, isLocked) => {
|
UpdateLock.check((checkError, isLocked) => {
|
||||||
if (checkError) {
|
if (checkError) {
|
||||||
analytics.logException(checkError)
|
analytics.logException(checkError)
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
|
const settings = require('../../../models/settings')
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
/**
|
/**
|
||||||
@ -32,7 +33,7 @@ module.exports = function () {
|
|||||||
*/
|
*/
|
||||||
this.open = (url) => {
|
this.open = (url) => {
|
||||||
// Don't open links if they're disabled by the env var
|
// Don't open links if they're disabled by the env var
|
||||||
if (process.env.ETCHER_DISABLE_EXTERNAL_LINKS) {
|
if (settings.get('disableExternalLinks')) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ module.exports = function (DriveSelectorService) {
|
|||||||
|
|
||||||
analytics.logEvent('Select drive', {
|
analytics.logEvent('Select drive', {
|
||||||
device: drive.device,
|
device: drive.device,
|
||||||
unsafeMode: settings.get('unsafeMode') && !process.env.ETCHER_HIDE_UNSAFE_MODE
|
unsafeMode: settings.get('unsafeMode') && !settings.get('disableUnsafeMode')
|
||||||
})
|
})
|
||||||
}).catch(exceptionReporter.report)
|
}).catch(exceptionReporter.report)
|
||||||
}
|
}
|
||||||
@ -148,6 +148,6 @@ module.exports = function (DriveSelectorService) {
|
|||||||
* DriveSelectionController.shouldShowDrivesButton()
|
* DriveSelectionController.shouldShowDrivesButton()
|
||||||
*/
|
*/
|
||||||
this.shouldShowDrivesButton = () => {
|
this.shouldShowDrivesButton = () => {
|
||||||
return !process.env.ETCHER_DISABLE_EXPLICIT_DRIVE_SELECTION
|
return !settings.get('disableExplicitDriveSelection')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ const errors = require('../../../../../shared/errors')
|
|||||||
const imageStream = require('../../../../../sdk/image-stream')
|
const imageStream = require('../../../../../sdk/image-stream')
|
||||||
const supportedFormats = require('../../../../../shared/supported-formats')
|
const supportedFormats = require('../../../../../shared/supported-formats')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
|
const settings = require('../../../models/settings')
|
||||||
const selectionState = require('../../../models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const osDialog = require('../../../os/dialog')
|
const osDialog = require('../../../os/dialog')
|
||||||
const exceptionReporter = require('../../../modules/exception-reporter')
|
const exceptionReporter = require('../../../modules/exception-reporter')
|
||||||
@ -156,7 +157,7 @@ module.exports = function (
|
|||||||
this.openImageSelector = () => {
|
this.openImageSelector = () => {
|
||||||
analytics.logEvent('Open image selector')
|
analytics.logEvent('Open image selector')
|
||||||
|
|
||||||
if (process.env.ETCHER_EXPERIMENTAL_FILE_PICKER) {
|
if (settings.get('experimentalFilePicker')) {
|
||||||
FileSelectorService.open()
|
FileSelectorService.open()
|
||||||
} else {
|
} else {
|
||||||
osDialog.selectImage().then((imagePath) => {
|
osDialog.selectImage().then((imagePath) => {
|
||||||
|
@ -116,6 +116,6 @@ module.exports = function (WarningModalService) {
|
|||||||
* SettingsController.shouldShowUnsafeMode()
|
* SettingsController.shouldShowUnsafeMode()
|
||||||
*/
|
*/
|
||||||
this.shouldShowUnsafeMode = () => {
|
this.shouldShowUnsafeMode = () => {
|
||||||
return !process.env.ETCHER_HIDE_UNSAFE_MODE
|
return !settings.get('disableUnsafeMode')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,31 +20,29 @@ const electron = require('electron')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const EXIT_CODES = require('../shared/exit-codes')
|
const EXIT_CODES = require('../shared/exit-codes')
|
||||||
const buildWindowMenu = require('./menu')
|
const buildWindowMenu = require('./menu')
|
||||||
|
const settings = require('./app/models/settings')
|
||||||
|
|
||||||
|
/* eslint-disable lodash/prefer-lodash-method */
|
||||||
|
|
||||||
|
const config = settings.getDefaults()
|
||||||
let mainWindow = null
|
let mainWindow = null
|
||||||
|
|
||||||
electron.app.on('window-all-closed', electron.app.quit)
|
/**
|
||||||
|
* @summary Create Etcher's main window
|
||||||
// Sending a `SIGINT` (e.g: Ctrl-C) to an Electron app that registers
|
* @example
|
||||||
// a `beforeunload` window event handler results in a disconnected white
|
* electron.app.on('ready', createMainWindow)
|
||||||
// browser window in GNU/Linux and macOS.
|
*/
|
||||||
// The `before-quit` Electron event is triggered in `SIGINT`, so we can
|
const createMainWindow = () => {
|
||||||
// make use of it to ensure the browser window is completely destroyed.
|
|
||||||
// See https://github.com/electron/electron/issues/5273
|
|
||||||
electron.app.on('before-quit', () => {
|
|
||||||
process.exit(EXIT_CODES.SUCCESS)
|
|
||||||
})
|
|
||||||
|
|
||||||
electron.app.on('ready', () => {
|
|
||||||
mainWindow = new electron.BrowserWindow({
|
mainWindow = new electron.BrowserWindow({
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 380,
|
height: 380,
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
show: false,
|
show: false,
|
||||||
resizable: Boolean(process.env.ETCHER_FULLSCREEN),
|
resizable: Boolean(config.fullscreen),
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
fullscreen: Boolean(process.env.ETCHER_FULLSCREEN),
|
fullscreen: Boolean(config.fullscreen),
|
||||||
fullscreenable: Boolean(process.env.ETCHER_FULLSCREEN),
|
fullscreenable: Boolean(config.fullscreen),
|
||||||
kiosk: Boolean(process.env.ETCHER_FULLSCREEN),
|
kiosk: Boolean(config.fullscreen),
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
titleBarStyle: 'hidden-inset',
|
titleBarStyle: 'hidden-inset',
|
||||||
icon: path.join(__dirname, '..', '..', 'assets', 'icon.png'),
|
icon: path.join(__dirname, '..', '..', 'assets', 'icon.png'),
|
||||||
@ -57,7 +55,10 @@ electron.app.on('ready', () => {
|
|||||||
buildWindowMenu(mainWindow)
|
buildWindowMenu(mainWindow)
|
||||||
|
|
||||||
// Prevent flash of white when starting the application
|
// Prevent flash of white when starting the application
|
||||||
mainWindow.on('ready-to-show', mainWindow.show)
|
mainWindow.on('ready-to-show', () => {
|
||||||
|
console.timeEnd('ready-to-show')
|
||||||
|
mainWindow.show()
|
||||||
|
})
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('closed', () => {
|
||||||
mainWindow = null
|
mainWindow = null
|
||||||
@ -81,4 +82,32 @@ electron.app.on('ready', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
mainWindow.loadURL(`file://${path.join(__dirname, 'app', 'index.html')}`)
|
mainWindow.loadURL(`file://${path.join(__dirname, 'app', 'index.html')}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
electron.app.on('window-all-closed', electron.app.quit)
|
||||||
|
|
||||||
|
// Sending a `SIGINT` (e.g: Ctrl-C) to an Electron app that registers
|
||||||
|
// a `beforeunload` window event handler results in a disconnected white
|
||||||
|
// browser window in GNU/Linux and macOS.
|
||||||
|
// The `before-quit` Electron event is triggered in `SIGINT`, so we can
|
||||||
|
// make use of it to ensure the browser window is completely destroyed.
|
||||||
|
// See https://github.com/electron/electron/issues/5273
|
||||||
|
electron.app.on('before-quit', () => {
|
||||||
|
process.exit(EXIT_CODES.SUCCESS)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
settings.load().then((localSettings) => {
|
||||||
|
Object.assign(config, localSettings)
|
||||||
|
}).catch((error) => {
|
||||||
|
// TODO: What do if loading the config fails?
|
||||||
|
console.error('Error loading settings:')
|
||||||
|
console.error(error)
|
||||||
|
}).finally(() => {
|
||||||
|
if (electron.app.isReady()) {
|
||||||
|
createMainWindow()
|
||||||
|
} else {
|
||||||
|
electron.app.on('ready', createMainWindow)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.time('ready-to-show')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user