- Rust 81.4%
- HTML 13.2%
- CSS 3.7%
- Dockerfile 1.3%
- Shell 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Same port, /data volume, SQLite schema, password hashes and itsdangerous session cookies, so existing installs keep working and nobody is logged out. Templates and CSS are compiled into the binary; the image is distroless (~50 MB) with a built-in healthcheck. Deployment follows medsync-server: cached dependency layer with tests run in the Docker build, buildx registry cache, Portainer stack found by name, and explicit image pull. IMAGE_TAG stays pinned to the commit SHA. Also fixes changed/cleared gamertags never being un-whitelisted, and shows log times in the viewer's local timezone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
| .forgejo/workflows | ||
| src | ||
| static | ||
| templates | ||
| .dockerignore | ||
| .gitignore | ||
| build.sh | ||
| Cargo.lock | ||
| Cargo.toml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
PatreonLink
A dockerized service that whitelists your Patreon supporters on a Minecraft server using their Xbox accounts, and removes them when their membership lapses.
- No environment variables. All settings (Patreon/Discord credentials,
Minecraft connection, sync interval) live in a SQLite database on the
/datavolume and are managed through the web GUI. - Web GUI with a first-run wizard: enter Patreon API credentials, connect your creator account via OAuth, pick a campaign, and test every connection.
- Sync loop runs every 5 minutes (configurable): new active patrons with a linked gamertag are whitelisted; lapsed patrons are removed.
- Patron self-service portal (
/link): Patreon doesn't expose Xbox gamertags, so patrons log in with Discord. If their Discord account is connected on Patreon they're matched automatically; otherwise they can claim their membership by Patreon email. They then enter their Xbox gamertag, which is verified and resolved to an XUID via the public GeyserMC API.
Run it
docker-compose.yml deploys the prebuilt image from the registry — use it
directly as a Portainer stack, or locally:
docker compose up -d # pulls git.thenymans.com/brian/patreonlink:latest
# or build from source:
docker build -t git.thenymans.com/brian/patreonlink:latest .
docker compose up -d
Open http://localhost:8000 — you'll be taken to the first-run setup to create an admin password. Everything else is configured from the admin pages.
CI/CD
Pushes to main run .forgejo/workflows/deploy.yml: build the image with
buildx (the Dockerfile runs the unit tests, so a failing build never ships;
the dependency layer is cached in the registry under :buildcache), push
:latest and :<sha>, pull :<sha> onto the Portainer endpoint, and
redeploy the stack with IMAGE_TAG pinned to that commit. Required
repository secrets:
| Secret | Purpose |
|---|---|
REGISTRY_USER / REGISTRY_PASSWORD |
Push/pull access to git.thenymans.com's container registry |
PORTAINER_TOKEN |
Portainer API key |
The stack is found by name (patreonlink) and its endpoint is read from the
stack itself, so no numeric IDs need to be kept in secrets. Create the stack
once in Portainer (paste docker-compose.yml); the workflow updates it on
every push afterwards.
Setup walkthrough
- General settings — set the public base URL (the address patrons will
use, e.g.
https://link.example.com). OAuth redirect URLs are derived from it. Put the app behind HTTPS (reverse proxy) for production. - Patreon — create an API client at patreon.com/portal → Clients & API Keys, set its redirect URI to the one shown on the page, paste the client ID/secret, then click Connect Patreon account and Test connection.
- Discord — create an app at discord.com/developers, add the redirect shown on the page, paste the client ID/secret. This powers the patron portal login.
- Minecraft — pick one:
- RCON (Java servers, including Geyser/Floodgate setups): host, port,
password, and the add/remove command templates. For Floodgate use
fwhitelist add {gamertag}/fwhitelist remove {gamertag}. Enable RCON inserver.properties(enable-rcon,rcon.port,rcon.password). - allowlist.json (Bedrock Dedicated Server): mount your server
directory into the container (see
docker-compose.yml) and point atallowlist.json. BDS reloads the file automatically.
- RCON (Java servers, including Geyser/Floodgate setups): host, port,
password, and the add/remove command templates. For Floodgate use
- Share
https://your-base-url/linkwith your patrons.
How matching works
Each sync pulls all campaign members from Patreon (name, email, membership
status, and — when the patron has connected it — their Discord user ID).
A patron is whitelisted when their status is active_patron and a
gamertag is on file. Gamertags arrive three ways:
- Patron logs into
/linkwith Discord; their Discord ID matches the one Patreon reported → they enter their gamertag. - Patron's Discord isn't on Patreon → they claim by Patreon email, then enter their gamertag.
- The admin sets a gamertag directly on the dashboard.
Notes
- Data (settings + links + logs) persists in
./data/patreonlink.db. - The admin pages are password-protected, but there is no rate limiting or CSRF protection beyond same-site cookies — don't expose the admin UI to the open internet without a reverse proxy in front, and always use HTTPS.
- Written in Rust (axum + SQLite). The image is a single static-ish binary
on distroless (~50 MB, ~2 MB RAM idle) with a built-in
healthchecksubcommand used by the DockerHEALTHCHECK. Templates and CSS are compiled into the binary. - It is a drop-in replacement for the original Python version: same port,
volume, database schema, password hashes and session cookies, so an
existing
/data/patreonlink.dbkeeps working and nobody is logged out. - Local development without a Rust toolchain:
./build.sh testor./build.sh runruns cargo inside the official Rust image (state goes to./data/, listening on port 8000).