964 Commits

Author SHA1 Message Date
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
Juan Cruz Viotti
d3b35742a6 refactor(GUI): integrate etcher-latest-version into the main repo (#1183)
`etcher-latest-version` was kept in a separate repository in order to
re-use it with the Etcher website, however the Etcher website is not
using it at all, and we're moving towards having the website in the main
repository.

Therefore, this commit brings back the logic from
`etcher-latest-version`, but introduces it as
`lib/shared/s3-packages.js`, in order to not tie ourselves to the
AngularJS framework, and as a step towards the Etcher SDK.

As a nice little bonus, this commit adds support for an
`ETCHER_FAKE_S3_LATEST_VERSION` environment variable that can be used to
trick Etcher that there is an available update, and therefore show the
update notifier modal.

Also, this commit adds support for snapshot builds update-checks, by
checking the `resin-nightly-downloads` S3 bucket if the current version
contains a git commit hash build number.

If the version is not a production release, then the update notifier
modal doesn't present the checkbox to disable update notifications for X
days.

We also add a property called `updates.semverRange` to `package.json`,
which can be used to fine control which versions are considered as
candidates for an update notification.

This commit adds a setting called `includeUnstableChannel`, which can be
used to tweak whether unstable (beta) releases are considered or not
when checking for the latest available version.

See: https://github.com/resin-io-modules/etcher-latest-version
Fixes: https://github.com/resin-io/etcher/issues/953
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 23:52:04 -04:00
Juan Cruz Viotti
23a5e53d50 refactor: address review comments from #1351 (#1355)
See: https://github.com/resin-io/etcher/pull/1351
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-26 11:05:36 -04:00
Andrew Scheller
30c531417a refactor(utils): make PERCENTAGE_ constants public, and re-use them in flash.js (#1353) 2017-04-26 11:05:14 -04:00
Juan Cruz Viotti
62ca0e5b09 refactor: extract elevation routines to lib/shared/permissions.js (#1351)
The elevation mechanism currently embedded in
`lib/child-writer/writer-proxy.js` is extracted as a separate re-usable
function in `lib/shared/permissions.js`.

This change hugely simplifies the writer proxy, while allowing us to
iterate faster on the elevation core functionality.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-25 11:28:50 -04:00
Ștefan Daniel Mihăilă
1fe87d8883 feat(GUI): collect archive and image extension in analytics (#1343)
Change-Type: patch
2017-04-22 20:40:42 -04:00
Ștefan Daniel Mihăilă
9e7e5de63a feat(GUI): add uuid to flash events (#1344)
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-22 20:40:05 -04:00
Juan Cruz Viotti
dafa1f3ede refactor(child-writer): add robot commands constant (#1332)
See: https://github.com/resin-io/etcher/pull/1295#discussion_r112463686
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-21 17:41:20 -04:00
Juan Cruz Viotti
c0a91c0aba feat(GUI): add a validateWriteOnSuccess property to the flash event (#1333)
This event property will allow us to inspect how many people are running
Etcher without the validation mechanism.

See: https://github.com/resin-io/etcher/issues/1293
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-21 08:54:44 -04:00
Juan Cruz Viotti
fe91be11e8 refactor(errors): createError and createUserError accept an object (#1322)
Currently, both of these functions accept two arguments: the error
title, and the error description. This function signature makes is hard
to keep adding options to these error creation functions, like an error
code, so this commit refactors them to take a single argument: an
options object containing `title` and `description` properties.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 12:23:32 -04:00
Juan Cruz Viotti
96f586900c fix(GUI): catch EIO errors and display a user friendly message (#1318)
If we get EIO at this point, then it means that the writer did
everything it could to recover (like multiple retries), and the error
is truly an input/output error coming from the operating system.

In this commit, we show a nice user friendly message explaining what
happened, and advising users to try again with another drive, reader, or
port instead of showing an uncaught EIO error.

Change-Type: patch
Changelog-Entry: Show a friendly user message on EIO after many retries.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 12:01:43 -04:00
Juan Cruz Viotti
586a6950b2 fix(GUI): send an "elevation cancelled" analytics event (#1310)
If the user cancels the elevation dialog, then no event is emitted,
making it hard to track down what happened after the flash button was
pressed.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-20 11:04:45 -04:00
Jonas Hermsmeier
6c930e2d8d fix(image-stream): fix Apple disk image detection & reading (#1283)
This fixes two things: The format detection, and a bug in `udif`.

First, by categorizing the `.dmg` extension as compressed image,
`.isSupportedImage()` would attempt to detect the format after stripping
the extension, causing it to be misdetected.

Second, `udif`'s ReadStream didn't add the `dataForkOffset` to its
position when reading blocks, causing the wrong data to be read for some images,
in turn causing zlib to error on invalid headers.

Changes:
- Classify `.dmg` as `type: 'image'`
- Update `udif` to 0.8.0

Change-Type: patch
Changelog-Entry: Fix Apple disk image detection & streaming
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-15 00:17:41 -04:00
Juan Cruz Viotti
0b500d2585 fix(GUI): correctly log debugging messages on Windows (#1303)
Windows will not react to dynamically set environment variables (e.g:
`process.env.MOUNTUTILS_DEBUG = '1'`), so in order to workaround this
limitation, we set `MOUNTUTILS_DEBUG` in
`lib/child-writer/writer-proxy.js` when spawning the CLI, and we also
set `DEBUG='*'` in `lib/start.js`, so it gets picked up by the child
writer module, which spawns the writer proxy by inheriting the
environment.
2017-04-14 16:41:00 -04:00
Juan Cruz Viotti
ebd2d85de7 upgrade: mountutils to v1.0.5 (#1302)
This version accepts a `MOUNTUTILS_DEBUG` environment variable to make
the module output extra logging information, which we enable in this
commit as well.

See: https://github.com/resin-io-modules/mountutils/pull/25
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 14:59:27 -04:00
Juan Cruz Viotti
c5a9a1fca4 fix(GUI): show a friendly message when the drive is unplugged half-way through (#1301)
This commit shows a user friendly message when Etcher loses access to
the drive while flashing/validating, and prevents the cryptic errors
from getting to Sentry.

See: https://github.com/resin-io-modules/etcher-image-write/pull/96
Change-Type: minor
Changelog-Entry: Show a user friendly message when the drive is unplugged half-way through.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 14:24:06 -04:00
Juan Cruz Viotti
e66d805672 feat(child-writer): log non-robot messages for debugging purposes (#1295)
Currently, if the child writer receives a message from the writer
process that is not a valid robot object, then it will throw an error.

Now, we check if the message is a robot message, and if so, we try to
parse it (throwing errors if its indeed a malformed/incomplete robot
message), however we log it if not.

The main motivation behind this feature is that it will allows us to
print debugging information on the mountutils module, and have it
redirected to DevTools.

Change-Type: minor
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 14:07:00 -04:00
Juan Cruz Viotti
0890b1e369 refactor(GUI): move SupportedFormatsModel to lib/shared (#1251)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-13 14:38:30 -04:00
Juan Cruz Viotti
64c8eb594b refactor(GUI): make OSWindowProgress a simple CommonJS module (#1253)
There is no need to tie this module to Angular by using an Angular
service.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-13 14:38:22 -04:00
Juan Cruz Viotti
68f87435de fix(CLI): throw error if image is inaccessible (#1281)
Consider the following scenario:

- The user selects an image from an external drive
- The user selects a drive
- The user unmounts/ejects the external drive
- The user clicks flash

The application state will contain an image path that is no longer
accessible, causing an ENOENT error when spawning the CLI process.

Change-Type: patch
Changelog-Entry: Display a user error if the image is no longer accessible when the writer starts.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-11 00:59:08 -04:00
Juan Cruz Viotti
cf271100f5 fix(image-stream): throw user error if image is a directory (#1279)
If the user tries to drag and drop a directory to the application, then
he'll get a scary `EISDIR` error message. This commit catches this
error, and display a nice user friendly message instead.

Change-Type: patch
Changelog-Entry: Prevent uncaught `EISDIR` when dropping a directory to the application.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-11 00:34:21 -04:00
Juan Cruz Viotti
44094680fb fix(image-stream): return a path from the handler (#1278)
The `application/x-apple-diskimage` handler doesn't return a path,
causing an issue when fetching the image metadata, and trying using the
path to determine if its a supported image type.

Change-Type: patch
Changelog-Entry: Fix "Path must be a string. Received undefined" when selecting Apple images.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 23:49:22 -04:00
Juan Cruz Viotti
fc46958ac0 fix(image-stream): interpret iso9660 as application/octet-stream (#1277)
This is a regression caused by
https://github.com/resin-io/etcher/pull/1257, which introduced a new way
to detect mime types by using the `mime-types` module.

This module, contrary to `file-type`, will detect certain ISO files as
`application/x-iso9660-image`, which Etcher doesn't know how to handle,
and will therefore should at the user that the format is unsupported.

Change-Type: patch
Changelog-Entry: Don't interpret certain ISO images as unsupported.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 23:49:11 -04:00
Juan Cruz Viotti
f87a690df1 fix(GUI): correctly reference the eta property in lib/gui/app.js (#1273)
See: https://github.com/resin-io/etcher/pull/1264/files#r110662965
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 16:57:20 -04:00
Ștefan Daniel Mihăilă
91a1c3d107 feat(GUI): use resin-corvus in AnalyticsService (#1208)
Change-Type: patch
Changelog-Entry: Start reporting errors to Sentry instead of to TrackJS.
Fixes: https://github.com/resin-io/etcher/issues/1027
2017-04-10 15:06:32 -04:00
Juan Cruz Viotti
1b68e9394b style(shared): fix given that is -> given that it typo (#1272)
See: https://github.com/resin-io/etcher/pull/1262#discussion_r110541438
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 14:36:01 -04:00
Benedict Aas
b28c345ba0 refactor(GUI): remove Angular from FlashStateModel and rename (#1264)
We remove the usage of Angular from 'FlashStateModel' and its usage
throughout the project comes under the new 'flashState' moniker.


Depends: https://github.com/resin-io/etcher/pull/1261
2017-04-10 14:30:21 -04:00
Benedict Aas
19dd2834fb fix(GUI): replace Math object usage in progressButton directive (#1263)
We were using `Math.min` in a progressButton's template expression,
however such object is not exposed to the Angular expression context.
2017-04-10 09:59:13 -04:00
Juan Cruz Viotti
3cdd925c41 refactor: get rid of is-elevated (#1262)
This commit implements our own version of the `is-elevated` module. The
reason behind this is that `is-elevated` relies on lots of unnecessary
modules, that eventually require `spawn-sync` and `try-thread-sleep`,
which conditionally require dependencies that are not even declared in
their `package.json`, causing issues when concatenating the Etcher CLI.

See: https://github.com/resin-io/etcher/pull/1235
See: https://github.com/resin-io/etcher/pull/1228
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-08 20:15:17 -04:00