Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const adapters = [
new sdk.scanner.adapters.BlockDeviceAdapter(includeSystemDrives)
]
// Can't use permissions.isElevated() here as it returns a promise and we need to set
// module.exports = scanner right now.
// eslint-disable-next-line no-magic-numbers
if ((process.platform !== 'linux') || (process.geteuid() === 0)) {
adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter())
}
if (process.platform === 'win32') {
adapters.push(new sdk.scanner.adapters.DriverlessDeviceAdapter())
}
const scanner = new sdk.scanner.Scanner(adapters)
module.exports = scanner
/**
* @summary returns true if system drives should be shown
* @function
*
* @returns {Boolean}
*
* @example
* const shouldInclude = includeSystemDrives()
*/
const includeSystemDrives = () => {
return settings.get('unsafeMode') && !settings.get('disableUnsafeMode')
}
const adapters = [
new sdk.scanner.adapters.BlockDeviceAdapter(includeSystemDrives)
]
// Can't use permissions.isElevated() here as it returns a promise and we need to set
// module.exports = scanner right now.
// eslint-disable-next-line no-magic-numbers
if ((process.platform !== 'linux') || (process.geteuid() === 0)) {
adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter())
}
if (process.platform === 'win32') {
adapters.push(new sdk.scanner.adapters.DriverlessDeviceAdapter())
}
const scanner = new sdk.scanner.Scanner(adapters)
module.exports = scanner