Share File Systems - Electron and Tauri
July 21, 2022 ยท View on GitHub
Electron and Tauri are application shells that allow executing web applications as desktop applications using a minimized browser for the visual rendering plus an internal Node.js instance. All instructions below assume the current command shell is in the project root directory.
Tauri
Tauri is a Rust language based alternative to the more popular Electron. Tauri is designed principly for security and binary portability, which it requires a much greater setup effort to execute without an operating system installer.
- Install Rust language from [https://www.rust-lang.org/tools/install] or if already installed execute
rustup updateandcargo upgrade. - See the Tauri Getting Started page for application specific setup criteria.
- Execute
npm tauri initto create the configuration file and development binaries. Supply these values to the 4 setup questions:share-file-systemsShare File Systems./https://localhost
- Execute
npm startto launch the application.
Tauri Notes
- The Tauri application is a bit slow to open so allow about 20 seconds after executing
npm start. - The Tauri configuration can be modified, including the 4 criteria mentioned above, by supplying changes to the new file at
src-tauri/tauri.conf.json. It might be more comfortable to change the default window size to a width of 1200 and a height of 900.
Electron
Electron is the oldest and most popular web to desktop wrapper currently maintained.
Electron Compatibility
At the time of this writing the application is not fully compatible with Electron due to outdated cryptography in Electron from what this application requires.
Node.js uses the OpenSSL library for cryptography while Electron uses a Google maintained fork of OpenSSL called BoringSSL.
BoringSSL makes available only a few types of hash algorithms which does not include the SHA3 family.
This application sets a default preference for the algorithm SHA3-512.
This application might work with Electron if the default hash algorithm were changed to SHA-512, which is specified as settings.hashName in the file lib/terminal/utiliities/vars.ts.
- Execute
node module.mjs commonjsto convert this application's preferences to the CommonJS module system as required by Electron. - Modify the
package.jsonfile:- Add
"electron": "x.x.x"to the list of devDependency. - Change the value of
scripts.startto"electron js/lib/electron.js".
- Add
- Execute
node installto install the Electron code and rebuild the application using the CommonJS module system. - Execute
npm startto launch the application.
Browser
The application's build process is designed to execute in the terminal/browser using either CommonJS or ECMA module systems as compiled by either TypeScript's compiler or the faster SWC compiler. The application preferences ECMA modules though for the compiled JavaScript because it most similar to the TypeScript source code, which eases development and troubleshooting.
The command to execute the application for the terminal/browser is share, but follow these steps to completely reset the compiled code back to default:
node module.mjs standardnode install no_packageshare