2022-02-26 10:57:37 +09:00
|
|
|
# anonstream
|
2021-04-10 02:10:22 +09:00
|
|
|
|
2022-02-26 10:57:37 +09:00
|
|
|
Recipe for livestreaming over Tor
|
|
|
|
|
|
|
|
## Repo
|
|
|
|
|
2022-03-07 23:51:59 +09:00
|
|
|
The canonical location of this repo is
|
|
|
|
<https://git.076.ne.jp/ninya9k/anonstream>.
|
2022-02-26 10:57:37 +09:00
|
|
|
|
|
|
|
These mirrors also exist:
|
2022-03-07 23:51:59 +09:00
|
|
|
* <https://gitlab.com/ninya9k/anonstream>
|
|
|
|
* <https://github.com/ninya9k/anonstream>
|
2022-03-07 14:39:06 +09:00
|
|
|
|
2022-03-08 12:38:23 +09:00
|
|
|
## Setup
|
|
|
|
|
2022-06-16 09:48:27 +09:00
|
|
|
You must have Python 3.10 at a minimum. You can check your version of Python
|
|
|
|
with `python --version`.
|
2022-03-08 12:38:23 +09:00
|
|
|
|
|
|
|
Clone the repo:
|
|
|
|
```sh
|
|
|
|
git clone https://git.076.ne.jp/ninya9k/anonstream.git
|
|
|
|
cd anonstream
|
|
|
|
```
|
|
|
|
|
|
|
|
Install dependencies in a virtual environment:
|
|
|
|
```sh
|
|
|
|
python -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
python -m pip install -r requirements.txt
|
|
|
|
```
|
|
|
|
|
2022-06-16 09:48:27 +09:00
|
|
|
Before you run it you may want to edit the config ([/config.toml][config]).
|
|
|
|
Most of the defaults are probably okay, but here are some that you might want
|
|
|
|
to know what they do:
|
2022-03-08 12:38:23 +09:00
|
|
|
|
|
|
|
* `secret_key`:
|
2022-06-16 09:48:27 +09:00
|
|
|
used for cryptography, make it any long random string (e.g.
|
|
|
|
`$ dd if=/dev/urandom bs=16 count=1 | base64`), definitely set this
|
|
|
|
yourself before running in "production" (whatever that is for you)
|
2022-03-08 12:38:23 +09:00
|
|
|
|
|
|
|
* `segments/directory`:
|
|
|
|
directory containing stream segments, the default is `stream/` in
|
2022-06-12 13:23:25 +09:00
|
|
|
the cloned repository
|
2022-03-08 12:38:23 +09:00
|
|
|
|
|
|
|
* `title/file`:
|
|
|
|
location of the stream title, the default is `title.txt` in the
|
2022-06-12 13:23:25 +09:00
|
|
|
cloned repository
|
2022-03-08 12:38:23 +09:00
|
|
|
|
|
|
|
* `captcha/fonts`:
|
|
|
|
locations of fonts for the captcha, leaving it blank will use the
|
|
|
|
default font
|
|
|
|
|
2022-06-22 17:56:01 +09:00
|
|
|
* `access/captcha`:
|
|
|
|
if true, users must complete a captcha before accessing the site
|
|
|
|
proper
|
|
|
|
|
2022-03-08 12:38:23 +09:00
|
|
|
Run it:
|
|
|
|
```sh
|
2022-06-16 11:56:18 +09:00
|
|
|
python -m anonstream
|
2022-03-08 12:38:23 +09:00
|
|
|
```
|
|
|
|
|
2022-06-16 11:56:18 +09:00
|
|
|
This will start a webserver listening on the local host at port 5051 (use
|
|
|
|
`--port PORT` to override).
|
2022-03-08 12:38:23 +09:00
|
|
|
|
2022-06-12 13:23:25 +09:00
|
|
|
If you go to `http://localhost:5051` in a web browser now you should see
|
2022-06-16 09:48:27 +09:00
|
|
|
the site. When you started the webserver some credentials were printed
|
|
|
|
in the terminal; you can log in with those at
|
|
|
|
`http://localhost:5051/login`.
|
2022-03-08 12:38:23 +09:00
|
|
|
|
|
|
|
The only things left are (1) streaming, and (2) letting other people
|
2022-06-12 13:23:25 +09:00
|
|
|
access your stream. [/STREAMING.md][streaming] has instructions for
|
|
|
|
setting up OBS Studio and a Tor onion service. If you want to use
|
|
|
|
different streaming software and put your stream on the Internet some
|
2022-06-14 07:34:54 +09:00
|
|
|
other way, read those instructions and copy the gist.
|
2022-03-08 12:38:23 +09:00
|
|
|
|
2022-06-16 11:56:18 +09:00
|
|
|
## Running
|
|
|
|
|
|
|
|
Start anonstream like this:
|
|
|
|
```sh
|
|
|
|
python -m anonstream
|
|
|
|
```
|
|
|
|
The default port is 5051. Append `--help` to see options.
|
|
|
|
|
|
|
|
If you want to use a different ASGI server, point it to the app factory
|
|
|
|
at `asgi:create_app()`. For example with `uvicorn`:
|
|
|
|
```sh
|
|
|
|
python -m uvicorn asgi:create_app --factory --port 5051
|
|
|
|
```
|
|
|
|
|
|
|
|
In either case you can explicitly set the location of the config file
|
|
|
|
using the `ANONSTREAM_CONFIG` environment variable.
|
|
|
|
|
|
|
|
|
2022-06-16 09:53:26 +09:00
|
|
|
## Hacking
|
|
|
|
|
|
|
|
anonstream has APIs for accessing internal state and hooking into
|
|
|
|
internal events. They can be used by humans and other programs. See
|
|
|
|
[/HACKING.md][hacking].
|
|
|
|
|
2022-03-07 23:51:59 +09:00
|
|
|
## Copying
|
2022-03-07 14:39:06 +09:00
|
|
|
|
2022-03-07 23:51:59 +09:00
|
|
|
anonstream is AGPL 3.0 or later, see
|
|
|
|
[/LICENSES/AGPL-3.0-or-later.md][licence].
|
|
|
|
|
|
|
|
### Assets
|
|
|
|
|
|
|
|
* [/anonstream/static/settings.svg][settings.svg]:
|
|
|
|
[setting](https://thenounproject.com/icon/setting-685325/) by
|
|
|
|
[ulimicon](https://thenounproject.com/unlimicon/) is licensed under
|
|
|
|
[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/).
|
|
|
|
|
|
|
|
### Dependencies
|
|
|
|
|
|
|
|
* aiofiles <https://github.com/Tinche/aiofiles>
|
|
|
|
([Apache 2.0][aiofiles])
|
|
|
|
|
|
|
|
* captcha <https://github.com/lepture/captcha>
|
|
|
|
([BSD 3-Clause][captcha])
|
|
|
|
|
|
|
|
* itsdangerous <https://github.com/pallets/itsdangerous/>
|
|
|
|
([BSD 3-Clause][itsdangerous])
|
|
|
|
|
|
|
|
* m3u8 <https://github.com/globocom/m3u8>
|
|
|
|
([MIT][m3u8])
|
|
|
|
|
|
|
|
* quart <https://gitlab.com/pgjones/quart>
|
|
|
|
([MIT][quart])
|
|
|
|
|
|
|
|
* toml <https://github.com/uiri/toml>
|
|
|
|
([MIT][toml])
|
|
|
|
|
|
|
|
* uvicorn <https://github.com/encode/uvicorn>
|
|
|
|
([BSD 3-Clause][uvicorn])
|
|
|
|
|
|
|
|
* werkzeug <https://github.com/pallets/werkzeug>
|
|
|
|
([BSD 3-Clause][werkzeug])
|
|
|
|
|
2022-06-12 13:23:25 +09:00
|
|
|
[config]: https://git.076.ne.jp/ninya9k/anonstream/src/branch/master/config.toml
|
2022-06-16 09:53:26 +09:00
|
|
|
[hacking]: https://git.076.ne.jp/ninya9k/anonstream/src/branch/master/HACKING.md
|
2022-06-12 13:23:25 +09:00
|
|
|
[licence]: https://git.076.ne.jp/ninya9k/anonstream/src/branch/master/LICENSES/AGPL-3.0-or-later.md
|
2022-03-07 23:51:59 +09:00
|
|
|
[settings.svg]: https://git.076.ne.jp/ninya9k/anonstream/src/branch/master/anonstream/static/settings.svg
|
2022-06-12 13:23:25 +09:00
|
|
|
[streaming]: https://git.076.ne.jp/ninya9k/anonstream/src/branch/master/STREAMING.md
|
2022-03-07 23:51:59 +09:00
|
|
|
|
|
|
|
[aiofiles]: https://github.com/Tinche/aiofiles/blob/master/LICENSE
|
|
|
|
[captcha]: https://github.com/lepture/captcha/blob/master/LICENSE
|
|
|
|
[itsdangerous]: https://github.com/pallets/itsdangerous/blob/main/LICENSE.rst
|
|
|
|
[m3u8]: https://github.com/globocom/m3u8/blob/master/LICENSE
|
|
|
|
[quart]: https://gitlab.com/pgjones/quart/-/blob/main/LICENSE
|
|
|
|
[toml]: https://github.com/uiri/toml/blob/master/LICENSE
|
|
|
|
[uvicorn]: https://github.com/encode/uvicorn/blob/master/LICENSE.md
|
|
|
|
[werkzeug]: https://github.com/pallets/werkzeug/blob/main/LICENSE.rst
|