update docs for building electron app and remove old method

This commit is contained in:
liamcottle
2024-05-27 21:35:00 +12:00
parent ec92e458e6
commit 9fb1d209eb
5 changed files with 11 additions and 48 deletions

View File

@@ -124,12 +124,19 @@ python web.py --identity-base64 "GCN6mMhVemdNIK/fw97C1zvU17qjQPFTXRBotVckeGmoOwQ
> NOTE: this is a randomly generated identity for example purposes. Do not use it, it has been leaked!
## Build from Source
## Build Electron Application
- `build_macos.sh` - Builds a `.dmg` containing a `.app`
- `build_windows.bat` - Builds a `.msi` Windows Installer
Reticulum WebChat can be run via a command line, as explained above, or as a standalone Electron app.
> Note: `build_macos.sh` must be run on a Mac, and `build_windows.bat` must be run on a Windows PC.
To run as a standalone application, we need to compile the python application to an executable with [cxfreeze](https://github.com/marcelotduarte/cx_Freeze) and then build an [electron](https://www.electronjs.org/) app which includes a bundled browser that can interact with the compiled python executable.
To build a `.dmg` containing a `.app` for Mac, run the following:
```
npm run dist
```
> Note: cxfreeze only supports building an executable for the current platform. You will need a Mac to build for Mac, and a Windows PC to build for Windows.
## TODO

View File

@@ -1,9 +0,0 @@
#!/bin/sh
# ensure macos/ReticulumWebChat.sh is executable before the cxfreeze copies it inside the .app
chmod +x macos/ReticulumWebChat.sh
# build macos .app and put in .dmg
python setup.py bdist_dmg
# todo codesign?

View File

@@ -1,23 +0,0 @@
#!/bin/sh
# references for making a macOS .app that runs a shell script
# https://apple.stackexchange.com/a/407885
# https://github.com/Whisky-App/Whisky/issues/107#issuecomment-1592934039
# https://stackoverflow.com/a/71875958
# https://stackoverflow.com/a/5756763
# get path to directory where this script is currently executing from
# we are expecting this to be "ReticulumWebChat.app/Contents/MacOS"
ABSPATH=$(cd "$(dirname "$0")"; pwd -P)
# path to the actual executable that we want to run as a console application (via Terminal)
EXE="$ABSPATH/ReticulumWebChat"
# open actual executable in terminal
# we also provide a custom storage dir within the user home directory
osascript -e "
tell app \"Terminal\"
do script \"$EXE --storage-dir ~/.reticulum-webchat; exit $?\"
activate
end tell
"

View File

Binary file not shown.

View File

@@ -43,17 +43,5 @@ setup(
# use a static upgrade code to allow installer to remove existing files on upgrade
'upgrade_code': '{6c69616d-ae73-460c-88e8-399b3134134e}',
},
'bdist_mac': {
'bundle_name': 'ReticulumWebChat', # creates ReticulumWebChat.app
'iconfile': 'macos/icon.icns',
'include_resources': [
# we use this script to launch as a terminal app
('macos/ReticulumWebChat.sh', '../MacOS/ReticulumWebChat.sh'),
],
'plist_items': [
# we want ReticulumWebChat.app to execute ReticulumWebChat.sh instead of the python binary, as we need to launch it via terminal
('CFBundleExecutable', 'ReticulumWebChat.sh'),
],
},
},
)