Development of the butterbox UI website and configuration portal
  • SCSS 33.2%
  • Less 32.8%
  • Python 21.1%
  • HTML 12.3%
  • JavaScript 0.4%
  • Other 0.2%
Find a file
2026-08-14 11:50:25 +00:00
app feat: update service labels 2026-08-14 11:39:24 +01:00
babel.cfg Initial commit 2026-02-17 08:42:33 +00:00
butter-new-portal.jpg Add some screenshots 2026-02-17 15:22:47 +00:00
butter-new-portal2.jpg Add some screenshots 2026-02-17 15:22:47 +00:00
butter-new-portal3.jpg Add some screenshots 2026-02-17 15:22:47 +00:00
butter-new-portal4.jpg Add some screenshots 2026-02-17 15:22:47 +00:00
butter-new-portal5.jpg Add some screenshots 2026-02-17 15:22:47 +00:00
butter-new-portal6.jpg Add some screenshots 2026-02-17 15:22:47 +00:00
butter-portal.py Initial commit 2026-02-17 08:42:33 +00:00
change_manager.py feat: update service labels 2026-08-14 11:39:24 +01:00
config.py feat: update service labels 2026-08-14 11:39:24 +01:00
install_madmail.py add logic for dynamic IP lookup for deltachat links and install #31 2026-07-01 13:31:24 -04:00
LICENCE docs: add BSD licence and translations details 2026-04-05 11:22:30 +01:00
messages.pot feat: update service labels 2026-08-14 11:39:24 +01:00
README.md update README with development and testing information 2026-07-21 18:40:25 -04:00
requirements.txt Update requirements 2026-03-30 15:17:24 +01:00

Butter Portal

Translation status License

This is a Flask application that serves as the primary UI for the Butter Box project. This is a from scratch reimplementation of the original UI with new enhancements and features.

Screenshots

Development

The portal is a standard Flask application. On a device it runs from the portal_env virtualenv under systemd, but for local development you can run it directly with the Flask development server.

Requirements

  • Python 3.11 or newer (developed against 3.14)
  • pip and venv

Setup

git clone ssh://git@guardianproject.dev/butter/butter-portal.git
cd butter-portal

python3 -m venv venv
source venv/bin/activate       # Windows: venv\Scripts\activate

pip install -r requirements.txt
pip install Flask-SQLAlchemy   # imported by app/__init__.py, not yet pinned in requirements.txt

Initialise the database

The app uses a local SQLite database (app.db) managed with Flask-Migrate. Point Flask at the entry module, create the schema, then seed default settings and the admin user:

export FLASK_APP=butter-portal.py   # or pass --app butter-portal.py to each command

flask db init       # first time only  creates the migrations/ directory
flask db migrate    # generate a migration from the current models
flask db upgrade    # apply it, creating app.db
flask seed-settings # seed default settings + the admin account

flask seed-settings is idempotent: it only creates settings and the admin user if they don't already exist. To start over, delete app.db (and the migrations/ directory) and re-run the steps above.

Run

flask --app butter-portal.py run            # http://127.0.0.1:5000
flask --app butter-portal.py run --debug    # auto-reload + interactive debugger

Log in with the seeded credentials admin / admin.

Useful configuration overrides (see config.py for the full list) are read from the environment:

export SECRET_KEY="something-random"          # session signing key
export DATABASE_URL="sqlite:///app.db"        # or another SQLAlchemy URL

Testing

There is no automated test suite yet, so testing is currently a manual smoke test:

  1. Start the server as above and open http://127.0.0.1:5000.
  2. Log in as admin / admin.
  3. Walk through onboarding and the settings screens.

Note that change_manager.py (the companion service that applies settings) runs as root and shells out to sudo for host-level changes such as Wi-Fi and SSH config. Those actions only work on a real Butter Box; on a development machine the portal UI runs fine, but applying such changes will fail or be a no-op.

Extracting translation strings

Translatable strings are extracted with Babel using babel.cfg:

pybabel extract -F babel.cfg -o messages.pot .

See the Translations section below for how these are managed on Weblate.

Translations

Snapshot templates support localisation. Translations of strings in the template are managed on Weblate.

Translation status

© SR2 Communications Limited. See LICENCE for details of the BSD 2-clause licence.