mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-30 14:46:33 +00:00
patch: upgrade balena-lint
- upgrade balena-lint to 7.2.4 - downgrade pretty-bytes to 5.6.0 - upgrade electron-mocha to 10.2.0
This commit is contained in:
parent
9260bc4a92
commit
ba68bb1ea2
10
.eslintrc.js
Normal file
10
.eslintrc.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ["./node_modules/@balena/lint/config/.eslintrc.js"],
|
||||||
|
root: true,
|
||||||
|
ignorePatterns: ["node_modules/", "dist/", "examples/", "tests/"],
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
},
|
||||||
|
};
|
@ -36,9 +36,9 @@ function addWebpackDefine(
|
|||||||
|
|
||||||
const value = isStartScrpt()
|
const value = isStartScrpt()
|
||||||
? // on `npm start`, point directly to the binary
|
? // on `npm start`, point directly to the binary
|
||||||
path.resolve(binDir, binName)
|
path.resolve(binDir, binName)
|
||||||
: // otherwise point relative to the resources folder of the bundled app
|
: // otherwise point relative to the resources folder of the bundled app
|
||||||
binName;
|
binName;
|
||||||
|
|
||||||
debug(`define '${defineName}'='${value}'`);
|
debug(`define '${defineName}'='${value}'`);
|
||||||
|
|
||||||
@ -69,10 +69,10 @@ function build(
|
|||||||
buildForArchs.split(',').forEach((arch) => {
|
buildForArchs.split(',').forEach((arch) => {
|
||||||
const binPath = isStartScrpt()
|
const binPath = isStartScrpt()
|
||||||
? // on `npm start`, we don't know the arch we're building for at the time we're
|
? // on `npm start`, we don't know the arch we're building for at the time we're
|
||||||
// adding the webpack define, so we just build under binDir
|
// adding the webpack define, so we just build under binDir
|
||||||
path.resolve(binDir, binName)
|
path.resolve(binDir, binName)
|
||||||
: // otherwise build in arch-specific directory within binDir
|
: // otherwise build in arch-specific directory within binDir
|
||||||
path.resolve(binDir, arch, binName);
|
path.resolve(binDir, arch, binName);
|
||||||
|
|
||||||
// FIXME: rebuilding mountutils shouldn't be necessary, but it is. It's comming from etcher-sdk a fix has been upstreamed but to use the latest etcher-sdk we need to upgrade axios at the same time)
|
// FIXME: rebuilding mountutils shouldn't be necessary, but it is. It's comming from etcher-sdk a fix has been upstreamed but to use the latest etcher-sdk we need to upgrade axios at the same time)
|
||||||
commands.push([
|
commands.push([
|
||||||
@ -121,10 +121,10 @@ function copyArtifact(
|
|||||||
) {
|
) {
|
||||||
const binPath = isStartScrpt()
|
const binPath = isStartScrpt()
|
||||||
? // on `npm start`, we don't know the arch we're building for at the time we're
|
? // on `npm start`, we don't know the arch we're building for at the time we're
|
||||||
// adding the webpack define, so look for the binary directly under binDir
|
// adding the webpack define, so look for the binary directly under binDir
|
||||||
path.resolve(binDir, binName)
|
path.resolve(binDir, binName)
|
||||||
: // otherwise look into arch-specific directory within binDir
|
: // otherwise look into arch-specific directory within binDir
|
||||||
path.resolve(binDir, arch, binName);
|
path.resolve(binDir, arch, binName);
|
||||||
|
|
||||||
// buildPath points to appPath, which is inside resources dir which is the one we actually want
|
// buildPath points to appPath, which is inside resources dir which is the one we actually want
|
||||||
const resourcesPath = path.dirname(buildPath);
|
const resourcesPath = path.dirname(buildPath);
|
||||||
|
@ -38,7 +38,6 @@ import * as windowProgress from './os/window-progress';
|
|||||||
import MainPage from './pages/main/MainPage';
|
import MainPage from './pages/main/MainPage';
|
||||||
import './css/main.css';
|
import './css/main.css';
|
||||||
import * as i18next from 'i18next';
|
import * as i18next from 'i18next';
|
||||||
import { promises } from 'dns';
|
|
||||||
import { SourceMetadata } from '../../shared/typings/source-selector';
|
import { SourceMetadata } from '../../shared/typings/source-selector';
|
||||||
|
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
|
@ -29,7 +29,7 @@ import {
|
|||||||
isDriveSizeLarge,
|
isDriveSizeLarge,
|
||||||
} from '../../../../shared/drive-constraints';
|
} from '../../../../shared/drive-constraints';
|
||||||
import { compatibility, warning } from '../../../../shared/messages';
|
import { compatibility, warning } from '../../../../shared/messages';
|
||||||
import prettyBytes from 'pretty-bytes';
|
import * as prettyBytes from 'pretty-bytes';
|
||||||
import { getDrives, hasAvailableDrives } from '../../models/available-drives';
|
import { getDrives, hasAvailableDrives } from '../../models/available-drives';
|
||||||
import { getImage, isDriveSelected } from '../../models/selection-state';
|
import { getImage, isDriveSelected } from '../../models/selection-state';
|
||||||
import { store } from '../../models/store';
|
import { store } from '../../models/store';
|
||||||
@ -302,6 +302,7 @@ export class DriveSelector extends React.Component<
|
|||||||
status: string,
|
status: string,
|
||||||
drive: { device: string; size: number },
|
drive: { device: string; size: number },
|
||||||
) {
|
) {
|
||||||
|
let size;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case compatibility.containsImage():
|
case compatibility.containsImage():
|
||||||
return warning.sourceDrive();
|
return warning.sourceDrive();
|
||||||
@ -310,9 +311,11 @@ export class DriveSelector extends React.Component<
|
|||||||
case compatibility.system():
|
case compatibility.system():
|
||||||
return warning.systemDrive();
|
return warning.systemDrive();
|
||||||
case compatibility.tooSmall():
|
case compatibility.tooSmall():
|
||||||
const size =
|
size =
|
||||||
this.state.image?.recommendedDriveSize || this.state.image?.size || 0;
|
this.state.image?.recommendedDriveSize || this.state.image?.size || 0;
|
||||||
return warning.tooSmall({ size }, drive);
|
return warning.tooSmall({ size }, drive);
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,6 +447,8 @@ export class DriveSelector extends React.Component<
|
|||||||
isDrivelistDrive(row) && row.isSystem ? ['system'] : []
|
isDrivelistDrive(row) && row.isSystem ? ['system'] : []
|
||||||
}
|
}
|
||||||
rowKey="displayName"
|
rowKey="displayName"
|
||||||
|
// TODO: check why this is not passing the typescheck
|
||||||
|
// @ts-ignore
|
||||||
onCheck={(rows: Drive[]) => {
|
onCheck={(rows: Drive[]) => {
|
||||||
let newSelection = rows.filter(isDrivelistDrive);
|
let newSelection = rows.filter(isDrivelistDrive);
|
||||||
if (this.props.multipleSelection) {
|
if (this.props.multipleSelection) {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import ExclamationTriangleSvg from '@fortawesome/fontawesome-free/svgs/solid/triangle-exclamation.svg';
|
import ExclamationTriangleSvg from '@fortawesome/fontawesome-free/svgs/solid/triangle-exclamation.svg';
|
||||||
import * as _ from 'lodash';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Badge, Flex, Txt, ModalProps } from 'rendition';
|
import { Badge, Flex, Txt, ModalProps } from 'rendition';
|
||||||
import { Modal, ScrollableFlex } from '../../styled-components';
|
import { Modal, ScrollableFlex } from '../../styled-components';
|
||||||
|
@ -23,7 +23,7 @@ import ChevronRightSvg from '@fortawesome/fontawesome-free/svgs/solid/chevron-ri
|
|||||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
||||||
import { uniqBy, isNil } from 'lodash';
|
import { uniqBy, isNil } from 'lodash';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import prettyBytes from 'pretty-bytes';
|
import * as prettyBytes from 'pretty-bytes';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { requestMetadata } from '../../app';
|
import { requestMetadata } from '../../app';
|
||||||
|
|
||||||
@ -388,6 +388,8 @@ export class SourceSelector extends React.Component<
|
|||||||
SourceType: Source,
|
SourceType: Source,
|
||||||
auth?: Authentication,
|
auth?: Authentication,
|
||||||
): { promise: Promise<void>; cancel: () => void } {
|
): { promise: Promise<void>; cancel: () => void } {
|
||||||
|
// TODO: precise the disabled rule
|
||||||
|
// eslint-disable-next-line
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
return {
|
return {
|
||||||
cancel: () => {
|
cancel: () => {
|
||||||
@ -519,6 +521,7 @@ export class SourceSelector extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async onDrop(event: React.DragEvent<HTMLDivElement>) {
|
private async onDrop(event: React.DragEvent<HTMLDivElement>) {
|
||||||
|
// @ts-ignore
|
||||||
const [file] = event.dataTransfer.files;
|
const [file] = event.dataTransfer.files;
|
||||||
if (file) {
|
if (file) {
|
||||||
await this.selectSource(file.path, 'File').promise;
|
await this.selectSource(file.path, 'File').promise;
|
||||||
@ -584,6 +587,7 @@ export class SourceSelector extends React.Component<
|
|||||||
let image: SourceMetadata | DrivelistDrive =
|
let image: SourceMetadata | DrivelistDrive =
|
||||||
selectionImage !== undefined ? selectionImage : ({} as SourceMetadata);
|
selectionImage !== undefined ? selectionImage : ({} as SourceMetadata);
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
image = image.drive ?? image;
|
image = image.drive ?? image;
|
||||||
|
|
||||||
let cancelURLSelection = () => {
|
let cancelURLSelection = () => {
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
DriveStatus,
|
DriveStatus,
|
||||||
} from '../../../../shared/drive-constraints';
|
} from '../../../../shared/drive-constraints';
|
||||||
import { compatibility, warning } from '../../../../shared/messages';
|
import { compatibility, warning } from '../../../../shared/messages';
|
||||||
import prettyBytes from 'pretty-bytes';
|
import * as prettyBytes from 'pretty-bytes';
|
||||||
import { getImage, getSelectedDrives } from '../../models/selection-state';
|
import { getImage, getSelectedDrives } from '../../models/selection-state';
|
||||||
import {
|
import {
|
||||||
ChangeButton,
|
ChangeButton,
|
||||||
|
@ -142,12 +142,13 @@ export function setProgressState(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFlashResults() {
|
export function getFlashResults(): any {
|
||||||
return store.getState().toJS().flashResults;
|
return store.getState().toJS().flashResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFlashState() {
|
export function getFlashState(): any {
|
||||||
return store.getState().get('flashState').toJS();
|
const flashState = store.getState().get('flashState')! as any;
|
||||||
|
return flashState.toJS();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function wasLastFlashCancelled() {
|
export function wasLastFlashCancelled() {
|
||||||
@ -155,7 +156,7 @@ export function wasLastFlashCancelled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getLastFlashSourceChecksum(): string {
|
export function getLastFlashSourceChecksum(): string {
|
||||||
return getFlashResults().sourceChecksum;
|
return getFlashResults()!.sourceChecksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLastFlashErrorCode() {
|
export function getLastFlashErrorCode() {
|
||||||
|
@ -43,6 +43,7 @@ function blink(t: number) {
|
|||||||
return Math.floor(t) % 2;
|
return Math.floor(t) % 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function one(_t: number) {
|
function one(_t: number) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ interface Action {
|
|||||||
* @returns {Object} new state
|
* @returns {Object} new state
|
||||||
*/
|
*/
|
||||||
function getAvailableDrives(state: typeof DEFAULT_STATE) {
|
function getAvailableDrives(state: typeof DEFAULT_STATE) {
|
||||||
return state.get('availableDrives').toJS();
|
return state.get('availableDrives')!.toJS();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ export const anonymizeSentryData = (
|
|||||||
return event;
|
return event;
|
||||||
};
|
};
|
||||||
|
|
||||||
const extractPathRegex = /(.*)(^|\s)(file\:\/\/)?(\w\:)?([\\\/].+)/;
|
const extractPathRegex = /(.*)(^|\s)(file:\/\/)?(\w:)?([\\/].+)/;
|
||||||
const etcherSegmentMarkers = ['app.asar', 'Resources'];
|
const etcherSegmentMarkers = ['app.asar', 'Resources'];
|
||||||
|
|
||||||
export const anonymizePath = (input: string) => {
|
export const anonymizePath = (input: string) => {
|
||||||
@ -156,7 +156,7 @@ function flattenObject(obj: any) {
|
|||||||
const toReturn: AnalyticsPayload = {};
|
const toReturn: AnalyticsPayload = {};
|
||||||
|
|
||||||
for (const i in obj) {
|
for (const i in obj) {
|
||||||
if (!obj.hasOwnProperty(i)) {
|
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ function flattenObject(obj: any) {
|
|||||||
if (typeof obj[i] === 'object' && obj[i] !== null) {
|
if (typeof obj[i] === 'object' && obj[i] !== null) {
|
||||||
const flatObject = flattenObject(obj[i]);
|
const flatObject = flattenObject(obj[i]);
|
||||||
for (const x in flatObject) {
|
for (const x in flatObject) {
|
||||||
if (!flatObject.hasOwnProperty(x)) {
|
if (!Object.prototype.hasOwnProperty.call(flatObject, x)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import * as settings from '../models/settings';
|
|||||||
import * as analytics from '../modules/analytics';
|
import * as analytics from '../modules/analytics';
|
||||||
import * as windowProgress from '../os/window-progress';
|
import * as windowProgress from '../os/window-progress';
|
||||||
import { startApiAndSpawnChild } from './api';
|
import { startApiAndSpawnChild } from './api';
|
||||||
import { terminateScanningServer } from '../app';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Handle a flash error and log it to analytics
|
* @summary Handle a flash error and log it to analytics
|
||||||
@ -81,6 +80,7 @@ async function performWrite(
|
|||||||
|
|
||||||
console.log({ image, drives });
|
console.log({ image, drives });
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
return await new Promise(async (resolve, reject) => {
|
return await new Promise(async (resolve, reject) => {
|
||||||
const flashResults: FlashResults = {};
|
const flashResults: FlashResults = {};
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ async function performWrite(
|
|||||||
flashInstanceUuid: flashState.getFlashUuid(),
|
flashInstanceUuid: flashState.getFlashUuid(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFail = ({ device, error }) => {
|
const onFail = ({ device, error }: { device: any; error: any }) => {
|
||||||
console.log('fail event');
|
console.log('fail event');
|
||||||
console.log(device);
|
console.log(device);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@ -103,7 +103,7 @@ async function performWrite(
|
|||||||
finish();
|
finish();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDone = (event) => {
|
const onDone = (event: any) => {
|
||||||
console.log('done event');
|
console.log('done event');
|
||||||
event.results.errors = event.results.errors.map(
|
event.results.errors = event.results.errors.map(
|
||||||
(data: Dictionary<any> & { message: string }) => {
|
(data: Dictionary<any> & { message: string }) => {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import prettyBytes from 'pretty-bytes';
|
import * as prettyBytes from 'pretty-bytes';
|
||||||
import * as i18next from 'i18next';
|
import * as i18next from 'i18next';
|
||||||
|
|
||||||
export interface FlashState {
|
export interface FlashState {
|
||||||
|
@ -18,7 +18,7 @@ import CogSvg from '@fortawesome/fontawesome-free/svgs/solid/gear.svg';
|
|||||||
import QuestionCircleSvg from '@fortawesome/fontawesome-free/svgs/solid/circle-question.svg';
|
import QuestionCircleSvg from '@fortawesome/fontawesome-free/svgs/solid/circle-question.svg';
|
||||||
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import prettyBytes from 'pretty-bytes';
|
import * as prettyBytes from 'pretty-bytes';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Flex } from 'rendition';
|
import { Flex } from 'rendition';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
@ -116,10 +116,10 @@ interface MainPageState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MainPage extends React.Component<
|
export class MainPage extends React.Component<
|
||||||
{},
|
object,
|
||||||
MainPageState & MainPageStateFromStore
|
MainPageState & MainPageStateFromStore
|
||||||
> {
|
> {
|
||||||
constructor(props: {}) {
|
constructor(props: object) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
current: 'main',
|
current: 'main',
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {
|
import {
|
||||||
Alert as AlertBase,
|
Alert as AlertBase,
|
||||||
@ -113,14 +112,25 @@ export const DetailsText = (props: FlexProps) => (
|
|||||||
|
|
||||||
const modalFooterShadowCss = css`
|
const modalFooterShadowCss = css`
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background: 0, linear-gradient(rgba(255, 255, 255, 0), white 70%) 0 100%, 0,
|
background:
|
||||||
|
0,
|
||||||
|
linear-gradient(rgba(255, 255, 255, 0), white 70%) 0 100%,
|
||||||
|
0,
|
||||||
linear-gradient(rgba(255, 255, 255, 0), rgba(221, 225, 240, 0.5) 70%) 0 100%;
|
linear-gradient(rgba(255, 255, 255, 0), rgba(221, 225, 240, 0.5) 70%) 0 100%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: 100% 40px, 100% 40px, 100% 8px, 100% 8px;
|
background-size:
|
||||||
|
100% 40px,
|
||||||
|
100% 40px,
|
||||||
|
100% 8px,
|
||||||
|
100% 8px;
|
||||||
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
background-size: 100% 40px, 100% 40px, 100% 8px, 100% 8px;
|
background-size:
|
||||||
|
100% 40px,
|
||||||
|
100% 40px,
|
||||||
|
100% 8px,
|
||||||
|
100% 8px;
|
||||||
background-attachment: local, local, scroll, scroll;
|
background-attachment: local, local, scroll, scroll;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -238,7 +248,7 @@ export interface GenericTableProps<T> extends BaseTableProps<T> {
|
|||||||
|
|
||||||
const GenericTable: <T>(
|
const GenericTable: <T>(
|
||||||
props: GenericTableProps<T>,
|
props: GenericTableProps<T>,
|
||||||
) => React.ReactElement<GenericTableProps<T>> = <T extends {}>({
|
) => React.ReactElement<GenericTableProps<T>> = <T extends object>({
|
||||||
refFn,
|
refFn,
|
||||||
...props
|
...props
|
||||||
}: GenericTableProps<T>) => (
|
}: GenericTableProps<T>) => (
|
||||||
@ -318,7 +328,7 @@ function StyledTable<T>() {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Table = <T extends {}>(props: GenericTableProps<T>) => {
|
export const Table = <T extends object>(props: GenericTableProps<T>) => {
|
||||||
const TypedStyledFunctional = StyledTable<T>();
|
const TypedStyledFunctional = StyledTable<T>();
|
||||||
return <TypedStyledFunctional {...props} />;
|
return <TypedStyledFunctional {...props} />;
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,8 @@ let mainWindow: any = null;
|
|||||||
|
|
||||||
remoteMain.initialize();
|
remoteMain.initialize();
|
||||||
|
|
||||||
|
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
async function checkForUpdates(interval: number) {
|
async function checkForUpdates(interval: number) {
|
||||||
// We use a while loop instead of a setInterval to preserve
|
// We use a while loop instead of a setInterval to preserve
|
||||||
// async execution time between each function call
|
// async execution time between each function call
|
||||||
@ -144,14 +146,6 @@ electron.app.on('open-url', async (event, data) => {
|
|||||||
await selectImageURL(data);
|
await selectImageURL(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
interface AutoUpdaterConfig {
|
|
||||||
autoDownload?: boolean;
|
|
||||||
autoInstallOnAppQuit?: boolean;
|
|
||||||
allowPrerelease?: boolean;
|
|
||||||
fullChangelog?: boolean;
|
|
||||||
allowDowngrade?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createMainWindow() {
|
async function createMainWindow() {
|
||||||
const fullscreen = Boolean(await settings.get('fullscreen'));
|
const fullscreen = Boolean(await settings.get('fullscreen'));
|
||||||
const defaultWidth = settings.DEFAULT_WIDTH;
|
const defaultWidth = settings.DEFAULT_WIDTH;
|
||||||
@ -202,7 +196,7 @@ async function createMainWindow() {
|
|||||||
// Prevent external resources from being loaded (like images)
|
// Prevent external resources from being loaded (like images)
|
||||||
// when dropping them on the WebView.
|
// when dropping them on the WebView.
|
||||||
// See https://github.com/electron/electron/issues/5919
|
// See https://github.com/electron/electron/issues/5919
|
||||||
mainWindow.webContents.on('will-navigate', (event) => {
|
mainWindow.webContents.on('will-navigate', (event: any) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -287,7 +281,7 @@ async function main(): Promise<void> {
|
|||||||
const webview = electron.webContents.fromId(id);
|
const webview = electron.webContents.fromId(id);
|
||||||
|
|
||||||
// Open link in browser if it's opened as a 'foreground-tab'
|
// Open link in browser if it's opened as a 'foreground-tab'
|
||||||
webview.setWindowOpenHandler((event) => {
|
webview!.setWindowOpenHandler((event) => {
|
||||||
const url = new URL(event.url);
|
const url = new URL(event.url);
|
||||||
if (
|
if (
|
||||||
(url.protocol === 'http:' || url.protocol === 'https:') &&
|
(url.protocol === 'http:' || url.protocol === 'https:') &&
|
||||||
|
@ -164,11 +164,11 @@ export const error = {
|
|||||||
? i18next.t('message.toDrive', {
|
? i18next.t('message.toDrive', {
|
||||||
description: drives[0].description,
|
description: drives[0].description,
|
||||||
name: drives[0].displayName,
|
name: drives[0].displayName,
|
||||||
})
|
})
|
||||||
: i18next.t('message.toTarget', {
|
: i18next.t('message.toTarget', {
|
||||||
count: drives.length,
|
count: drives.length,
|
||||||
num: drives.length,
|
num: drives.length,
|
||||||
});
|
});
|
||||||
return i18next.t('message.flashError', {
|
return i18next.t('message.flashError', {
|
||||||
image: imageBasename,
|
image: imageBasename,
|
||||||
targets: target,
|
targets: target,
|
||||||
|
@ -40,6 +40,7 @@ ipc.config.silent = true;
|
|||||||
// The purpose behind this change is for this process
|
// The purpose behind this change is for this process
|
||||||
// to emit a "disconnect" event as soon as the GUI
|
// to emit a "disconnect" event as soon as the GUI
|
||||||
// process is closed, so we can kill this process as well.
|
// process is closed, so we can kill this process as well.
|
||||||
|
|
||||||
// @ts-ignore (0 is a valid value for stopRetrying and is not the same as false)
|
// @ts-ignore (0 is a valid value for stopRetrying and is not the same as false)
|
||||||
ipc.config.stopRetrying = 0;
|
ipc.config.stopRetrying = 0;
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ async function write(options: WriteOptions) {
|
|||||||
const onFail = (destination: SourceDestination, error: Error) => {
|
const onFail = (destination: SourceDestination, error: Error) => {
|
||||||
emitFail({
|
emitFail({
|
||||||
// TODO: device should be destination
|
// TODO: device should be destination
|
||||||
|
|
||||||
// @ts-ignore (destination.drive is private)
|
// @ts-ignore (destination.drive is private)
|
||||||
device: destination.drive,
|
device: destination.drive,
|
||||||
error: toJSON(error),
|
error: toJSON(error),
|
||||||
|
@ -37,7 +37,6 @@ if (platform !== 'linux' || (geteuid && geteuid() === 0)) {
|
|||||||
if (platform === 'win32') {
|
if (platform === 'win32') {
|
||||||
const {
|
const {
|
||||||
DriverlessDeviceAdapter: driverless,
|
DriverlessDeviceAdapter: driverless,
|
||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
} = require('etcher-sdk/build/scanner/adapters/driverless');
|
} = require('etcher-sdk/build/scanner/adapters/driverless');
|
||||||
adapters.push(new driverless());
|
adapters.push(new driverless());
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,11 @@ function prepareDrive(drive: Drive) {
|
|||||||
return drive.drive;
|
return drive.drive;
|
||||||
} else if (drive instanceof sdk.sourceDestination.UsbbootDrive) {
|
} else if (drive instanceof sdk.sourceDestination.UsbbootDrive) {
|
||||||
// This is a workaround etcher expecting a device string and a size
|
// This is a workaround etcher expecting a device string and a size
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
drive.device = drive.usbDevice.portId;
|
drive.device = drive.usbDevice.portId;
|
||||||
drive.size = null;
|
drive.size = null;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
drive.progress = 0;
|
drive.progress = 0;
|
||||||
drive.disabled = true;
|
drive.disabled = true;
|
||||||
@ -140,6 +142,7 @@ function updateDriveProgress(
|
|||||||
progress: number,
|
progress: number,
|
||||||
) {
|
) {
|
||||||
const drives = getDrives();
|
const drives = getDrives();
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const driveInMap = drives[drive.device];
|
const driveInMap = drives[drive.device];
|
||||||
if (driveInMap) {
|
if (driveInMap) {
|
||||||
|
4370
npm-shrinkwrap.json
generated
4370
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -60,7 +60,7 @@
|
|||||||
"node-ipc": "9.2.1",
|
"node-ipc": "9.2.1",
|
||||||
"outdent": "0.8.0",
|
"outdent": "0.8.0",
|
||||||
"path-is-inside": "1.0.2",
|
"path-is-inside": "1.0.2",
|
||||||
"pretty-bytes": "6.1.1",
|
"pretty-bytes": "5.6.0",
|
||||||
"react": "17.0.2",
|
"react": "17.0.2",
|
||||||
"react-dom": "17.0.2",
|
"react-dom": "17.0.2",
|
||||||
"react-i18next": "13.5.0",
|
"react-i18next": "13.5.0",
|
||||||
@ -72,7 +72,7 @@
|
|||||||
"uuid": "9.0.1"
|
"uuid": "9.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@balena/lint": "5.4.2",
|
"@balena/lint": "7.2.4",
|
||||||
"@electron-forge/cli": "7.2.0",
|
"@electron-forge/cli": "7.2.0",
|
||||||
"@electron-forge/maker-deb": "7.2.0",
|
"@electron-forge/maker-deb": "7.2.0",
|
||||||
"@electron-forge/maker-dmg": "7.2.0",
|
"@electron-forge/maker-dmg": "7.2.0",
|
||||||
@ -98,7 +98,7 @@
|
|||||||
"chai": "4.3.10",
|
"chai": "4.3.10",
|
||||||
"css-loader": "5.2.7",
|
"css-loader": "5.2.7",
|
||||||
"electron": "27.1.3",
|
"electron": "27.1.3",
|
||||||
"electron-mocha": "^12.1.0",
|
"electron-mocha": "^12.2.0",
|
||||||
"file-loader": "6.2.0",
|
"file-loader": "6.2.0",
|
||||||
"husky": "8.0.3",
|
"husky": "8.0.3",
|
||||||
"lint-staged": "15.2.0",
|
"lint-staged": "15.2.0",
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
const { app } = require('electron');
|
const { app } = require('electron');
|
||||||
|
|
||||||
if (app !== undefined) {
|
if (app !== undefined) {
|
||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
const remoteMain = require('@electron/remote/main');
|
const remoteMain = require('@electron/remote/main');
|
||||||
|
|
||||||
remoteMain.initialize();
|
remoteMain.initialize();
|
||||||
|
@ -1156,7 +1156,7 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
'/dev/disk4',
|
'/dev/disk4',
|
||||||
'/dev/disk5',
|
'/dev/disk5',
|
||||||
'/dev/disk6',
|
'/dev/disk6',
|
||||||
];
|
];
|
||||||
const drives = [
|
const drives = [
|
||||||
{
|
{
|
||||||
device: drivePaths[0],
|
device: drivePaths[0],
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import type { Configuration, ModuleOptions } from 'webpack';
|
import type { Configuration, ModuleOptions } from 'webpack';
|
||||||
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
import {
|
import {
|
||||||
BannerPlugin,
|
BannerPlugin,
|
||||||
IgnorePlugin,
|
IgnorePlugin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user