Vote for the best .onion (or any other kind of text)
Find a file
2025-02-10 16:16:41 +01:00
.idea Initial commit 2025-02-10 16:16:41 +01:00
onionvote Initial commit 2025-02-10 16:16:41 +01:00
.gitignore Initial commit 2025-02-10 16:16:41 +01:00
pyproject.toml Initial commit 2025-02-10 16:16:41 +01:00
README.md Initial commit 2025-02-10 16:16:41 +01:00

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.
  1. Clone this repo and enter it
    git clone https://git.m724.eu/Minecon724/onionvote
    cd onionvote
    
  2. Create a virtualenv and enter it:
    python3 -m venv .venv
    . .venv/bin/activate
    
  3. Install:
    pip install -e .
    
  4. Prepare the database:
    flask --app onionvote init-db
    flask --app onionvote populate-db entries/ # replace with your entries directory
    
  5. Run the app in Debug mode, not for production:
    flask --app onionvote run --debug
    

Running in production

Follow the Installation steps, then:

  1. Generate a secret key: (not required, but best practice)
    python -c 'import secrets; print(secrets.token_hex())'
    
  2. Create a file in .venv/var/onionvote-instance/config.py with content:
    SECRET_KEY = '<the secret key>'
    
  3. Install the web server:
    pip install waitress
    
  4. Run it:
    waitress-serve --call 'onionvote:create_app'
    
  5. 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.