mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 19:26:33 +00:00
Merge pull request #3628 from balena-io/device-info-draft
Device info draft
This commit is contained in:
commit
d22fc91585
@ -7,7 +7,6 @@ indent_size = 2
|
|||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
"generated",
|
"generated",
|
||||||
"lib/shared/catalina-sudo/sudo-askpass.osascript.js"
|
"lib/shared/catalina-sudo/sudo-askpass.osascript.js"
|
||||||
],
|
],
|
||||||
"beforeBuild": "./beforeBuild.js",
|
|
||||||
"afterSign": "./afterSignHook.js",
|
"afterSign": "./afterSignHook.js",
|
||||||
"mac": {
|
"mac": {
|
||||||
"category": "public.app-category.developer-tools",
|
"category": "public.app-category.developer-tools",
|
||||||
|
7
Makefile
7
Makefile
@ -90,11 +90,8 @@ TARGET_ARCH ?= $(HOST_ARCH)
|
|||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
electron-develop:
|
electron-develop:
|
||||||
git submodule update --init && \
|
git submodule update --init && \
|
||||||
$(RESIN_SCRIPTS)/electron/install.sh \
|
npm ci && \
|
||||||
-b $(shell pwd) \
|
npm run webpack
|
||||||
-r $(TARGET_ARCH) \
|
|
||||||
-s $(PLATFORM) \
|
|
||||||
-m $(NPM_VERSION)
|
|
||||||
|
|
||||||
electron-test:
|
electron-test:
|
||||||
$(RESIN_SCRIPTS)/electron/test.sh \
|
$(RESIN_SCRIPTS)/electron/test.sh \
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
const cp = require('child_process');
|
|
||||||
const rimraf = require('rimraf');
|
|
||||||
const process = require('process');
|
|
||||||
|
|
||||||
// Rebuild native modules for ia32 and run webpack again for the ia32 part of windows packages
|
|
||||||
exports.default = function(context) {
|
|
||||||
if (['windows', 'mac'].includes(context.platform.name)) {
|
|
||||||
const run = context.platform.name === 'windows' ? 'sh' : 'node';
|
|
||||||
cp.execFileSync(
|
|
||||||
run,
|
|
||||||
['node_modules/.bin/electron-rebuild', '--types', 'dev', '--arch', context.arch],
|
|
||||||
{
|
|
||||||
env: {
|
|
||||||
...process.env,
|
|
||||||
npm_config_msvs_version: '2019',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
rimraf.sync('generated');
|
|
||||||
cp.execFileSync(
|
|
||||||
run,
|
|
||||||
['node_modules/.bin/webpack'],
|
|
||||||
{
|
|
||||||
env: {
|
|
||||||
...process.env,
|
|
||||||
npm_config_target_arch: context.arch,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,6 @@ productName: balenaEtcher
|
|||||||
npmRebuild: true
|
npmRebuild: true
|
||||||
nodeGypRebuild: false
|
nodeGypRebuild: false
|
||||||
publish: null
|
publish: null
|
||||||
beforeBuild: "./beforeBuild.js"
|
|
||||||
afterPack: "./afterPack.js"
|
afterPack: "./afterPack.js"
|
||||||
asar: false
|
asar: false
|
||||||
files:
|
files:
|
||||||
|
@ -217,8 +217,7 @@ function prepareDrive(drive: Drive) {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
size: null,
|
size: null,
|
||||||
link:
|
link: 'https://www.raspberrypi.org/documentation/hardware/computemodule/cm-emmc-flashing.md',
|
||||||
'https://www.raspberrypi.org/documentation/hardware/computemodule/cm-emmc-flashing.md',
|
|
||||||
linkCTA: 'Install',
|
linkCTA: 'Install',
|
||||||
linkTitle: 'Install missing drivers',
|
linkTitle: 'Install missing drivers',
|
||||||
linkMessage: outdent`
|
linkMessage: outdent`
|
||||||
@ -335,7 +334,7 @@ window.addEventListener('beforeunload', async (event) => {
|
|||||||
flashingWorkflowUuid,
|
flashingWorkflowUuid,
|
||||||
});
|
});
|
||||||
popupExists = false;
|
popupExists = false;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
exceptionReporter.report(error);
|
exceptionReporter.report(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -379,8 +379,8 @@ export class DriveSelector extends React.Component<
|
|||||||
const displayedDrives = this.getDisplayedDrives(drives);
|
const displayedDrives = this.getDisplayedDrives(drives);
|
||||||
const disabledDrives = this.getDisabledDrives(drives, image);
|
const disabledDrives = this.getDisabledDrives(drives, image);
|
||||||
const numberOfSystemDrives = drives.filter(isSystemDrive).length;
|
const numberOfSystemDrives = drives.filter(isSystemDrive).length;
|
||||||
const numberOfDisplayedSystemDrives = displayedDrives.filter(isSystemDrive)
|
const numberOfDisplayedSystemDrives =
|
||||||
.length;
|
displayedDrives.filter(isSystemDrive).length;
|
||||||
const numberOfHiddenSystemDrives =
|
const numberOfHiddenSystemDrives =
|
||||||
numberOfSystemDrives - numberOfDisplayedSystemDrives;
|
numberOfSystemDrives - numberOfDisplayedSystemDrives;
|
||||||
const hasSystemDrives = selectedList.filter(isSystemDrive).length;
|
const hasSystemDrives = selectedList.filter(isSystemDrive).length;
|
||||||
@ -534,7 +534,7 @@ export class DriveSelector extends React.Component<
|
|||||||
if (missingDriversModal.drive !== undefined) {
|
if (missingDriversModal.drive !== undefined) {
|
||||||
openExternal(missingDriversModal.drive.link);
|
openExternal(missingDriversModal.drive.link);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
logException(error);
|
logException(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({ missingDriversModal: {} });
|
this.setState({ missingDriversModal: {} });
|
||||||
|
@ -59,13 +59,8 @@ function FinishPage({ goToMain }: { goToMain: () => void }) {
|
|||||||
).map(([, error]: [string, FlashError]) => ({
|
).map(([, error]: [string, FlashError]) => ({
|
||||||
...error,
|
...error,
|
||||||
}));
|
}));
|
||||||
const {
|
const { averageSpeed, blockmappedSize, bytesWritten, failed, size } =
|
||||||
averageSpeed,
|
flashState.getFlashState();
|
||||||
blockmappedSize,
|
|
||||||
bytesWritten,
|
|
||||||
failed,
|
|
||||||
size,
|
|
||||||
} = flashState.getFlashState();
|
|
||||||
const {
|
const {
|
||||||
skip,
|
skip,
|
||||||
results = {
|
results = {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import GithubSvg from '@fortawesome/fontawesome-free/svgs/brands/github.svg';
|
import GithubSvg from '@fortawesome/fontawesome-free/svgs/brands/github.svg';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Flex, Checkbox, Txt } from 'rendition';
|
import { Box, Checkbox, Flex, TextWithCopy, Txt } from 'rendition';
|
||||||
|
|
||||||
import { version, packageType } from '../../../../../package.json';
|
import { version, packageType } from '../../../../../package.json';
|
||||||
import * as settings from '../../models/settings';
|
import * as settings from '../../models/settings';
|
||||||
@ -50,6 +50,14 @@ interface SettingsModalProps {
|
|||||||
toggleModal: (value: boolean) => void;
|
toggleModal: (value: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UUID = process.env.BALENA_DEVICE_UUID;
|
||||||
|
|
||||||
|
const InfoBox = (props: any) => (
|
||||||
|
<Box fontSize={14}>
|
||||||
|
<Txt>{props.label}</Txt>
|
||||||
|
<TextWithCopy code text={props.value} copy={props.value} />
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
export function SettingsModal({ toggleModal }: SettingsModalProps) {
|
export function SettingsModal({ toggleModal }: SettingsModalProps) {
|
||||||
const [settingsList, setCurrentSettingsList] = React.useState<Setting[]>([]);
|
const [settingsList, setCurrentSettingsList] = React.useState<Setting[]>([]);
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@ -103,6 +111,12 @@ export function SettingsModal({ toggleModal }: SettingsModalProps) {
|
|||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{UUID !== undefined && (
|
||||||
|
<Flex flexDirection="column">
|
||||||
|
<Txt fontSize={24}>System Information</Txt>
|
||||||
|
<InfoBox label="UUID" value={UUID.substr(0, 7)} />
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
<Flex
|
<Flex
|
||||||
mt={18}
|
mt={18}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
@ -65,6 +65,7 @@ import SrcSvg from '../../../assets/src.svg';
|
|||||||
import { DriveSelector } from '../drive-selector/drive-selector';
|
import { DriveSelector } from '../drive-selector/drive-selector';
|
||||||
import { DrivelistDrive } from '../../../../shared/drive-constraints';
|
import { DrivelistDrive } from '../../../../shared/drive-constraints';
|
||||||
import axios, { AxiosRequestConfig } from 'axios';
|
import axios, { AxiosRequestConfig } from 'axios';
|
||||||
|
import { isJson } from '../../../../shared/utils';
|
||||||
|
|
||||||
const recentUrlImagesKey = 'recentUrlImages';
|
const recentUrlImagesKey = 'recentUrlImages';
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ function normalizeRecentUrlImages(urls: any[]): URL[] {
|
|||||||
.map((url) => {
|
.map((url) => {
|
||||||
try {
|
try {
|
||||||
return new URL(url);
|
return new URL(url);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// Invalid URL, skip
|
// Invalid URL, skip
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -378,7 +379,9 @@ export class SourceSelector extends React.Component<
|
|||||||
this.setState({ imageLoading: true });
|
this.setState({ imageLoading: true });
|
||||||
await this.selectSource(
|
await this.selectSource(
|
||||||
imagePath,
|
imagePath,
|
||||||
isURL(imagePath) ? sourceDestination.Http : sourceDestination.File,
|
isURL(this.normalizeImagePath(imagePath))
|
||||||
|
? sourceDestination.Http
|
||||||
|
: sourceDestination.File,
|
||||||
).promise;
|
).promise;
|
||||||
this.setState({ imageLoading: false });
|
this.setState({ imageLoading: false });
|
||||||
}
|
}
|
||||||
@ -390,11 +393,11 @@ export class SourceSelector extends React.Component<
|
|||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
selected = await replaceWindowsNetworkDriveLetter(selected);
|
selected = await replaceWindowsNetworkDriveLetter(selected);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
analytics.logException(error);
|
analytics.logException(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isJson(decodeURIComponent(selected))) {
|
if (isJson(decodeURIComponent(selected))) {
|
||||||
const config: AxiosRequestConfig = JSON.parse(
|
const config: AxiosRequestConfig = JSON.parse(
|
||||||
decodeURIComponent(selected),
|
decodeURIComponent(selected),
|
||||||
);
|
);
|
||||||
@ -413,13 +416,12 @@ export class SourceSelector extends React.Component<
|
|||||||
return new sourceDestination.Http({ url: selected, auth });
|
return new sourceDestination.Http({ url: selected, auth });
|
||||||
}
|
}
|
||||||
|
|
||||||
public isJson(jsonString: string) {
|
public normalizeImagePath(imgPath: string) {
|
||||||
try {
|
const decodedPath = decodeURIComponent(imgPath);
|
||||||
JSON.parse(jsonString);
|
if (isJson(decodedPath)) {
|
||||||
} catch (e) {
|
return JSON.parse(decodedPath).url ?? decodedPath;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return decodedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private reselectSource() {
|
private reselectSource() {
|
||||||
@ -445,7 +447,10 @@ export class SourceSelector extends React.Component<
|
|||||||
let source;
|
let source;
|
||||||
let metadata: SourceMetadata | undefined;
|
let metadata: SourceMetadata | undefined;
|
||||||
if (isString(selected)) {
|
if (isString(selected)) {
|
||||||
if (SourceType === sourceDestination.Http && !isURL(selected)) {
|
if (
|
||||||
|
SourceType === sourceDestination.Http &&
|
||||||
|
!isURL(this.normalizeImagePath(selected))
|
||||||
|
) {
|
||||||
this.handleError(
|
this.handleError(
|
||||||
'Unsupported protocol',
|
'Unsupported protocol',
|
||||||
selected,
|
selected,
|
||||||
@ -489,7 +494,7 @@ export class SourceSelector extends React.Component<
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
this.handleError(
|
this.handleError(
|
||||||
'Error opening source',
|
'Error opening source',
|
||||||
sourcePath,
|
sourcePath,
|
||||||
@ -499,7 +504,7 @@ export class SourceSelector extends React.Component<
|
|||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
await source.close();
|
await source.close();
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// Noop
|
// Noop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -589,7 +594,7 @@ export class SourceSelector extends React.Component<
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.selectSource(imagePath, sourceDestination.File).promise;
|
await this.selectSource(imagePath, sourceDestination.File).promise;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
exceptionReporter.report(error);
|
exceptionReporter.report(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({ imageSelectorOpen: false });
|
this.setState({ imageSelectorOpen: false });
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { scanner } from 'etcher-sdk';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Flex, Txt } from 'rendition';
|
import { Flex, Txt } from 'rendition';
|
||||||
|
|
||||||
@ -37,6 +36,7 @@ import { TargetSelectorButton } from './target-selector-button';
|
|||||||
import TgtSvg from '../../../assets/tgt.svg';
|
import TgtSvg from '../../../assets/tgt.svg';
|
||||||
import DriveSvg from '../../../assets/drive.svg';
|
import DriveSvg from '../../../assets/drive.svg';
|
||||||
import { warning } from '../../../../shared/messages';
|
import { warning } from '../../../../shared/messages';
|
||||||
|
import { DrivelistDrive } from '../../../../shared/drive-constraints';
|
||||||
|
|
||||||
export const getDriveListLabel = () => {
|
export const getDriveListLabel = () => {
|
||||||
return getSelectedDrives()
|
return getSelectedDrives()
|
||||||
@ -70,9 +70,7 @@ export const TargetSelectorModal = (
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectAllTargets = (
|
export const selectAllTargets = (modalTargets: DrivelistDrive[]) => {
|
||||||
modalTargets: scanner.adapters.DrivelistDrive[],
|
|
||||||
) => {
|
|
||||||
const selectedDrivesFromState = getSelectedDrives();
|
const selectedDrivesFromState = getSelectedDrives();
|
||||||
const deselected = selectedDrivesFromState.filter(
|
const deselected = selectedDrivesFromState.filter(
|
||||||
(drive) =>
|
(drive) =>
|
||||||
@ -114,9 +112,8 @@ export const TargetSelector = ({
|
|||||||
const [{ driveListLabel, targets }, setStateSlice] = React.useState(
|
const [{ driveListLabel, targets }, setStateSlice] = React.useState(
|
||||||
getDriveSelectionStateSlice(),
|
getDriveSelectionStateSlice(),
|
||||||
);
|
);
|
||||||
const [showTargetSelectorModal, setShowTargetSelectorModal] = React.useState(
|
const [showTargetSelectorModal, setShowTargetSelectorModal] =
|
||||||
false,
|
React.useState(false);
|
||||||
);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
return observe(() => {
|
return observe(() => {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import * as electron from 'electron';
|
import * as electron from 'electron';
|
||||||
import * as sdk from 'etcher-sdk';
|
import * as sdk from 'etcher-sdk';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
import { DrivelistDrive } from '../../../shared/drive-constraints';
|
||||||
|
|
||||||
import { bytesToMegabytes } from '../../../shared/units';
|
import { bytesToMegabytes } from '../../../shared/units';
|
||||||
import { Actions, store } from './store';
|
import { Actions, store } from './store';
|
||||||
@ -84,7 +85,7 @@ export function addFailedDeviceError({
|
|||||||
device,
|
device,
|
||||||
error,
|
error,
|
||||||
}: {
|
}: {
|
||||||
device: sdk.scanner.adapters.DrivelistDrive;
|
device: DrivelistDrive;
|
||||||
error: Error;
|
error: Error;
|
||||||
}) {
|
}) {
|
||||||
const failedDeviceErrorsMap = new Map(
|
const failedDeviceErrorsMap = new Map(
|
||||||
|
@ -245,16 +245,16 @@ export async function init(): Promise<void> {
|
|||||||
for (const [drivePath, ledsNames] of Object.entries(ledsMapping)) {
|
for (const [drivePath, ledsNames] of Object.entries(ledsMapping)) {
|
||||||
leds.set('/dev/disk/by-path/' + drivePath, new RGBLed(ledsNames));
|
leds.set('/dev/disk/by-path/' + drivePath, new RGBLed(ledsNames));
|
||||||
}
|
}
|
||||||
|
ledColors = (await settings.get('ledColors')) || {};
|
||||||
|
ledAnimationFunctions = {
|
||||||
|
blinkGreen: createAnimationFunction(blink, ledColors['green']),
|
||||||
|
blinkPurple: createAnimationFunction(blink, ledColors['purple']),
|
||||||
|
staticRed: createAnimationFunction(one, ledColors['red']),
|
||||||
|
staticGreen: createAnimationFunction(one, ledColors['green']),
|
||||||
|
staticBlue: createAnimationFunction(one, ledColors['blue']),
|
||||||
|
staticWhite: createAnimationFunction(one, ledColors['white']),
|
||||||
|
staticBlack: createAnimationFunction(one, ledColors['black']),
|
||||||
|
};
|
||||||
|
observe(_.debounce(stateObserver, 1000, { maxWait: 1000 }));
|
||||||
}
|
}
|
||||||
ledColors = (await settings.get('ledColors')) || {};
|
|
||||||
ledAnimationFunctions = {
|
|
||||||
blinkGreen: createAnimationFunction(blink, ledColors['green']),
|
|
||||||
blinkPurple: createAnimationFunction(blink, ledColors['purple']),
|
|
||||||
staticRed: createAnimationFunction(one, ledColors['red']),
|
|
||||||
staticGreen: createAnimationFunction(one, ledColors['green']),
|
|
||||||
staticBlue: createAnimationFunction(one, ledColors['blue']),
|
|
||||||
staticWhite: createAnimationFunction(one, ledColors['white']),
|
|
||||||
staticBlack: createAnimationFunction(one, ledColors['black']),
|
|
||||||
};
|
|
||||||
observe(_.debounce(stateObserver, 1000, { maxWait: 1000 }));
|
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ async function readConfigFile(filename: string): Promise<_.Dictionary<any>> {
|
|||||||
let contents = '{}';
|
let contents = '{}';
|
||||||
try {
|
try {
|
||||||
contents = await fs.readFile(filename, { encoding: 'utf8' });
|
contents = await fs.readFile(filename, { encoding: 'utf8' });
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -104,7 +104,7 @@ export async function set(
|
|||||||
settings[key] = value;
|
settings[key] = value;
|
||||||
try {
|
try {
|
||||||
await writeConfigFileFn(CONFIG_PATH, settings);
|
await writeConfigFileFn(CONFIG_PATH, settings);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// Revert to previous value if persisting settings failed
|
// Revert to previous value if persisting settings failed
|
||||||
settings[key] = previousValue;
|
settings[key] = previousValue;
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -102,10 +102,9 @@ function validateMixpanelConfig(config: {
|
|||||||
* This function sends the debug message to product analytics services.
|
* This function sends the debug message to product analytics services.
|
||||||
*/
|
*/
|
||||||
export function logEvent(message: string, data: _.Dictionary<any> = {}) {
|
export function logEvent(message: string, data: _.Dictionary<any> = {}) {
|
||||||
const {
|
const { applicationSessionUuid, flashingWorkflowUuid } = store
|
||||||
applicationSessionUuid,
|
.getState()
|
||||||
flashingWorkflowUuid,
|
.toJS();
|
||||||
} = store.getState().toJS();
|
|
||||||
resinCorvus.logEvent(message, {
|
resinCorvus.logEvent(message, {
|
||||||
...data,
|
...data,
|
||||||
sample: mixpanelSample,
|
sample: mixpanelSample,
|
||||||
|
@ -15,10 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as sdk from 'etcher-sdk';
|
import * as sdk from 'etcher-sdk';
|
||||||
|
import {
|
||||||
|
Adapter,
|
||||||
|
BlockDeviceAdapter,
|
||||||
|
UsbbootDeviceAdapter,
|
||||||
|
} from 'etcher-sdk/build/scanner/adapters';
|
||||||
import { geteuid, platform } from 'process';
|
import { geteuid, platform } from 'process';
|
||||||
|
|
||||||
const adapters: sdk.scanner.adapters.Adapter[] = [
|
const adapters: Adapter[] = [
|
||||||
new sdk.scanner.adapters.BlockDeviceAdapter({
|
new BlockDeviceAdapter({
|
||||||
includeSystemDrives: () => true,
|
includeSystemDrives: () => true,
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
@ -26,14 +31,15 @@ const adapters: sdk.scanner.adapters.Adapter[] = [
|
|||||||
// Can't use permissions.isElevated() here as it returns a promise and we need to set
|
// Can't use permissions.isElevated() here as it returns a promise and we need to set
|
||||||
// module.exports = scanner right now.
|
// module.exports = scanner right now.
|
||||||
if (platform !== 'linux' || geteuid() === 0) {
|
if (platform !== 'linux' || geteuid() === 0) {
|
||||||
adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter());
|
adapters.push(new UsbbootDeviceAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (platform === 'win32') {
|
||||||
platform === 'win32' &&
|
const {
|
||||||
sdk.scanner.adapters.DriverlessDeviceAdapter !== undefined
|
DriverlessDeviceAdapter: driverless,
|
||||||
) {
|
// tslint:disable-next-line:no-var-requires
|
||||||
adapters.push(new sdk.scanner.adapters.DriverlessDeviceAdapter());
|
} = require('etcher-sdk/build/scanner/adapters/driverless');
|
||||||
|
adapters.push(new driverless());
|
||||||
}
|
}
|
||||||
|
|
||||||
export const scanner = new sdk.scanner.Scanner(adapters);
|
export const scanner = new sdk.scanner.Scanner(adapters);
|
||||||
|
@ -218,7 +218,7 @@ async function performWrite(
|
|||||||
});
|
});
|
||||||
flashResults.cancelled = cancelled || results.cancelled;
|
flashResults.cancelled = cancelled || results.cancelled;
|
||||||
flashResults.skip = skip;
|
flashResults.skip = skip;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// This happens when the child is killed using SIGKILL
|
// This happens when the child is killed using SIGKILL
|
||||||
const SIGKILL_EXIT_CODE = 137;
|
const SIGKILL_EXIT_CODE = 137;
|
||||||
if (error.code === SIGKILL_EXIT_CODE) {
|
if (error.code === SIGKILL_EXIT_CODE) {
|
||||||
@ -287,7 +287,7 @@ export async function flash(
|
|||||||
try {
|
try {
|
||||||
const result = await write(image, drives, flashState.setProgressState);
|
const result = await write(image, drives, flashState.setProgressState);
|
||||||
await flashState.unsetFlashingFlag(result);
|
await flashState.unsetFlashingFlag(result);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
await flashState.unsetFlashingFlag({
|
await flashState.unsetFlashingFlag({
|
||||||
cancelled: false,
|
cancelled: false,
|
||||||
errorCode: error.code,
|
errorCode: error.code,
|
||||||
@ -349,7 +349,7 @@ export async function cancel(type: string) {
|
|||||||
if (socket !== undefined) {
|
if (socket !== undefined) {
|
||||||
ipc.server.emit(socket, status);
|
ipc.server.emit(socket, status);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
analytics.logException(error);
|
analytics.logException(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ async function mountSourceDrive() {
|
|||||||
if (sourceDrivePath) {
|
if (sourceDrivePath) {
|
||||||
try {
|
try {
|
||||||
await electron.ipcRenderer.invoke('mount-drive', sourceDrivePath);
|
await electron.ipcRenderer.invoke('mount-drive', sourceDrivePath);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ async function flashImageToDrive(
|
|||||||
}
|
}
|
||||||
goToSuccess();
|
goToSuccess();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
notifyFailure(iconPath, basename, drives);
|
notifyFailure(iconPath, basename, drives);
|
||||||
let errorMessage = getErrorMessageFromCode(error.code);
|
let errorMessage = getErrorMessageFromCode(error.code);
|
||||||
if (!errorMessage) {
|
if (!errorMessage) {
|
||||||
|
@ -35,8 +35,10 @@ import { totalmem } from 'os';
|
|||||||
|
|
||||||
import { toJSON } from '../../shared/errors';
|
import { toJSON } from '../../shared/errors';
|
||||||
import { GENERAL_ERROR, SUCCESS } from '../../shared/exit-codes';
|
import { GENERAL_ERROR, SUCCESS } from '../../shared/exit-codes';
|
||||||
import { delay } from '../../shared/utils';
|
import { delay, isJson } from '../../shared/utils';
|
||||||
import { SourceMetadata } from '../app/components/source-selector/source-selector';
|
import { SourceMetadata } from '../app/components/source-selector/source-selector';
|
||||||
|
import axios from 'axios';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
ipc.config.id = process.env.IPC_CLIENT_ID as string;
|
ipc.config.id = process.env.IPC_CLIENT_ID as string;
|
||||||
ipc.config.socketRoot = process.env.IPC_SOCKET_ROOT as string;
|
ipc.config.socketRoot = process.env.IPC_SOCKET_ROOT as string;
|
||||||
@ -171,6 +173,7 @@ interface WriteOptions {
|
|||||||
autoBlockmapping: boolean;
|
autoBlockmapping: boolean;
|
||||||
decompressFirst: boolean;
|
decompressFirst: boolean;
|
||||||
SourceType: string;
|
SourceType: string;
|
||||||
|
httpRequest?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.connectTo(IPC_SERVER_ID, () => {
|
ipc.connectTo(IPC_SERVER_ID, () => {
|
||||||
@ -281,7 +284,17 @@ ipc.connectTo(IPC_SERVER_ID, () => {
|
|||||||
path: imagePath,
|
path: imagePath,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
source = new Http({ url: imagePath, avoidRandomAccess: true });
|
const decodedImagePath = decodeURIComponent(imagePath);
|
||||||
|
if (isJson(decodedImagePath)) {
|
||||||
|
const imagePathObject = JSON.parse(decodedImagePath);
|
||||||
|
source = new Http({
|
||||||
|
url: imagePathObject.url,
|
||||||
|
avoidRandomAccess: true,
|
||||||
|
axiosInstance: axios.create(_.omit(imagePathObject, ['url'])),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
source = new Http({ url: imagePath, avoidRandomAccess: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const results = await writeAndValidate({
|
const results = await writeAndValidate({
|
||||||
@ -300,7 +313,7 @@ ipc.connectTo(IPC_SERVER_ID, () => {
|
|||||||
ipc.of[IPC_SERVER_ID].emit('done', { results });
|
ipc.of[IPC_SERVER_ID].emit('done', { results });
|
||||||
await delay(DISCONNECT_DELAY);
|
await delay(DISCONNECT_DELAY);
|
||||||
await terminate(exitCode);
|
await terminate(exitCode);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
exitCode = GENERAL_ERROR;
|
exitCode = GENERAL_ERROR;
|
||||||
ipc.of[IPC_SERVER_ID].emit('error', toJSON(error));
|
ipc.of[IPC_SERVER_ID].emit('error', toJSON(error));
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export async function sudo(
|
|||||||
stdout: stdout.slice(EXPECTED_SUCCESSFUL_AUTH_MARKER.length),
|
stdout: stdout.slice(EXPECTED_SUCCESSFUL_AUTH_MARKER.length),
|
||||||
stderr,
|
stderr,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
if (error.code === 1) {
|
if (error.code === 1) {
|
||||||
if (!error.stdout.startsWith(EXPECTED_SUCCESSFUL_AUTH_MARKER)) {
|
if (!error.stdout.startsWith(EXPECTED_SUCCESSFUL_AUTH_MARKER)) {
|
||||||
return { cancelled: true };
|
return { cancelled: true };
|
||||||
|
@ -60,7 +60,7 @@ export async function isElevated(): Promise<boolean> {
|
|||||||
// See http://stackoverflow.com/a/28268802
|
// See http://stackoverflow.com/a/28268802
|
||||||
try {
|
try {
|
||||||
await execAsync('fltmc');
|
await execAsync('fltmc');
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
if (error.code === os.constants.errno.EPERM) {
|
if (error.code === os.constants.errno.EPERM) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ async function elevateScriptCatalina(
|
|||||||
try {
|
try {
|
||||||
const { cancelled } = await catalinaSudo(cmd);
|
const { cancelled } = await catalinaSudo(cmd);
|
||||||
return { cancelled };
|
return { cancelled };
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
throw errors.createError({ title: error.stderr });
|
throw errors.createError({ title: error.stderr });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ export async function elevateCommand(
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return await elevateScriptUnix(path, options.applicationName);
|
return await elevateScriptUnix(path, options.applicationName);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// We're hardcoding internal error messages declared by `sudo-prompt`.
|
// We're hardcoding internal error messages declared by `sudo-prompt`.
|
||||||
// There doesn't seem to be a better way to handle these errors, so
|
// There doesn't seem to be a better way to handle these errors, so
|
||||||
// for now, we should make sure we double check if the error messages
|
// for now, we should make sure we double check if the error messages
|
||||||
|
@ -61,3 +61,12 @@ export function getAppPath(): string {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isJson(jsonString: string) {
|
||||||
|
try {
|
||||||
|
JSON.parse(jsonString);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
8822
npm-shrinkwrap.json → package-lock.json
generated
8822
npm-shrinkwrap.json → package-lock.json
generated
File diff suppressed because it is too large
Load Diff
144
package.json
144
package.json
@ -22,7 +22,7 @@
|
|||||||
"test": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks",
|
"test": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks",
|
||||||
"sanity-checks": "bash scripts/ci/ensure-all-file-extensions-in-gitattributes.sh",
|
"sanity-checks": "bash scripts/ci/ensure-all-file-extensions-in-gitattributes.sh",
|
||||||
"start": "./node_modules/.bin/electron .",
|
"start": "./node_modules/.bin/electron .",
|
||||||
"postshrinkwrap": "ts-node ./scripts/clean-shrinkwrap.ts",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"webpack": "webpack",
|
"webpack": "webpack",
|
||||||
"watch": "webpack serve --no-optimization-minimize --config ./webpack.dev.config.ts",
|
"watch": "webpack serve --no-optimization-minimize --config ./webpack.dev.config.ts",
|
||||||
"concourse-build-electron": "npm run webpack",
|
"concourse-build-electron": "npm run webpack",
|
||||||
@ -44,85 +44,75 @@
|
|||||||
},
|
},
|
||||||
"author": "Balena Inc. <hello@etcher.io>",
|
"author": "Balena Inc. <hello@etcher.io>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"platformSpecificDependencies": [
|
"dependencies": {
|
||||||
"xmlbuilder",
|
"@fortawesome/fontawesome-free": "5.13.1",
|
||||||
"xmldom",
|
|
||||||
"@types/plist",
|
|
||||||
"@types/verror",
|
|
||||||
"crc",
|
|
||||||
"iconv-corefoundation",
|
|
||||||
"plist",
|
|
||||||
"dmg-license",
|
|
||||||
"fsevents",
|
|
||||||
"winusb-driver-generator"
|
|
||||||
],
|
|
||||||
"devDependencies": {
|
|
||||||
"@balena/lint": "^5.3.0",
|
|
||||||
"@fortawesome/fontawesome-free": "^5.13.1",
|
|
||||||
"@svgr/webpack": "^5.5.0",
|
|
||||||
"@types/chai": "^4.2.7",
|
|
||||||
"@types/copy-webpack-plugin": "^6.0.0",
|
|
||||||
"@types/mime-types": "^2.1.0",
|
|
||||||
"@types/mini-css-extract-plugin": "^1.2.2",
|
|
||||||
"@types/mocha": "^8.0.3",
|
|
||||||
"@types/node": "^14.14.41",
|
|
||||||
"@types/node-ipc": "^9.1.2",
|
|
||||||
"@types/react-dom": "^16.8.4",
|
|
||||||
"@types/semver": "^7.1.0",
|
|
||||||
"@types/sinon": "^9.0.0",
|
|
||||||
"@types/terser-webpack-plugin": "^5.0.2",
|
|
||||||
"@types/tmp": "^0.2.0",
|
|
||||||
"@types/webpack-node-externals": "^2.5.0",
|
|
||||||
"aws4-axios": "2.2.1",
|
"aws4-axios": "2.2.1",
|
||||||
"chai": "^4.2.0",
|
"d3": "4.13.0",
|
||||||
"copy-webpack-plugin": "^7.0.0",
|
"debug": "4.2.0",
|
||||||
"css-loader": "^5.0.1",
|
"etcher-sdk": "6.3.0",
|
||||||
"d3": "^4.13.0",
|
"immutable": "3.8.1",
|
||||||
"debug": "^4.2.0",
|
"lodash": "4.17.10",
|
||||||
"electron": "12.0.2",
|
"node-ipc": "9.1.1",
|
||||||
"electron-builder": "^22.10.5",
|
|
||||||
"electron-mocha": "^9.3.2",
|
|
||||||
"electron-notarize": "^1.0.0",
|
|
||||||
"electron-rebuild": "^2.3.2",
|
|
||||||
"electron-updater": "^4.3.5",
|
|
||||||
"etcher-sdk": "^6.2.5",
|
|
||||||
"file-loader": "^6.2.0",
|
|
||||||
"husky": "^4.2.5",
|
|
||||||
"immutable": "^3.8.1",
|
|
||||||
"lint-staged": "^10.2.2",
|
|
||||||
"lodash": "^4.17.10",
|
|
||||||
"mini-css-extract-plugin": "^1.3.3",
|
|
||||||
"mocha": "^8.0.1",
|
|
||||||
"native-addon-loader": "^2.0.1",
|
|
||||||
"node-ipc": "^9.1.1",
|
|
||||||
"omit-deep-lodash": "1.1.4",
|
"omit-deep-lodash": "1.1.4",
|
||||||
"outdent": "^0.7.1",
|
"outdent": "0.7.1",
|
||||||
"path-is-inside": "^1.0.2",
|
"path-is-inside": "1.0.2",
|
||||||
"pnp-webpack-plugin": "^1.6.4",
|
"pretty-bytes": "5.3.0",
|
||||||
"pretty-bytes": "^5.3.0",
|
"react": "16.8.5",
|
||||||
"react": "^16.8.5",
|
"react-dom": "16.8.5",
|
||||||
"react-dom": "^16.8.5",
|
"redux": "4.0.5",
|
||||||
"redux": "^4.0.5",
|
"rendition": "19.2.0",
|
||||||
"rendition": "^19.2.0",
|
"resin-corvus": "2.0.5",
|
||||||
"resin-corvus": "^2.0.5",
|
"semver": "7.3.2",
|
||||||
"semver": "^7.3.2",
|
"styled-components": "5.1.0",
|
||||||
"simple-progress-webpack-plugin": "^1.1.2",
|
|
||||||
"sinon": "^9.0.2",
|
|
||||||
"spectron": "^14.0.0",
|
|
||||||
"string-replace-loader": "^3.0.1",
|
|
||||||
"style-loader": "^2.0.0",
|
|
||||||
"styled-components": "^5.1.0",
|
|
||||||
"sudo-prompt": "github:zvin/sudo-prompt#7cdede2f0da28fbcc2db48402d7d935f3a825c91",
|
"sudo-prompt": "github:zvin/sudo-prompt#7cdede2f0da28fbcc2db48402d7d935f3a825c91",
|
||||||
"sys-class-rgb-led": "^3.0.0",
|
"sys-class-rgb-led": "3.0.0",
|
||||||
"ts-loader": "^8.0.12",
|
"url-loader": "4.1.1",
|
||||||
"ts-node": "^9.1.1",
|
"uuid": "8.1.0"
|
||||||
"tslib": "^2.0.0",
|
},
|
||||||
"typescript": "^4.2.2",
|
"devDependencies": {
|
||||||
"url-loader": "^4.1.1",
|
"@balena/lint": "5.3.0",
|
||||||
"uuid": "^8.1.0",
|
"@svgr/webpack": "5.5.0",
|
||||||
"webpack": "^5.11.0",
|
"@types/chai": "4.2.7",
|
||||||
"webpack-cli": "^4.2.0",
|
"@types/copy-webpack-plugin": "6.0.0",
|
||||||
"webpack-dev-server": "^3.11.2"
|
"@types/mime-types": "2.1.0",
|
||||||
|
"@types/mini-css-extract-plugin": "1.2.2",
|
||||||
|
"@types/mocha": "8.0.3",
|
||||||
|
"@types/node": "14.14.41",
|
||||||
|
"@types/node-ipc": "9.1.2",
|
||||||
|
"@types/react": "^16.8.5",
|
||||||
|
"@types/react-dom": "16.8.4",
|
||||||
|
"@types/semver": "7.1.0",
|
||||||
|
"@types/sinon": "9.0.0",
|
||||||
|
"@types/terser-webpack-plugin": "5.0.2",
|
||||||
|
"@types/tmp": "0.2.0",
|
||||||
|
"@types/webpack-node-externals": "2.5.0",
|
||||||
|
"chai": "4.2.0",
|
||||||
|
"copy-webpack-plugin": "7.0.0",
|
||||||
|
"css-loader": "5.0.1",
|
||||||
|
"electron": "12.0.2",
|
||||||
|
"electron-builder": "22.10.5",
|
||||||
|
"electron-mocha": "9.3.2",
|
||||||
|
"electron-notarize": "1.0.0",
|
||||||
|
"electron-updater": "4.3.5",
|
||||||
|
"file-loader": "6.2.0",
|
||||||
|
"husky": "4.2.5",
|
||||||
|
"lint-staged": "10.2.2",
|
||||||
|
"mini-css-extract-plugin": "1.3.3",
|
||||||
|
"mocha": "8.0.1",
|
||||||
|
"native-addon-loader": "2.0.1",
|
||||||
|
"pnp-webpack-plugin": "1.6.4",
|
||||||
|
"simple-progress-webpack-plugin": "1.1.2",
|
||||||
|
"sinon": "9.0.2",
|
||||||
|
"spectron": "14.0.0",
|
||||||
|
"string-replace-loader": "3.0.1",
|
||||||
|
"style-loader": "2.0.0",
|
||||||
|
"ts-loader": "8.0.12",
|
||||||
|
"ts-node": "9.1.1",
|
||||||
|
"tslib": "2.0.0",
|
||||||
|
"typescript": "4.2.2",
|
||||||
|
"webpack": "5.11.0",
|
||||||
|
"webpack-cli": "4.2.0",
|
||||||
|
"webpack-dev-server": "3.11.2"
|
||||||
},
|
},
|
||||||
"versionist": {
|
"versionist": {
|
||||||
"publishedAt": "2021-09-20T10:42:04.882Z"
|
"publishedAt": "2021-09-20T10:42:04.882Z"
|
||||||
|
@ -37,7 +37,7 @@ async function main() {
|
|||||||
SHRINKWRAP_FILENAME,
|
SHRINKWRAP_FILENAME,
|
||||||
JSON.stringify(cleaned, null, JSON_INDENT),
|
JSON.stringify(cleaned, null, JSON_INDENT),
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.log(`[ERROR] Couldn't write shrinkwrap file: ${error.stack}`);
|
console.log(`[ERROR] Couldn't write shrinkwrap file: ${error.stack}`);
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,8 @@ describe('Model: flashState', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('.getFlashUuid()', function () {
|
describe('.getFlashUuid()', function () {
|
||||||
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
const UUID_REGEX =
|
||||||
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||||
|
|
||||||
it('should be initially undefined', function () {
|
it('should be initially undefined', function () {
|
||||||
expect(flashState.getFlashUuid()).to.be.undefined;
|
expect(flashState.getFlashUuid()).to.be.undefined;
|
||||||
|
@ -23,7 +23,7 @@ import * as settings from '../../../lib/gui/app/models/settings';
|
|||||||
async function checkError(promise: Promise<any>, fn: (err: Error) => any) {
|
async function checkError(promise: Promise<any>, fn: (err: Error) => any) {
|
||||||
try {
|
try {
|
||||||
await promise;
|
await promise;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
await fn(error);
|
await fn(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ describe('Browser: imageWriter', () => {
|
|||||||
imageWriter.flash(image, [fakeDrive], performWriteStub),
|
imageWriter.flash(image, [fakeDrive], performWriteStub),
|
||||||
]);
|
]);
|
||||||
assert.fail('Writing twice should fail');
|
assert.fail('Writing twice should fail');
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
expect(error.message).to.equal(
|
expect(error.message).to.equal(
|
||||||
'There is already a flash in progress',
|
'There is already a flash in progress',
|
||||||
);
|
);
|
||||||
@ -133,7 +133,7 @@ describe('Browser: imageWriter', () => {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await imageWriter.flash(image, [fakeDrive], performWriteStub);
|
await imageWriter.flash(image, [fakeDrive], performWriteStub);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
expect(error).to.be.an.instanceof(Error);
|
expect(error).to.be.an.instanceof(Error);
|
||||||
expect(error.message).to.equal('write error');
|
expect(error.message).to.equal('write error');
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1158,7 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
'/dev/disk6',
|
'/dev/disk6',
|
||||||
];
|
];
|
||||||
const drives = [
|
const drives = [
|
||||||
({
|
{
|
||||||
device: drivePaths[0],
|
device: drivePaths[0],
|
||||||
description: 'My Drive',
|
description: 'My Drive',
|
||||||
size: 123456789,
|
size: 123456789,
|
||||||
@ -1166,8 +1166,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [{ path: __dirname }],
|
mountpoints: [{ path: __dirname }],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
({
|
{
|
||||||
device: drivePaths[1],
|
device: drivePaths[1],
|
||||||
description: 'My Other Drive',
|
description: 'My Other Drive',
|
||||||
size: 123456789,
|
size: 123456789,
|
||||||
@ -1175,8 +1175,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isReadOnly: true,
|
isReadOnly: true,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
({
|
{
|
||||||
device: drivePaths[2],
|
device: drivePaths[2],
|
||||||
description: 'My Drive',
|
description: 'My Drive',
|
||||||
size: 1234567,
|
size: 1234567,
|
||||||
@ -1184,8 +1184,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
({
|
{
|
||||||
device: drivePaths[3],
|
device: drivePaths[3],
|
||||||
description: 'My Drive',
|
description: 'My Drive',
|
||||||
size: 123456789,
|
size: 123456789,
|
||||||
@ -1193,8 +1193,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: true,
|
isSystem: true,
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
({
|
{
|
||||||
device: drivePaths[4],
|
device: drivePaths[4],
|
||||||
description: 'My Drive',
|
description: 'My Drive',
|
||||||
size: 128000000001,
|
size: 128000000001,
|
||||||
@ -1202,8 +1202,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
({
|
{
|
||||||
device: drivePaths[5],
|
device: drivePaths[5],
|
||||||
description: 'My Drive',
|
description: 'My Drive',
|
||||||
size: 12345678,
|
size: 12345678,
|
||||||
@ -1211,8 +1211,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
({
|
{
|
||||||
device: drivePaths[6],
|
device: drivePaths[6],
|
||||||
description: 'My Drive',
|
description: 'My Drive',
|
||||||
size: 123456789,
|
size: 123456789,
|
||||||
@ -1220,7 +1220,7 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
} as unknown) as constraints.DrivelistDrive,
|
} as unknown as constraints.DrivelistDrive,
|
||||||
];
|
];
|
||||||
|
|
||||||
const image: SourceMetadata = {
|
const image: SourceMetadata = {
|
||||||
|
@ -30,9 +30,8 @@ describe('Shared: SupportedFormats', function () {
|
|||||||
],
|
],
|
||||||
(imagePath) => {
|
(imagePath) => {
|
||||||
it(`should return true if filename is ${imagePath}`, function () {
|
it(`should return true if filename is ${imagePath}`, function () {
|
||||||
const looksLikeWindowsImage = supportedFormats.looksLikeWindowsImage(
|
const looksLikeWindowsImage =
|
||||||
imagePath,
|
supportedFormats.looksLikeWindowsImage(imagePath);
|
||||||
);
|
|
||||||
expect(looksLikeWindowsImage).to.be.true;
|
expect(looksLikeWindowsImage).to.be.true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -45,9 +44,8 @@ describe('Shared: SupportedFormats', function () {
|
|||||||
],
|
],
|
||||||
(imagePath) => {
|
(imagePath) => {
|
||||||
it(`should return false if filename is ${imagePath}`, function () {
|
it(`should return false if filename is ${imagePath}`, function () {
|
||||||
const looksLikeWindowsImage = supportedFormats.looksLikeWindowsImage(
|
const looksLikeWindowsImage =
|
||||||
imagePath,
|
supportedFormats.looksLikeWindowsImage(imagePath);
|
||||||
);
|
|
||||||
expect(looksLikeWindowsImage).to.be.false;
|
expect(looksLikeWindowsImage).to.be.false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ if (platform() !== 'darwin') {
|
|||||||
this.timeout(40000);
|
this.timeout(40000);
|
||||||
|
|
||||||
const app = new Application({
|
const app = new Application({
|
||||||
path: (electronPath as unknown) as string,
|
path: electronPath as unknown as string,
|
||||||
args: ['--no-sandbox', '.'],
|
args: ['--no-sandbox', '.'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user