Files
truenas-catalog-notify/README.md
LockeShor 512a54487d
All checks were successful
Docker Image / build (push) Successful in 1m7s
eh it works
2026-03-02 17:20:09 -05:00

70 lines
2.1 KiB
Markdown

# truenas-catalog-notify
Lightweight TrueNAS Apps catalog watcher that sends Telegram alerts when the catalog changes.
## What it tracks
The watcher pulls `https://apps.truenas.com/catalog` over plain HTTP (no browser/emulation), parses app cards, and compares these fields against a saved snapshot:
- app name
- app URL
- train
- added date
- summary text
On changes, it sends Telegram messages with:
- one detailed message per newly added app (name, URL, train, added date, catalog summary, and page title)
- screenshot images from the app page, posted as Telegram photos (up to the configured per-app limit)
- removed apps (`-`)
- updated apps (`~`) and field-level diffs
It also listens for Telegram commands from the configured chat:
- `/random` returns one random app using the same detailed format, including screenshots when available
## Environment variables
- `TELEGRAM_BOT_TOKEN` (required for notifications)
- `TELEGRAM_CHAT_ID` (required for notifications)
- `CHECK_INTERVAL_SECONDS` (default: `1800`)
- `STATE_PATH` (default: `/data/catalog_state.json`)
- `CATALOG_URL` (default: `https://apps.truenas.com/catalog`)
- `REQUEST_TIMEOUT_SECONDS` (default: `30`)
- `LOG_LEVEL` (default: `INFO`)
- `MAX_SCREENSHOTS_PER_APP` (default: `3`)
- `TELEGRAM_POLL_SECONDS` (default: `10`)
## Build
```bash
docker build -t truenas-catalog-notify .
```
## Run
```bash
docker run -d \
--name truenas-catalog-notify \
-e TELEGRAM_BOT_TOKEN=123456:ABC... \
-e TELEGRAM_CHAT_ID=123456789 \
-e CHECK_INTERVAL_SECONDS=1800 \
-v truenas-catalog-notify-data:/data \
--restart unless-stopped \
truenas-catalog-notify
```
## Notes
- First run only stores the initial snapshot (no notification).
- Notifications start when a later check differs from the saved snapshot.
- If Telegram variables are missing, the watcher logs changes but skips sending messages.
- If you hit permissions on `/data/catalog_state.json`, rebuild and recreate the container with the latest image.
## Rebuild after changes
```bash
docker compose build --no-cache
docker compose up -d --force-recreate
```