diff --git a/lib/gui/app/app.js b/lib/gui/app/app.js index a434456f..080802e8 100644 --- a/lib/gui/app/app.js +++ b/lib/gui/app/app.js @@ -47,6 +47,8 @@ const driveScanner = require('./modules/drive-scanner') const osDialog = require('./os/dialog') const exceptionReporter = require('./modules/exception-reporter') +/* eslint-disable lodash/prefer-lodash-method */ + // Enable debug information from all modules that use `debug` // See https://github.com/visionmedia/debug#browser-support // @@ -55,6 +57,16 @@ const exceptionReporter = require('./modules/exception-reporter') process.env.DRIVELIST_DEBUG = /drivelist|^\*$/i.test(process.env.DEBUG) ? '1' : '' window.localStorage.debug = process.env.DEBUG +/** + * @summary Environment variable blacklisted drives by path + * @type {Array} + * @constant + * @private + */ +const BLACKLISTED_DRIVES = process.env.ETCHER_BLACKLISTED_DRIVES + ? process.env.ETCHER_BLACKLISTED_DRIVES.split(',') + : [] + const app = angular.module('Etcher', [ require('angular-ui-router'), require('angular-ui-bootstrap'), @@ -209,7 +221,14 @@ app.run(($timeout) => { // available drives list has changed, and incorrectly // keeps asking the user to "Connect a drive". $timeout(() => { - availableDrives.setDrives(drives) + if (BLACKLISTED_DRIVES.length) { + const allowedDrives = drives.filter((drive) => { + return !BLACKLISTED_DRIVES.includes(drive.device) + }) + availableDrives.setDrives(allowedDrives) + } else { + availableDrives.setDrives(drives) + } }) })