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>
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>
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>
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.
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>
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.
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.
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.
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>
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.
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>
* 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>
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>
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>
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>
* 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
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>
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
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>
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
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>
`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>
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>
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>
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>
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>
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>
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>
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.
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>
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>