Vote for the best .onion (or any other kind of text)
| .idea | ||
| onionvote | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
onionvote
Vote for the best .onion (or any other kind of text)
Installation
Prepare:
- Python 3
- A directory with entries. Entries are the names of files or folders in that directory.
- Clone this repo and enter it
git clone https://git.m724.eu/Minecon724/onionvote cd onionvote - Create a virtualenv and enter it:
python3 -m venv .venv . .venv/bin/activate - Install:
pip install -e . - Prepare the database:
flask --app onionvote init-db flask --app onionvote populate-db entries/ # replace with your entries directory - Run the app in Debug mode, not for production:
flask --app onionvote run --debug
Running in production
Follow the Installation steps, then:
- Generate a secret key: (not required, but best practice)
python -c 'import secrets; print(secrets.token_hex())' - Create a file in
.venv/var/onionvote-instance/config.pywith content:SECRET_KEY = '<the secret key>' - Install the web server:
pip install waitress - Run it:
waitress-serve --call 'onionvote:create_app' - Get a reverse proxy to handle the rest.
This was just an example, there are many ways to deploy a Flask app. See https://flask.palletsprojects.com/en/stable/deploying/
Security
Flask sessions are used to make it harder to skew results. (e.g. pick your own pairs and vote many times)
This uses a cookie that's stored on visit and removed when the browser is closed.