Commit graph

7 commits

Author SHA1 Message Date
Danny
459c751414 fix(start.py): line-buffer stdout so journals show progress promptly
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 13:42:51 +02:00
Danny
17248e239b refactor: drop the slash-command bot — Mini App is the only interface
bot.py is gone. /start, /history, /stats, /delete, /export,
/feedback, and the text-message workout parser are no longer
exposed. Everything those commands did is already available in
the Mini App (history listing, stats, edit/delete, JSON export
via /api/export/json, etc.).

Why: prod runs behind a Mini App URL, and shipyard staging is a
tenant under the existing shipyard_poc_bot which polls Telegram
itself. A second polling process on the same token would 409. By
removing polling entirely, prod and staging share one
architecture: a pure HTTP server validated against whatever
BOT_TOKEN is provided.

Changes:
- delete bot.py
- start.py: stop spawning the bot subprocess; load token, start
  server, optionally start cloudflared. WEBAPP_URL still skips
  the tunnel.
- flake.nix / requirements.txt: drop python-telegram-bot.
- README: rewrite to reflect Mini-App-only architecture.

The prod systemd unit doesn't need to change — its ExecStart is
`python start.py`, which now boots only the server (+ no tunnel
since WEBAPP_URL is set in the unit env).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 13:40:28 +02:00
Danny
967c7880fc chore: prefer BOT_TOKEN env var over secrets file
Backward-compatible reorder: env var wins, then file. This lets
multiple instances on the same host (prod + shipyard staging)
each load a distinct token via systemd EnvironmentFile, instead
of fighting over the single ~/.secrets/bigbiggerbiggestbot file.

Also documents the new two-environment workflow in README.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 12:44:25 +02:00
DannyDannyDanny
c5569fd49e start.py: skip cloudflared tunnel when WEBAPP_URL is set in env
Allows the bot to run behind an external reverse proxy (e.g. a VPS
running Caddy on a public TLS-terminated domain forwarding to
localhost:$API_PORT over a private overlay network) instead of
spinning up an ephemeral trycloudflare.com quick tunnel. Set
WEBAPP_URL=https://your.domain/... in the service environment and
start.py will use it verbatim and skip spawning cloudflared.

Behavior unchanged when WEBAPP_URL is unset: still launches cloudflared
and picks up the auto-generated trycloudflare.com URL as before.
2026-04-24 12:47:16 +02:00
Danny
7288d93741 fix(start): force http2 protocol and drain cloudflared output 🐛
QUIC tunnels consistently returned 1033 errors. Forcing http2 fixes it.
Added a daemon thread to drain cloudflared's stdout pipe to prevent
buffer-full blocking that would kill the tunnel.
2026-03-29 18:58:16 +02:00
Danny
f2cfe72d63 Switch from localtunnel to cloudflared, fix static file serving
- Replace localtunnel with cloudflared (no interstitial password page)
- Wait for "Registered tunnel connection" before starting bot
- Serve index.html at / instead of directory listing
- Remove localtunnel npm package build from flake.nix

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:35:05 +01:00
Danny
f025e5fd19 Add Telegram Mini App (web UI + API server + localtunnel)
- server.py: aiohttp API serving webapp/ and REST endpoints using existing db.py
- start.py: orchestrator that loads token, starts server + localtunnel + bot
- webapp/: Mini App frontend (Log, History, Stats) with Telegram-native theming
- bot.py: added Mini App menu button and inline button on /start
- flake.nix: added aiohttp + localtunnel, nix run now uses start.py
2026-03-24 20:17:36 +01:00