Start adding documentation into the source tree

This commit is contained in:
Micah Lee 2020-08-23 22:52:43 -04:00
parent ddf1532eed
commit 50dbe20270
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
12 changed files with 2556 additions and 1 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ __pycache__
dist
deb_dist
build
_build
eggs
parts
var

View File

@ -9,6 +9,7 @@
* [To make a .exe](#to-make-a-exe)
* [To build the installer](#to-build-the-installer)
* [Running tests](#running-tests)
* [Documentation]
* [Making releases](#making-releases)
* [Changelog, version, and signed git tag](#changelog-version-and-signed-git-tag)
* [Linux release](#linux-release)
@ -290,6 +291,23 @@ You can also choose to wrap the tests in `xvfb-run` so that a ton of OnionShare
xvfb-run poetry run ./tests/run.sh --rungui
```
# Documentation
To edit and build the documentation, you'll need these:
```sh
pip3 install --user sphinx
```
To test te documentation:
```sh
cd docs
make html
```
Then open `docs/build/html/index.html` in a browser to see it.
# Making releases
This section documents the release process. Unless you're a core OnionShare developer making a release, you'll probably never need to follow it.

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

35
docs/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

2154
docs/source/_static/logo.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 157 KiB

15
docs/source/advanced.rst Normal file
View File

@ -0,0 +1,15 @@
Advanced Usage
==============
Save Tabs
---------
Disable Passwords
-----------------
Scheduled Times
---------------
Legacy Addresses
----------------

62
docs/source/conf.py Normal file
View File

@ -0,0 +1,62 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = "OnionShare"
copyright = "2020, Micah Lee"
author = "Micah Lee"
# The full version, including alpha/beta/rc tags
release = "2.3"
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
html_theme_options = {
"description": "An open source tool that lets you securely and anonymously share files, host websites, and chat with friends using the Tor network",
"github_user": "micahflee",
"github_repo": "onionshare",
"fixed_sidebar": True,
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

173
docs/source/develop.rst Normal file
View File

@ -0,0 +1,173 @@
Developing OnionShare
=====================
Collaborating
-------------
OnionShare has an open Keybase team that we use to discuss the project, including asking questions, sharing ideas and designs, and making plans for future development. (It's also an easy way to send end-to-end encrypted direct messages to others in the OnionShare community, like OnionShare addresses.) To use Keybase, you need to download the `Keybase app <https://keybase.io/download>`_, make an account, and `join this team <https://keybase.io/team/onionshare>`_. Within the app, go to Teams, click "Join a Team", and type "onionshare".
OnionShare also has a `mailing list <https://lists.riseup.net/www/subscribe/onionshare-dev>`_ for developers and and designers to discuss the project.
Contributing Code
-----------------
OnionShare source code is in this git repository: https://github.com/micahflee/onionshare
If you'd like to contribute code to OnionShare, it helps to join the Keybase team and ask questions about what you're thinking of working on. You should also review all of the `open issues <https://github.com/micahflee/onionshare/issues>`_ on GitHub to see if there are any that you'd like to develop.
When you're ready to contribute code, open a pull request in the GitHub repository and one of the project maintainers will review it and possible ask questions, request changes, reject it, or merge it into the project.
Starting Development
--------------------
OnionShare is developed in Python. To get started, you should close the git repository at https://github.com/micahflee/onionshare/ and then consult the ``BUILD.md`` file.
That file contains the technical instructions and commands necessary:
* Install dependencies for your platform
* Run OnionShare from the source tree, without building a package
* Building packages
* Making a release of OnionShare
Debugging Tips
--------------
Verbose Mode
^^^^^^^^^^^^
When developing, it's convenient to run OnionShare from a terminal and add the ``--verbose`` (or ``-v``) flag to the command. This will print a lot of helpful messages to the terminal such as when certain objects are initialized, when events occur (like buttons clicked, settings saved or reloaded), and other debug information. For example::
$ poetry run ./dev_scripts/onionshare -v test.txt
OnionShare 2.3 | https://onionshare.org/
@@@@@@@@@
@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ___ _
@@@@@@ @@@@@@@@@@@@@ / _ \ (_)
@@@@ @ @@@@@@@@@@@ | | | |_ __ _ ___ _ __
@@@@@@@@ @@@@@@@@@@ | | | | '_ \| |/ _ \| '_ \
@@@@@@@@@@@@ @@@@@@@@@@ \ \_/ / | | | | (_) | | | |
@@@@@@@@@@@@@@@@ @@@@@@@@@ \___/|_| |_|_|\___/|_| |_|
@@@@@@@@@ @@@@@@@@@@@@@@@@ _____ _
@@@@@@@@@@ @@@@@@@@@@@@ / ___| |
@@@@@@@@@@ @@@@@@@@ \ `--.| |__ __ _ _ __ ___
@@@@@@@@@@@ @ @@@@ `--. \ '_ \ / _` | '__/ _ \
@@@@@@@@@@@@@ @@@@@@ /\__/ / | | | (_| | | | __/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \____/|_| |_|\__,_|_| \___|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@
@@@@@@@@@
[Aug 23 2020 22:37:06] Settings.__init__
[Aug 23 2020 22:37:06] Settings.load
[Aug 23 2020 22:37:06] Settings.load: Trying to load /home/user/.config/onionshare/onionshare.json
[Aug 23 2020 22:37:06] ModeSettings.load: creating /home/user/.config/onionshare/persistent/opacity-joining-sappiness.json
[Aug 23 2020 22:37:06] ModeSettings.set: updating opacity-joining-sappiness: general.public = False
[Aug 23 2020 22:37:06] ModeSettings.set: updating opacity-joining-sappiness: general.autostart_timer = 0
[Aug 23 2020 22:37:06] ModeSettings.set: updating opacity-joining-sappiness: general.autostop_timer = 0
[Aug 23 2020 22:37:06] ModeSettings.set: updating opacity-joining-sappiness: general.legacy = False
[Aug 23 2020 22:37:06] ModeSettings.set: updating opacity-joining-sappiness: general.client_auth = False
[Aug 23 2020 22:37:06] ModeSettings.set: updating opacity-joining-sappiness: share.autostop_sharing = True
[Aug 23 2020 22:37:06] Web.__init__: is_gui=False, mode=share
[Aug 23 2020 22:37:06] Web.generate_static_url_path: new static_url_path is /static_4kanwd4mt5mcqmpsbptviv3tbq
[Aug 23 2020 22:37:06] ShareModeWeb.init
[Aug 23 2020 22:37:06] Onion.__init__
[Aug 23 2020 22:37:06] Onion.connect
[Aug 23 2020 22:37:06] Settings.__init__
[Aug 23 2020 22:37:06] Settings.load
[Aug 23 2020 22:37:06] Settings.load: Trying to load /home/user/.config/onionshare/onionshare.json
[Aug 23 2020 22:37:06] Onion.connect: tor_data_directory_name=/home/user/.config/onionshare/tmp/tmpig895mfl
Connecting to the Tor network: 14% - Handshaking with a relay
Connecting to the Tor network: 25% - Asking for networkstatus consensus
Connecting to the Tor network: 30% - Loading networkstatus consensus
Connecting to the Tor network: 40% - Loading authority key certs
Connecting to the Tor network: 45% - Asking for relay descriptors
Connecting to the Tor network: 50% - Loading relay descriptors
Connecting to the Tor network: 59% - Loading relay descriptors
Connecting to the Tor network: 68% - Loading relay descriptors
Connecting to the Tor network: 89% - Finishing handshake with a relay to build circuits
Connecting to the Tor network: 95% - Establishing a Tor circuit
Connecting to the Tor network: 100% - Done
[Aug 23 2020 22:37:14] Onion.connect: Connected to tor 0.4.3.6
[Aug 23 2020 22:37:14] Settings.load
[Aug 23 2020 22:37:14] Settings.load: Trying to load /home/user/.config/onionshare/onionshare.json
[Aug 23 2020 22:37:14] Web.generate_password: saved_password=None
[Aug 23 2020 22:37:14] Web.generate_password: built random password: "barrel-unseated"
[Aug 23 2020 22:37:14] OnionShare.__init__
[Aug 23 2020 22:37:14] OnionShare.start_onion_service
[Aug 23 2020 22:37:14] Onion.start_onion_service: port=17605
[Aug 23 2020 22:37:14] Onion.start_onion_service: key_type=NEW, key_content=ED25519-V3
[Aug 23 2020 22:37:16] ModeSettings.set: updating opacity-joining-sappiness: general.service_id = ttxidvsv4pqzrarvtlojk435vver6wgifrw4pucyzgj2hb3qu6pf6fqd
[Aug 23 2020 22:37:16] ModeSettings.set: updating opacity-joining-sappiness: onion.private_key = IGzO65Mi9grG7HlLD9ky82O/vWvu3WVByTqCLpZgV0iV2XaSDAqWazNHKkkP18/7jyZZyXwbLo4qOCiYLudlRA==
Compressing files.
[Aug 23 2020 22:37:16] ShareModeWeb.init
[Aug 23 2020 22:37:16] ShareModeWeb.set_file_info_custom
[Aug 23 2020 22:37:16] ShareModeWeb.build_zipfile_list
[Aug 23 2020 22:37:16] Web.start: port=17605
* Running on http://127.0.0.1:17605/ (Press CTRL+C to quit)
Give this address to the recipient:
http://onionshare:barrel-unseated@ttxidvsv4pqzrarvtlojk435vver6wgifrw4pucyzgj2hb3qu6pf6fqd.onion
Press Ctrl+C to stop the server
You can add your own debug messages by running the ``Common.log`` method from ``onionshare/common.py``. For example::
common.log('OnionShareGui', 'start_server', 'I ran here')
This can be useful when learning the chain of events that occur when using the application or the value of certain variables before and after they are manipulated.
Local Only
^^^^^^^^^^
Tor is slow, and it's often convenient to skip starting onion services altogether during development. You can do this with the ``--local-only`` flag. For example::
$ poetry run ./dev_scripts/onionshare --local-only --receive
OnionShare 2.3 | https://onionshare.org/
@@@@@@@@@
@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ___ _
@@@@@@ @@@@@@@@@@@@@ / _ \ (_)
@@@@ @ @@@@@@@@@@@ | | | |_ __ _ ___ _ __
@@@@@@@@ @@@@@@@@@@ | | | | '_ \| |/ _ \| '_ \
@@@@@@@@@@@@ @@@@@@@@@@ \ \_/ / | | | | (_) | | | |
@@@@@@@@@@@@@@@@ @@@@@@@@@ \___/|_| |_|_|\___/|_| |_|
@@@@@@@@@ @@@@@@@@@@@@@@@@ _____ _
@@@@@@@@@@ @@@@@@@@@@@@ / ___| |
@@@@@@@@@@ @@@@@@@@ \ `--.| |__ __ _ _ __ ___
@@@@@@@@@@@ @ @@@@ `--. \ '_ \ / _` | '__/ _ \
@@@@@@@@@@@@@ @@@@@@ /\__/ / | | | (_| | | | __/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \____/|_| |_|\__,_|_| \___|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@
@@@@@@@@@
* Running on http://127.0.0.1:17614/ (Press CTRL+C to quit)
Files sent to you appear in this folder: /home/user/OnionShare
Warning: Receive mode lets people upload files to your computer. Some files can potentially take control of your computer if you open them. Only open things from people you trust, or if you know what you are doing.
Give this address to the sender:
http://onionshare:eject-snack@127.0.0.1:17614
Press Ctrl+C to stop the server
In this case, you load the URL ``http://onionshare:eject-snack@127.0.0.1:17614`` in a normal web browser like Firefox, instead of using Tor Browser.
Debugging in Windows
^^^^^^^^^^^^^^^^^^^^
If you want to obtain debug output from the ``onionshare-gui.exe`` in Windows, you will need to edit ``install\pyinstaller.spec`` and change ``console=False`` to ``console=True``.
Then rebuild the EXE with ``install\build_exe.bat`` (you may need to comment out the ``signtool`` commands in the ``build_exe.bat`` and the ``onionshare.nsi`` files, as per the ``BUILD.md`` instructions).
After this, you can run ``onionshare-gui.exe -v`` from a command prompt to see the debug output.

View File

@ -0,0 +1,37 @@
How it Works
============
OnionShare works by starting web servers locally on your own computer (at ``127.0.0.1`` on a random port between 17600 and 17650), and then making them accessible to other people as a `Tor <https://www.torproject.org/>`_ `onion service <https://community.torproject.org/onion-services/>`_.
By default, OnionShare web addresses are password protected. The username is always ``onionshare`` and the password is randomly generated. For example, a typical OnionShare address might look something like this::
http://onionshare:constrict-purity@by4im3ir5nsvygprmjq74xwplrkdgt44qmeapxawwikxacmr3dqzyjad.onion
In this case, the Tor onion address is ``by4im3ir5nsvygprmjq74xwplrkdgt44qmeapxawwikxacmr3dqzyjad.onion`` -- this is random, and each time you use OnionShare you'll get a different onion address. The username is ``onionshare`` and the random password is ``constrict-purity``.
The OnionShare user is responsible for securely sharing that URL with their audience using a communication channel of their choice such as in an encrypted chat message, or something less secure like a Twitter or Facebook message, depending on their threat model.
The members of the audience must use `Tor Browser <https://www.torproject.org/>`_ to load the URL and access the OnionShare service.
With OnionShare, *your own computer is the web server*. If you start an OnionShare service and send the URL to someone, you must keep your computer turned on and connected to the internet or else the service will go down. Because of this, OnionShare is most useful if it's used in real-time.
For example, if a user runs OnionShare on their laptop to send someone files, and then suspends their laptop before the files have been downloaded, the service will not be available until the laptop is unsuspended and connected to the internet again.
Because your own computer is the web server, *no third party can access anything that happens in OnionShare*, not even the developers of OnionShare. It's completely private. And because OnionShare is based on Tor onion services too, it also protects your anonymity. See the :doc:`security design </security>` for more information.
Connecting to Tor
-----------------
Share Files
-----------
You can use OnionShare to securely and anonymously send files and folders to people. Just open OnionShare, drag in the files and folders you wish to share, and click "Start sharing".
Receive Files
-------------
Host a Website
--------------
Chat Anonymously
----------------

18
docs/source/index.rst Normal file
View File

@ -0,0 +1,18 @@
How to Use OnionShare
=====================
.. image:: _static/logo.svg
:height: 200px
:width: 200px
Getting Started
---------------
.. toctree::
:maxdepth: 2
install
how_it_works
advanced
security
develop

19
docs/source/install.rst Normal file
View File

@ -0,0 +1,19 @@
Installing OnionShare
=====================
Windows and macOS
-----------------
You can always get the latest version of OnionShare for Windows and macOS from `onionshare.org <https://onionshare.org/>`_.
You can find old versions of OnionShare for Windows and macOS from https://onionshare.org/dist/.
Linux
-----
Many Linux distributions come with OnionShare in their package repositories. You can use these if you want, but they might be old.
If you want to make sure you have the latest version with support for the most features, you should use the Flatpak package. The Flatpak package is also more secure because it always uses the most up-to-date dependencies and runs OnionShare inside of a sandbox.
**To install OnionShare using Flatpak:** Make sure you have ``flatpak`` installed and the Flathub repository added by following `these instructions <https://flatpak.org/setup/>`_ for your Linux distribution. Then install OnionShare from Flathub by following `the instructions here <https://flathub.org/apps/details/org.onionshare.OnionShare>`_.

3
docs/source/security.rst Normal file
View File

@ -0,0 +1,3 @@
Security Design
===============