992 Commits

Author SHA1 Message Date
Juan Cruz Viotti
439be1c222 refactor(image-stream): rename file variable to imagePath (#1589)
This is a small initial step towards decoupling the image stream
handlers from the concept of a "file."

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 09:30:28 -04:00
Juan Cruz Viotti
77c60b91c6 upgrade: drivelist to v5.0.25 (#1574)
This version contains various improvements on the drive detection system
mainly on Windows. The improvements can be summarized as follows:

- Drivelist no longer spawns a .bat script to perform its job. This
  means that a lot of spawning related issues are now fixed

- Drivelist doesn't fetch drive sizes from WMI anymore, which was known
  to incorrectly report a very small size for certain drives, causing
  the famous "0.0 GB" Windows issues (see
  https://github.com/resin-io-modules/drivelist/issues/142)

- Cleanup temporary scripts after execution

This PR also sets the DRIVELIST_DEBUG environment variable to enable
debug information from Windows' drivelist implementation.

Change-Type: patch
Changelog-Entry: Implement Windows drive detection using C++
Changelog-Entry: Fix various Windows `.bat` spawning issues
Changelog-Entry: Fix 0.0 GB Windows drive detection issues
Changelog-Entry: Cleanup drive detection temporary scripts created for other operating systems
Fixes: https://github.com/resin-io/etcher/issues/1108
Fixes: https://github.com/resin-io/etcher/issues/1054
Fixes: https://github.com/resin-io/etcher/issues/995
Fixes: https://github.com/resin-io/etcher/issues/1483
Fixes: https://github.com/resin-io/etcher/issues/1142
Fixes: https://github.com/resin-io/etcher/issues/1571
See: https://github.com/resin-io-modules/drivelist/blob/master/CHANGELOG.md
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-12 15:18:05 -04:00
Juan Cruz Viotti
a5b1a92920 chore: add eslint-jsdoc-plugin to eslint (#1585)
This plugin helps us detect some things the built-in jsdoc rules can't,
like whether there is an example or not.

As expected, the addition of this plugin helped detect some minor JSDoc
issues.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-12 10:19:08 -04:00
Benedict Aas
fc6c5bf585 refactor(GUI): deangular os-dialog and error module (#1546)
We remove the Angular dependency from `lib/gui/os/dialog` and
`lib/gui/modules/error` which is also now renamed to
`lib/gui/modules/exception`.

Changelog-Entry: Deangular the os-dialog and error modules
2017-07-11 17:21:48 -04:00
Juan Cruz Viotti
427a791de5 refactor(GUI): remove flash of white electron webContents workaround (#1575)
The lib/gui/etcher.js file contained a workaround to an Electron issue
that have since then been solved. In summary:

- Replace the `did-finish-load` event of `webContents` with
  `ready-to-show`, which is only emitted when the whole webview has
  finished loading

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 11:56:05 -04:00
Juan Cruz Viotti
fdceaadec5 refactor(GUI): move redux store to lib/shared (#1576)
After https://github.com/resin-io/etcher/pull/1569, the redux store can
run outside of a browser context. This commit moves it to `lib/shared`,
where we will likely move all the other models as well. As an extra, I
renamed `Store` to `store`, since there was no reason for that variable
to be capitalized.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-07 18:47:39 -04:00
Juan Cruz Viotti
4dc56f4678 refactor(GUI): decouple localStorage from the redux store (#1569)
We're currently persisting the user settings in localSettings by using a
redux plugin called redux-localstorage. As a way to decouple the redux
store from a technology that is browser specific, this commit makes the
following changes:

- Create local-settings.js, which is concerned with managing settings in
  a persisting location

- Decouple the redux store from the persisting storage method

- Extend the settings model to persist settings, cache reads, etc

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-06 17:49:13 -04:00
Jonas Hermsmeier
1b79d50288 fix(gui): Fix image checks in image selections (#1573)
I must have screwed something up during a rebase,
this mends the partition table an windows image checks.

Change-Type: patch
2017-07-06 16:00:07 -04:00
Juan Cruz Viotti
1b695a49e9 upgrade: electron-builder to v19.9.1 (#1548)
- Exclude *.dll/*.exe files from the asar in non-Windows operating
  systems (from 19.8.0)

- Correctly parse boolean flags in `--extraMetadata` (in v19.9.0)

See: https://github.com/electron-userland/electron-builder/releases/tag/v19.9.1
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-06 13:51:55 -04:00
Jonas Hermsmeier
80b588683e feat(image-stream): Read MBR & GPT in .getImageMetadata() (#1248)
* feat(image-stream): Read MBR & GPT in .getImageMetadata()
* feat(gui): Display warning when image has no MBR
* test(image-stream): Update .isSupportedImage() tests
* feat(image-stream): Normalize MBR & GPT partitions
* test(image-stream): Add partition info
* feat(image-selection): Send missing part table event
* test(image-stream): Add GPT test image

Change-Type: minor
2017-07-05 16:18:02 +02:00
Benedict Aas
b18fa1f13f feat(GUI): add webview api version parameter (#1558)
We add the API version sent to the banner via a GET search parameter,
allowing for more intricate control over what data needs or can be sent.
2017-07-04 13:11:44 -04:00
Jonas Hermsmeier
a370e9d4cb feat(gui): Show friendlier error dialog when opening images (#1557)
* feat(gui): Friendly error dialog when opening image fails

This displays a friendlier error dialog if opening an image fails
due any reason (like i.e. an unsupported compression method)

Change-Type: patch

* test(image-stream): Add test for unsupported compression method
* test(image-stream): Only check `error.description` when given
* test(image-stream): Add zip-deflate64.zip
2017-06-28 16:44:21 +02:00
Juan Cruz Viotti
d8e9cb93b7 chore: move all electron-builder configuration to electron-builder.yml (#1544)
The electron-builder configuration we're putting in package.json is
growing. To make it easier to read and edit, we'll move the whole
`build` property into a configuration file called
`electron-builder.yml`.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-27 10:15:38 -04:00
Juan Cruz Viotti
a7ac28b717 chore: make use of electron-builder to build GNU/Linux packages (#1520)
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-23 20:10:51 -04:00
Benedict Aas
5297ddf68c feat(GUI): swap progress bar speed and time (#1537)
We swap the placement of the progress speed and time residing below the
progress bar.

Changelog-Entry: Swap speed and time below the flashing progress bar.
Closes: https://github.com/resin-io/etcher/issues/1312
2017-06-22 17:35:51 -04:00
Juan Cruz Viotti
103a048e4d refactor(GUI): replace SET_SETTING with an atomic SET_SETTINGS action (#1515)
This commit is the first on a series of commit to incrementally
implement support for configuration files (so we avoid a huge PR like we
have at the moment).

Once of the first things we can do is replace the `SET_SETTING` redux
action with an atomic `SET_SETTINGS` action that sets all the settings
for the application at once.

The purpose of this change is that later the `SET_SETTINGS` action can
be modified to stringify all the settings and store them in a
configuration file, without having to deal with merges, conflicts, etc
(since the client application if forced to resolve those problems before
calling the `SET_SETTINGS` action.)

The behaviour of the code remains almost the same, with the exception
that the user can now set settings that we don't know about, so the user
can switch between Etcher versions without getting weird errors if one
of the configuration keys he has doesn't exist in the other version.

See: https://github.com/resin-io/etcher/pull/1382
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-15 12:57:15 -04:00
Benedict Aas
0f600c3cc2 refactor(GUI): remove angular dependency from drive scanner (#1512)
Remove the Angular dependency from DriveScanner and with it the service,
exposing it through the module directly.
2017-06-15 11:26:03 -04:00
Juan Cruz Viotti
15b178a158 refactor(GUI): move ETCHER_DISABLE_UPDATES into package.json (#1501)
Etcher supports disabling the update notification dialog by setting the
`ETCHER_DISABLE_UPDATES` environment variable.

In order to simplify disabling updates for when these are managed by a
package manager (e.g. in a debian package), this removes support for the
`ETCHER_DISABLE_UPDATES` environment variable, and instead requires
packagers to tweak the `updates.enabled` property of the package.json
file, which is set to `true` by default.

We don't want to encourage end users to disable the update mechanism, so
the documention was removed from `USER-DOCUMENTATION.md`. This option
will remain as something only packagers should tweak.

Change-Type: minor
Changelog-Entry: Remove support for the `ETCHER_DISABLE_UPDATES` environment variable.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-13 09:07:47 -04:00
Benedict Aas
a7d713c323 feat(GUI): rewrite svg-icon directive in react (#1464)
We change from using an Angular directive to using React through
react2angular in the SVGIcon module.
2017-06-12 08:42:52 -04:00
Benedict Aas
ef739fb222 refactor(GUI): remove angular dependency from selection-state (#1509)
We remove the dependency on Angular from SelectionStateModel and rename
it to selectionState.
2017-06-12 08:40:52 -04:00
Juan Cruz Viotti
b16f9cfdf7 chore: re-organize package.json in a way similar to electron-builder (#1504)
This commit re-organizes various metadata properties in package.json so
that the structure better matches what `electron-builder` expects, to
ease the transition.

- Move `.companyName` to the Makefile (we don't need this in
  package.json)
- Move `.displayName` to `.build.productName`
- Move `.copyright` to `.build.copyright`
- Move category to `.build.mac.category`
- Move bundle id to `.build.appId`

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-10 13:37:44 -04:00
Benedict Aas
31a2389d04 fix(GUI): reset webview after navigating away (#1422)
We reload and reset the webview to its original URL when the user
navigates away from the success screen.

Changelog-Entry: Reset webview after navigating away from the success screen.
2017-06-08 11:42:55 -04:00
Romain Bazile
a3c13e75cf feat: support .sdcard images (#1493)
Change-Type: minor
Changelog-Entry: Add support for `.sdcard` images.
Link: https://github.com/resin-io/etcher/issues/1360
Fixes: https://github.com/resin-io/etcher/issues/1348
Fixes: https://github.com/resin-io/etcher/issues/1361
2017-06-06 12:57:55 -04:00
Jonas Hermsmeier
ce50364b9f upgrade(package): Update node-sass to 4.5.3 (#1489)
This updates node-sass from v3.x to v4.x in anticipation
of addition of Electron ABI versions in an upcoming version.

Change-Type: patch
2017-06-05 18:38:19 +02:00
Benedict Aas
14b04413b5 refactor(GUI): remove angular from DrivesModel (#1265)
We remove usage of Angular from DrivesModel.

Depends: https://github.com/resin-io/etcher/pull/1261
Depends: https://github.com/resin-io/etcher/pull/1264

* remove angular injection from tests

* move file

* add empty array test
2017-06-05 10:30:58 -04:00
Juan Cruz Viotti
dc2212a57f fix(GUI): ignore UNABLE_TO_VERIFY_LEAF_SIGNATURE HTTP issues (#1473)
This error may get thrown when fetching the list of S3 packages when the
user is behind a proxy tht causes the SSL certificate to incorrectly not
be trusted.

See: https://github.com/atom/apm/issues/103
See: https://github.com/resin-io/etcher/issues/1465
Change-Type: patch
Changelog-Entry: Fix `UNABLE_TO_VERIFY_LEAF_SIGNATURE` error at startup.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-06-05 10:22:15 -04:00
Benedict Aas
ee3c146785 fix(GUI): correct relative notification icon path (#1470)
We update the relative icon path to the correct relative path containing
the Etcher icon.

See: https://github.com/resin-io/etcher/issues/1443
2017-06-01 17:07:12 -04:00
Benedict Aas
b56a39e576 style(GUI): normal weight message on success page (#1469)
We make the fonts a regular weight instead of bold on the success page's
fallback banner.

Changelog-Entry: Minor style improvements to the fallback success page banner.
2017-05-30 09:36:33 -04:00
Benedict Aas
7898358617 fix(GUI): stop settings overflow into footer (#1468)
By removing the 'advanced' sub-header we stop the settings from
overflowing into the footer.

Fixes: https://github.com/resin-io/etcher/issues/1383
Changelog-Entry: Remove "Advanced" settings subtitle.
2017-05-30 09:34:45 -04:00
Benedict Aas
dcb152aa00 fix(GUI): don't break up size number in drive selector (#1467)
We make the size number in the drive selector stay whole through
the `word-break: keep-all` CSS property, ensuring that it doesn't
partially overflow to the next line.

See: https://github.com/resin-io/etcher/issues/1437
Changelog-Entry: Don't break up size numbers in the drive selector.
2017-05-26 07:36:32 -04:00
Juan Cruz Viotti
1e169315fd refactor(GUI): turn the update notifier modal into a native dialog (#1359)
Electron v1.6.1 introduced checkbox support to the native message
dialog, giving us everything that was needed to implement the update
notifier modal using a native dialog.

This change allows us to get rid of a lot code.

See: https://github.com/electron/electron/pull/8590
Change-Type: patch
Changelog-Entry: Turn the update notifier modal into a native dialog.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-23 19:06:35 -04:00
Benedict Aas
3df6cd07d0 feat(GUI): add metadata and icon to notifications (#1455)
We add the image filename, its destination drive, and application icon
to the notifications.

See: https://github.com/resin-io/etcher/issues/1443
Changelog-Entry: Add image name, drive name, and icon to notifications.
2017-05-22 15:06:32 -04:00
Juan Cruz Viotti
705e273400 fix(GUI): catch EACCES when querying S3 packages (#1463)
When the user is behind a firewall, then the HTTP request to query the
latest available version from S3 may throw an EACCES error, eventually
causing a confusin "You don't have access to this resource" error
window.

Change-Type: patch
Changelog-Entry: Fix "You don't have access to this resource" error at startup when behind a firewall.
Fixes: https://github.com/resin-io/etcher/issues/1458
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-20 14:47:50 -04:00
Benedict Aas
697c86362c feat(GUI): add success page resin referrer (#1430) 2017-05-15 11:24:48 -04:00
Benedict Aas
2c26b4c6ac feat(GUI): dynamic finish page (#1368)
* feat(GUI): dynamic finish page

We implement an externally loaded dynamic finish page in React with
`react2angular`. If the Internet connection is unreliable or unavailable, or a
non-200 HTTP response is returned we display a fallback default finish banner.

Change-Type: minor
Changelog-Entry: Implement a dynamic finish page.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-12 01:07:24 -04:00
Juan Cruz Viotti
5c33abca21 fix: add a delay before the final unmount on success (#1416)
If the user has the "Unmount on success" setting enabled, then Etcher
will unmount the drive after ther flashing process completed, right
after closing the drive file descriptor.

Turns out macOS will attempt to re-mount a drive once its file
descriptor gets closed, which means that if we try to unmount too fast,
then the drive will get re-mounted again.

As a naive solution, we add a timeout before finally unmounting the
drive. Keep in the mind this is only a temporary solution until we fix
mountutils to do the right thing.

See: https://github.com/resin-io/etcher/pull/1414
Fixes: https://github.com/resin-io/etcher/issues/1385
Change-Type: patch
Changelog-Entry: Prevent drive from getting re-mounted in macOS even when the unmount on success setting is enabled.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-12 00:40:08 -04:00
Juan Cruz Viotti
b7f871607e fix(GUI): ignore ECONNRESET and ECONNREFUSED when querying S3 (#1415)
Querying S3 to determine the latest available versions might throw
`ECONNRESET` and `ECONNREFUSED`. This commit extends the
`s3Packages.getRemoteVersions()` function to handle these errors and
return no available version if so, like we already do with other similar
HTTP errors.

Change-Type: patch
Changelog-Entry: Fix `ECONNRESET` and `ECONNREFUSED` errors when checking for updates on unstable connections.
Fixes: https://github.com/resin-io/etcher/issues/1396
Fixes: https://github.com/resin-io/etcher/issues/1388
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-11 21:20:03 -04:00
Juan Cruz Viotti
babe12cd7b fix(GUI): handle spaces in installation path when elevating on Windows (#1411)
Etcher will get stuck at "Starting..." when executing the application on
a directory that contains spaces, like "C:\Program Files (x86)".

The problem is that the command is not quoted correctly when passed to
`cmd.exe /c`. This commit addresses the following specific problems:

- Quote the whole argument to `cmd.exe /c`
- Quote each individual argument after `call`

Change-Type: patch
Changelog-Entry: Fix application stuck at "Starting..." on Windows.
See: https://github.com/resin-io/etcher/pull/1376
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-11 18:05:40 -04:00
Benedict Aas
69a982bf8d refactor(GUI): remove analytics angular dependency (#1387)
We rename `AnalyticsService` to `analytics` and remove its dependency on
Angular.
2017-05-10 20:27:54 -04:00
Benedict Aas
b6aa5ada30 refactor(GUI): central error/warning messages function (#1193)
* Centralise drive error/warning messages with a function
  `.getDriveImageCompatibilityStatuses` in `lib/shared/drive-constraints.js`
  -- tests included
* Fix an error where several labels show at once
* Clarify the source drive label to 'Drive Contains Image'
* Remove label icons and make text bold to match Zeplin's design

Closes: https://github.com/resin-io/etcher/issues/1143
Closes: https://github.com/resin-io/etcher/issues/1144
2017-05-10 13:52:20 -04:00
Daniel Aleksandersen
d76a6dff89 doc(GUI): suggest BootCamp as an alternative when flashing Windows images (#1393)
* Specify that Rufus is only an option for Windows.
* Suggest Apple Boot Camp Assistant (built-in) as an alternative for macOS users.
2017-05-10 11:50:36 -04:00
Andrew Scheller
bfd2f2bf57 style(settings): Clarify meaning of the "Report Errors" button (#1392)
To make it clear that this actually controls the reporting of errors back to resin.io, and not the reporting of errors to the user.

See #1383
2017-05-10 16:13:07 +01:00
Juan Cruz Viotti
7ddc5d525c refactor: address code review comments from #1366 (#1390)
See: https://github.com/resin-io/etcher/pull/1366
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-09 19:33:45 -04:00
Benedict Aas
efa7f986a4 fix(GUI): bound flash progress percentage within 0-100 (#1258)
We limit the Store state flashing percentage to be within 0-100,
throwing errors otherwise. Comes with tests.

Changelog-Type: Bound flash progress percentage within 0-100 range.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-09 19:24:44 -04:00
Jonas Hermsmeier
df74a2763c feat(image-stream): Make invalid images user errors (#1369)
This displays a user error if the reading the image causes an error,
instead of letting it fall through and get reported.
This is to avoid reporting errors that are not due to malfunction of the software,
but due to malformatted images.

Change-Type: minor
Changelog-Entry: Display nicer error dialog when reading an invalid image
2017-05-08 18:29:28 +02:00
Juan Cruz Viotti
b75dfd3ece feat(GUI): implement Windows elevation using a native module (#1366)
Sentry error reports showcase that elevation errors on Windows are one
of the most frequent Windows errors.

In order to perform Windows elevation, we ship compiled EXEs of a third
party CLI elevation application (http://code.kliu.org/misc/elevate/)
that has several limitations:

- We have the scan the output of the script to determine if a user
  cancelled the elevation request, which causes all sorts of issues on
  computers where English is not the main language

- The application displays a `cmd.exe` window for some milliseconds,
  which is bad UX, that we have to workaround by distributing a patched
  version of the tool

- The CLI application has to be spawned, which seems to be problematic
  if users have anti-virus software, leading to hard to debug issues

- We don't have any control if something goes wrong

For these reasons, we decided to implement our own elevation mechanism
in C++ as a Node.js add-on, based on the `elevate.exe` code we where
previously using.

Misc changes:

- Introduce a `lib/shared/bindings.js` module to easily require local native
  add-ons

- Install `cpplint` and configure it to lint C++ files

Note that for practical reasons, the C++ code lives in this repository
rather than in a separate module. We will release this functionality in
a more accessible way in the future as part of the Etcher SDK project.

Change-Type: patch
Changelog-Entry: Fix uncaught errors when cancelling elevation requests on Windows when the system's language is not English.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-02 18:36:57 -04:00
Jonas Hermsmeier
becca2d05e fix(image-stream): Remove inability to fallback to octet-stream (#1363)
Using `mime-types` in that place made it impossible to use other
other file extensions like `.sdcard` and have them treated as `application/octet-stream`
when drag and dropping images into Etcher.

This moves the fallback logic in `lib/image-stream` to `.getFromFilePath()`,
to still facilitate proper MIME type detection, while allowing it to fall back
to the octet-stream handler, if there's no available handler for a specific type.

Change-Type: patch
Changelog-Entry: Fix not treating unknown images as octet-stream
2017-04-27 18:00:53 +02:00
Juan Cruz Viotti
1cf4cdcee9 refactor(errors): add isUserError utility function (#1320)
This utility function is useful to avoid duplicating the logic of
checking whether an error is a user error across the code base.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 23:54:16 -04:00
Juan Cruz Viotti
c9e410fcb1 refactor: address file-extensions review comments (#1347)
See: https://github.com/resin-io/etcher/pull/1343#pullrequestreview-34288142
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 23:53:03 -04:00
Juan Cruz Viotti
59edd881e2 refactor: move OSNotificationService out of the angular world (#1352)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 23:52:46 -04:00