summaryrefslogtreecommitdiff
path: root/desktop/README.md
blob: 78c33571d4794afe1dc2f7a98afda5ef14d0c5d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# OnionShare Desktop

## Building OnionShare

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

```sh
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](https://support.torproject.org/apt/tor-deb-repo/), 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:

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

OnionShare uses [Briefcase](https://briefcase.readthedocs.io/en/latest/).

Install Briefcase dependencies by following [these instructions](https://docs.beeware.org/en/latest/tutorial/tutorial-0.html#install-dependencies).

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:

```sh
pip install pytest pytest-briefcase pytest-faulthandler pytest-qt
```

Then run the tests:

```sh
./tests/run.sh
```

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

```sh
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](https://snapcraft.io/). First make sure you install `snap` and `snapcraft` (`snap install snapcraft --classic`).

To build the snap, run:

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

See your installed snaps:

```sh
snap list
```

Run the OnionShare snap:

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

Delete the OnionShare snap:

```sh
snap remove onionshare
```

### Linux

Build a wheel package for OnionShare CLI:

```sh
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`:

```sh
. venv/bin/activate
briefcase create
briefcase build
```

### Windows

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

```sh
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`:

```sh
venv\Scripts\activate.bat
briefcase create
briefcase package
```

TODO: Codesign