onionshare/desktop
2020-11-03 21:48:22 -08:00
..
install Merge branch '1111_snap' into briefcase-snap 2020-11-03 19:37:05 -08:00
screenshots Add onionshare CLI to cli folder, move GUI to desktop folder, and start refactoring it to work with briefcase 2020-10-12 22:40:55 -07:00
scripts Put tor binaries in desktop app resources, not cli resources, and fix Windows packaging 2020-10-15 19:09:46 -07:00
src Make snapcraft packaging work with briefcase refactor 2020-11-03 21:48:22 -08:00
tests Load onionshare_cli from source tree instead of pip dependency, and start making tests work with PySide2 2020-10-14 20:17:08 -07:00
.gitignore Move docs back to root, move onionshare_gui into briefcase app, and make modifications so briefcase app will work 2020-10-13 17:28:54 -07:00
pyproject.toml Make onionshare_cli an actual dependency of the GUI version 2020-10-15 16:30:30 -07:00
README.md Make snapcraft packaging work with briefcase refactor 2020-11-03 21:48:22 -08:00

OnionShare Desktop

Building OnionShare

Start by getting the source code and changing to the desktop folder:

git clone https://github.com/micahflee/onionshare.git
cd onionshare/desktop

Install platform-specific dependencies

Linux

If you're using Linux, install tor and obfs4proxy from either the official Debian repository, or from your package manager.

macOS

Windows

These instructions include adding folders to the path in Windows. To do this, go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path. From there you can add and remove folders that are available in the PATH.

Download Python 3.8.6, 32-bit (x86) from https://www.python.org/downloads/release/python-386/. I downloaded python-3.8.6.exe. When installing it, make sure to check the "Add Python 3.8 to PATH" checkbox on the first page of the installer.

Download and install 7-Zip from http://www.7-zip.org/download.html. I downloaded 7z1900.exe. Add C:\Program Files (x86)\7-Zip to your path.

Download Tor Browser and extract the binaries by running:

pip install requests
python scripts\get-tor-windows.py

Prepare the code

In order to work with the desktop app, you'll need to build a wheel of the CLI package first, and copy it into the desktop folder:

cd ../cli
poetry install
poetry build
cp dist/onionshare_cli-*.whl ../desktop
cd ../desktop

OnionShare uses Briefcase.

Install Briefcase dependencies by following these instructions.

Now create and/or activate a virtual environment.

  • Linux and macOS
    python3 -m venv venv
    . venv/bin/activate
    
  • Windows
    python -m venv venv
    venv\Scripts\activate.bat
    

While your virtual environment is active, install briefcase from pip.

pip install briefcase

Run OnionShare from the source tree like this:

briefcase dev -d

Running tests

Install these packages inside your virtual environment:

pip install pytest pytest-briefcase pytest-faulthandler pytest-qt

Then run the tests:

./tests/run.sh

If you want to run tests while hiding the GUI, you must have the xvfb package installed, and then:

xvfb-run ./tests/run.sh

Making a release

Before making a release, update the version in these places:

  • pyproject.toml
  • src/setup.py

Flatpak packaging

See: https://github.com/micahflee/org.onionshare.OnionShare

Snapcraft packaging

This folder contains files to build a snap package. First make sure you install snap and snapcraft (snap install snapcraft --classic).

To build the snap, run:

snapcraft
snap install --devmode ./onionshare_*.snap

See your installed snaps:

snap list

Run the OnionShare snap:

/snap/bin/onionshare     # GUI version
/snap/bin/onionshare.cli # CLI version

Delete the OnionShare snap:

snap remove onionshare

Linux

Build a wheel package for OnionShare CLI:

cd onionshare/cli
poetry install
poetry build

This will make a file like dist/onionshare_cli-$VERSION-py3-none-any.whl (except with your specific version number). Move it into ../desktop/linux:

mkdir -p ../desktop/linux
mv dist/onionshare_cli-*-py3-none-any.whl ../desktop/linux
# change back to the desktop directory
cd ../desktop

Make sure the virtual environment is active, and then run briefcase create and briefcase build:

. venv/bin/activate
briefcase create
briefcase build

Windows

Build a wheel package for OnionShare CLI (including Tor binaries, from Tor Browser):

cd onionshare\cli
poetry install
poetry build

This will make a file like dist\onionshare_cli-$VERSION-py3-none-any.whl (except with your specific version number). Move it into ..\desktop:

move dist\onionshare_cli-*-py3-none-any.whl ..\desktop
cd ..\desktop

Make sure the virtual environment is active, and then run briefcase create:

venv\Scripts\activate.bat
briefcase create
briefcase package

TODO: Codesign