Allow LAN admin access and add a campaign mint form (#11).
CI / test (pull_request) Successful in 6s

Serve /admin/ on 10.0.0.128 so it can be used from another machine on the
network, and mint tracked short URLs from domain/campaign/source/metric.
This commit is contained in:
2026-09-16 05:26:20 -05:00
parent dd627b75c9
commit 8b38ab18d4
10 changed files with 351 additions and 16 deletions
+3 -3
View File
@@ -77,7 +77,7 @@ Internet
- One NPM proxy host. `location /` → gunicorn. Django 404s `/admin/` and `/debug/`.
- `monica_site` calls `SHORTENER_BASE_URL` (`https://piha.lc` or `https://beta.piha.li`).
- Django admin stays on `SHORT_ADMIN_HOSTS` (localhost). Not on the public host.
- Django admin stays on `SHORT_ADMIN_HOSTS` (localhost / LAN IP). Not on the public host.
### 2.4 Target allowlist
@@ -96,7 +96,7 @@ Even if NPM is misconfigured, the Django process must refuse the wrong surface:
- `request.get_host()` in `SHORT_PUBLIC_HOSTS` → redirects **and** `/api/` (Bearer).
- `request.get_host()` in `SHORT_API_HOSTS``/api/` (still Bearer). Extra names
(localhost, docker) only.
- `request.get_host()` in `SHORT_ADMIN_HOSTS``/admin/` (localhost only by default).
- `request.get_host()` in `SHORT_ADMIN_HOSTS``/admin/` (localhost and `10.0.0.128` by default).
- `/healthz/` allowed on both. No secrets in the body.
---
@@ -355,7 +355,7 @@ Reject codes that do not match `^[a-z0-9]{4,8}$` with 404 (no extra work).
| `PUBLIC_SHORT_URL` | origin for minted URLs, e.g. `https://piha.lc` (no trailing slash) |
| `SHORT_PUBLIC_HOSTS` | comma list; Host values that serve redirects **and** `/api/` |
| `SHORT_API_HOSTS` | comma list; extra Host values that serve `/api/` (localhost / docker) |
| `SHORT_ADMIN_HOSTS` | comma list; Host values that serve `/admin/` (default localhost only) |
| `SHORT_ADMIN_HOSTS` | comma list; Host values that serve `/admin/` (default localhost + `10.0.0.128`) |
| `SHORTENER_API_TOKENS` | `name:secret,name:secret` — required for API |
| `SHORT_ALLOWED_HOSTS` | allowlist for `target_url` hosts |
| `SHORT_CODE_LENGTH` | default `6` |