Skip to content

v0.4.0

Latest

Choose a tag to compare

@MajMcCloud MajMcCloud released this 28 Nov 15:55

The bot sets itself up now. Start it without a configuration and a first-start assistant asks for
everything, verifies each value against the real API and writes a working appsettings.local.json —
no hand-edited JSON, no .env required. On top of that, chats are released explicitly: an unknown
chat either triggers an approval question for the admins or is ignored completely (stealth mode).

48 files changed, ~5000 lines added, 173 unit tests.

✨ New: first-start assistant

  • Runs automatically when the configuration is incomplete and a real console is attached
    (--setup forces it, --no-setup turns it off for services and containers).
  • Steps: instance name → Telegram token (typed masked, verified live with getMe) → chat discovery
    (live table of every chat that writes to the bot) → target chat → admin chats → Gitea base URL and
    API key (verified against the mirror API) → approval mode → summary. Nothing is written until you
    confirm; q or Ctrl+C leaves every file untouched.
  • 4-digit code: post the displayed code into the target group and the bot determines the chat
    and the forum topic by itself — no ids to look up. The listener keeps running, so a code posted
    late still counts. Private chats, normal groups and the General topic get topic 0 without asking.
  • Instance name (e.g. Floh's repo-archive) appears in the welcome, status and approval
    messages, which matters when several mirror instances share one group.
  • After saving, every released chat gets a short "«instance» is ready" note (silent); admins also
    get the approval status.
  • Screenshot in the README: Assets/screen-03-setup-assistant.png.

✨ Chat allowlist, approval flow and stealth mode

  • Services/ChatRegistry.cs keeps released and declined chat ids in the same local settings file,
    so a decision survives a restart and can be edited by hand (Telegram:AllowedChatIds,
    Telegram:DeniedChatIds).
  • Unknown chat + approval enabled → inline Approve/Deny buttons to every admin chat, first click
    wins, the rest are updated; the question expires on its own.
  • Approval disabled → stealth mode: the chat gets no answer at all and nothing is logged as an error.
  • Admin commands: /chats, /pending, /approve <id>, /deny <id>, /forget <chat id>.
  • Every chat now runs its own form (StartForm, PrivateWatchForm, GroupWatchForm, AdminForm);
    a chat that is not allowed gets no response, not even to /help or /status.

✨ HTTP

  • GET / answers with a status page: a small HTML page in the browser (instance, uptime, version,
    target chat, released chats, approval mode, Gitea URL) and the same values as JSON for every other
    client. No secrets — the Gitea key is only reported as set/not set.
  • GET /health and POST /api/gitea/webhook are unchanged.

🔧 Configuration and container

  • The bot starts with an empty .env: docker compose no longer aborts on ${VAR:?…} guards, and
    an empty environment variable counts as not set so it cannot hide a value that is already stored
    in the settings file.
  • A start without a terminal lists the missing keys, explains that the assistant needs a console and
    names the command that provides one (docker compose run --rm -it gitea-mirror-bot --setup).
  • appsettings.json is no longer tracked (it held credentials). Use the assistant,
    appsettings.example.json, appsettings.local.json or environment variables.
  • Compose: state now lives in ./giteamirror-state:/data next to the compose file, and the port is
    published on all interfaces (0.0.0.0:5080) instead of host loopback only — the webhook has no
    authentication, so put it behind a trusted network or an access-controlled reverse proxy.
  • New environment variables: INSTANCE_NAME, TELEGRAM_ADMIN_CHAT_IDS, TELEGRAM_ALLOWED_CHAT_IDS,
    TELEGRAM_APPROVAL_ENABLED.

🐛 Fixed

  • The welcome message is sent into the configured topic of the target group (private chats stay at
    thread 0).
  • A code posted after the topic question no longer triggers a second question — the topic is already
    known from the message the code arrived in.
  • Missing configuration is reported as a readable panel instead of an exception.

📦 Assets

Twelve builds, each with appsettings.example.json instead of any real configuration:
win-x64, win-arm64, osx-x64, osx-arm64, linux-x64, linux-arm64 — each as
framework-dependent and self-contained ZIP.

Container images (built by the docker-build.yml workflow for this tag):
ghcr.io/majmccloud/giteamirrorbot:v0.4.0, :latest and :edge (linux/amd64 + linux/arm64).