Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for .flock / IronFlock rebranding #12

Merged
merged 23 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
dist
out
*.log*
.DS_Store
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Reflasher
# FlockFlasher

All you need to debug the application is:

Expand All @@ -16,7 +16,7 @@ The machine itself should do the rest.

On Github, it should automatically create a release entry in the list with the latest version string.

[Releases](https://github.com/RecordEvolution/Reflasher/releases)
[Releases](https://github.com/RecordEvolution/FlockFlasher/releases)

Before putting the release public, make sure that all releases have been pushed for all devices.

Expand All @@ -29,19 +29,19 @@ In other words, you have to manually stitch both files together as follows:
```
version: 2.0.3
files:
- url: Reflasher-2.0.3-mac.zip
- url: FlockFlasher-2.0.3-mac.zip
sha512: pfNijx9AZuFEzN7/UTDhoKlKeG72A+c3EdGoBE+X6fyn7nO1ZO8McNcZFaExbO0RhN+svnqF6JrWPenIKEfdSQ==
size: 133448877
- url: Reflasher-2.0.3-arm64-mac.zip
- url: FlockFlasher-2.0.3-arm64-mac.zip
sha512: 8XOTrqvnGfmM1V9MAivyQ9BPbWyqtkTQ16pZAzSCRUwgLTtRswJZJ0cHIqYw1+6+yRWFdIgQXt1cu6YWkUpWzg==
size: 128751915
- url: reflasher-x64.dmg
- url: flockflasher-x64.dmg
sha512: b9XzDuF/+c3JCA/LLFciLUqyOw12xHmh0vZkZpvS6V8GCzFmz1maEXOkBYAYv9YQLcxhGaM0aMMVuQNiWHgjGg==
size: 138481744
- url: reflasher-arm64.dmg
- url: flockflasher-arm64.dmg
sha512: jFZIxhz615EI2autjm4wnKOLGZchSKNOd3zmlRMFXdQjFEIZz6C8szgzjlYyzCfYH5hPOc+EQgbDVPIOla3Zew==
size: 133845710
path: Reflasher-2.0.3-mac.zip
path: FlockFlasher-2.0.3-mac.zip
sha512: pfNijx9AZuFEzN7/UTDhoKlKeG72A+c3EdGoBE+X6fyn7nO1ZO8McNcZFaExbO0RhN+svnqF6JrWPenIKEfdSQ==
releaseDate: '2024-01-10T13:54:20.948Z'
```
Expand All @@ -58,15 +58,15 @@ After that, the `npm run release` process will automatically notarize the app fo

## EtcherSDK

Reflasher uses the etcher-sdk to flash and mount drives.
FlockFlasher uses the etcher-sdk to flash and mount drives.

The `etcher-sdk` requires root permissions to access drives and flash drives.

In the current build for MacOS and Linux, we must spawn a subprocess within the Reflasher that gets elevated.
In the current build for MacOS and Linux, we must spawn a subprocess within the FlockFlasher that gets elevated.

The easiest way to do that is to spawn a root process using sudo. This process will be a node process that runs the `etcher-sdk` code.

To do so, we create an external JavaScript script that uses the `etcher-sdk`. This script needs to point to the node_modules that are contained within the application (for production). To do so, we point to the compressed (ASAR) node_modules [in the code](https://github.com/RecordEvolution/Reflasher/blob/3400ca34a438af2653ee1dfc364cd3f066cdc7fd/src/main/api/flash.ts#L121).
To do so, we create an external JavaScript script that uses the `etcher-sdk`. This script needs to point to the node_modules that are contained within the application (for production). To do so, we point to the compressed (ASAR) node_modules [in the code](https://github.com/RecordEvolution/FlockFlasher/blob/3400ca34a438af2653ee1dfc364cd3f066cdc7fd/src/main/api/flash.ts#L121).


To learn more about the compressed ASAR package: https://www.electronjs.org/docs/latest/tutorial/asar-archives
Expand All @@ -76,22 +76,22 @@ Since we don't want to rely on the user having the `node` binary installed, we c

The electron binary can be accessed on `process.execPath` within the application and can be put into 'node mode' using the `ELECTRON_RUN_AS_NODE` environment variable.

Since we spawn a subprocess, we need to be able to read back the flashing progress of this subprocess. To do so, we print the progress data to the stdout in JSON string, which is then read and parsed in the frontend. ([Line in code](https://github.com/RecordEvolution/Reflasher/blob/3400ca34a438af2653ee1dfc364cd3f066cdc7fd/src/main/api/flash.ts#L154))
Since we spawn a subprocess, we need to be able to read back the flashing progress of this subprocess. To do so, we print the progress data to the stdout in JSON string, which is then read and parsed in the frontend. ([Line in code](https://github.com/RecordEvolution/FlockFlasher/blob/3400ca34a438af2653ee1dfc364cd3f066cdc7fd/src/main/api/flash.ts#L154))


### Windows

In order to access the USB drives in Windows, the `etcher-sdk` must include the `winusb-driver-generator` package. When running the `npm i` command on Windows, it will automatically and temporarily add this package using the `scripts/windows.js` script.

In order for Gulp to be able to build the Reflasher on Windows, it must compile the underlying winusb driver.
In order for Gulp to be able to build FlockFlasher on Windows, it must compile the underlying winusb driver.

Before you can do this, you must have the [Windows Driver Kit](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) (WDK) installed.

There's a known issue where the `WDF redistributable co-installers don't work`, which is required in order to build the windows usb driver. Solutions can be found [here](https://learn.microsoft.com/en-us/windows-hardware/drivers/wdk-known-issues).

### AppImages (Linux)

For AppImages, it is sadly not straightforward to access the packaged node_modules within the application. Since the AppImage is technically a drive, we must first mount it to a temporary folder ([link to code](https://github.com/RecordEvolution/Reflasher/blob/3400ca34a438af2653ee1dfc364cd3f066cdc7fd/src/main/api/permissions.ts#L169)) and then access the packaged node modules within.
For AppImages, it is sadly not straightforward to access the packaged node_modules within the application. Since the AppImage is technically a drive, we must first mount it to a temporary folder ([link to code](https://github.com/RecordEvolution/FlockFlasher/blob/3400ca34a438af2653ee1dfc364cd3f066cdc7fd/src/main/api/permissions.ts#L169)) and then access the packaged node modules within.


## Electron / Vue
Expand Down
Binary file modified build/icon.icns
Binary file not shown.
Binary file modified build/icon.ico
Binary file not shown.
Binary file modified build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions dev-app-update.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
provider: github
owner: RecordEvolution
repo: Reflasher
updaterCacheDirName: reflasher-updater
repo: FlockFlasher
updaterCacheDirName: flockflasher-updater
26 changes: 17 additions & 9 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
appId: com.recordevolution.reflasher
productName: Reflasher
appId: com.recordevolution.flockflasher
productName: FlockFlasher
afterSign: './scripts/notarize.js'
directories:
buildResources: build
Expand All @@ -13,13 +13,13 @@ files:
asarUnpack:
- resources/**
win:
executableName: Reflasher
executableName: FlockFlasher
requestedExecutionLevel: requireAdministrator
publish:
provider: github
owner: RecordEvolution
repo: Reflasher
updaterCacheDirName: reflasher-updater
repo: FlockFlasher
updaterCacheDirName: flockflasher-updater
nsis:
artifactName: ${name}-setup.${ext}
shortcutName: ${productName}
Expand All @@ -38,8 +38,8 @@ mac:
publish:
provider: github
owner: RecordEvolution
repo: Reflasher
updaterCacheDirName: reflasher-updater
repo: FlockFlasher
updaterCacheDirName: flockflasher-updater
dmg:
artifactName: ${name}-${arch}.${ext}
linux:
Expand All @@ -48,16 +48,24 @@ linux:
publish:
provider: github
owner: RecordEvolution
repo: Reflasher
updaterCacheDirName: reflasher-updater
repo: FlockFlasher
updaterCacheDirName: flockflasher-updater
appImage:
artifactName: ${name}.${ext}
npmRebuild: false
protocols:
- name: ironflock-protocol
schemes:
- flock
- name: reswarm-protocol
schemes:
- reswarm
fileAssociations:
- ext: flock
description: IronFlock Device File
icon: src/assets/icons/icon.icns
mimeType: text/x-reswarm
role: Viewer
- ext: reswarm
description: Reswarm Device File
icon: src/assets/icons/icon.icns
Expand Down
42 changes: 37 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reflasher",
"version": "2.0.3",
"name": "flockflasher",
"version": "2.1.0",
"description": "An efficient, modern and reliable flashing tool for IoT applications",
"author": "Record Evolution GmbH",
"publisher": "Record Evolution GmbH",
Expand All @@ -19,7 +19,8 @@
"release": "electron-builder",
"build": "npm run typecheck && electron-vite build",
"build:win": "npm run build && electron-builder --win --config",
"build:mac": "npm run build && electron-builder --mac --config",
"build:mac": "npm run build && electron-builder --mac --config --x64",
"build:macm1": "npm run build && electron-builder --mac --config",
"build:linux": "npm run build && electron-builder --linux --config"
},
"dependencies": {
Expand Down
Binary file modified resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ exports.default = async function notarizing(context) {

const appName = context.packager.appInfo.productFilename

console.log('Notarizing Reflasher app....')
console.log('Notarizing FlockFlasher app....')
return await notarize({
tool: 'notarytool',
teamId: '9D2S7J8B4D',
appBundleId: 'com.recordevolution.reflasher',
appBundleId: 'com.recordevolution.flockflasher',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS
Expand Down
Binary file added src/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions src/assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/icons/icon.icns
Binary file not shown.
Binary file modified src/assets/icons/icon.ico
Binary file not shown.
Binary file modified src/assets/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/logo.png
Binary file not shown.
Loading