`WEB_PUBLIC_URL` was the only source of the `redirect_uri`, so a hosting
panel or a proxy publishing the dashboard on another port produced a link
Discord refuses, with nothing on screen pointing at the port mismatch.
The browser's own origin is what Discord compares against, so the redirect
now comes from the request, honouring `X-Forwarded-Host` and
`X-Forwarded-Proto` when a proxy sits in front. `WEB_PUBLIC_URL` stays as
the fallback for links built outside a request, and the sign-in page prints
the exact value to declare in the portal.
The `Secure` cookie flag follows the same rule: announcing HTTPS in the
configuration while serving plain HTTP made the browser drop the session.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both READMEs gain the same section and the same variables, as the
organisation requires them to stay in sync.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The schema test compares the declared variables against `.env.example`, so
the two cannot drift apart. The server tests drive the real handler over a
loopback socket rather than a mock, which is what caught the health probe
missing from bootstrap mode and the deployments recorded under the wrong
guild.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The front-end is plain JavaScript served as is: no build step to run before
the bot starts, and no second toolchain to keep alive. A simple/advanced
switch hides the technical panels without ever standing in for a permission.
`npm run setup` starts the wizard alone, because the bot refuses to boot
without a token and the `.env` has to be writable from somewhere. When the
webhook and the dashboard share a port, a single HTTP server is started.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
One module per domain, each route declaring the minimum access level the
server enforces before the handler runs. Irreversible actions ask for the
exact name to be typed back, and every write lands in `event_logs` with its
author so the history says who did what.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three kinds of target, ordered by how much they trust the caller: a signed
webhook runs nothing locally, a Gitea Action delegates to the forge, and a
shell command executes arbitrary code on the bot host — hence the double
lock of an environment flag plus the Owner level on that last one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every variable is described once, with its explanation and the steps to
obtain it. The form, the validation and the generated file all derive from
that description, so adding a variable to the bot means touching one file.
The previous file is backed up before being replaced, and an empty secret
means "keep the current value" so a token cannot be wiped by accident.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Visitors sign in with Discord and inherit the very same access levels as the
slash commands, so there is no second permission model to keep in sync.
Writes require a header a cross-site form cannot forge, on top of the
`SameSite=Lax` cookie, and a bootstrap token opens the configuration wizard
alone for the case where no Discord application exists yet.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sessions and API tokens keep only a hash of the value handed to the client,
so a database dump cannot be replayed. A deployment denormalises its target
name so the history survives the deletion of that target.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`gitea-client.js` stays focused on the single repository the slash commands
talk to. The dashboard addresses any repository of the organization, so its
endpoints live apart instead of bloating the command path.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The dashboard is off by default and listens on the loopback interface: it
must be an explicit decision to expose it, not a side effect of upgrading.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`/notify set` stores the types listed in `NOTIFICATION_TYPES` (`releases`,
`commits`, `pull_requests`) while the webhook handler looks them up under the
Gitea event names (`release`, `push`, `pull_request`), so an override chosen
from Discord was never found and the environment default always won.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The organisation asks every repository for both languages, for the issue and
pull request templates, and for the commit, branch and release rules; the
README now states them, README.en.md mirrors it, and a test keeps the two in
sync so a change on one side cannot be forgotten on the other.
The readme also documents what shipped since it was last written: several voice
triggers, the guaranteed cleanup of empty channels, the editable bot statuses,
the message tone and the variables they add.
Releases are expected to ship notes built from the Conventional Commits, and a
hand-written file drifts from the history within a few merges. The generator
reads the log directly, so it adds no dependency, and `npm run changelog:check`
gives CI a way to fail when the file was not regenerated.
A commit that only rewrites the changelog is left out of it, otherwise the
check could never be green once that file is committed.
The organisation lists a minimum ignore set for every repository: the data
directory of the development assistants and the artefacts of the languages a
contributor may build next to this one must never reach the repository.
The presence line was hard-coded, so advertising a different message meant
editing the source and restarting the bot. Statuses now live in the database
and are managed from Discord with /status — add, list, remove, pause and the
rotation interval, which applies without a restart.
An empty list falls back to a neutral "see the commands with /help" line, and
the first status added shows up right away instead of waiting a full turn.
Members read all replies as one voice, so the wording now lives in one place:
the shared titles, the list marker and the "what to do next" hint come from
src/ui/embeds.js, and every module follows them.
An error explains the cause, recalls the rule and offers the way out instead of
blaming; a success says what happens next. Nothing agrees on the gender of a
person ("utilisateur", "cher/chère", "ravie"), which also keeps the sentences
shorter. Two tests lock the shared titles and reject gendered descriptions.
A generated channel could survive with nobody in it: the row was dropped before
the channel was really gone, so a refused delete call left a room nothing could
track anymore, and an event missed while the bot was down was never retried.
The row is now kept until Discord confirms the channel is gone, and a sweep at
startup then every minute deletes whatever the event missed. The grace period
is tunable with VOICE_EMPTY_GRACE_MS, 0 deleting as soon as the room empties.
A server needs one "create your own room" channel per theme, which a single
trigger id could not express. Triggers are now stored as a list, each with its
own home category, name template and default limit.
Joining a trigger creates the channel at the bottom of that trigger's category,
and a member keeps one channel per trigger instead of one room for the whole
server. Triggers declared by the single-trigger version and
CHANNEL_VOICE_TRIGGER_ID still work as fallbacks, so no server has to be
reconfigured.
The status tables now describe real behaviour, and the required intents and invite permissions include the new voice features so a fresh install works on the first try.
Joining the trigger channel must feel instant and never leave orphan channels behind, so the ownership is stored in SQLite, empty channels are deleted after a short grace period and a startup sweep cleans up whatever a restart left behind.
A poll must end even when nobody is there to close it, so a scheduler reads the stored end dates and finalises the results at startup and while running.
Every action checks the role hierarchy before touching Discord, then records the sanction in SQLite and mirrors it in the moderation log channel, so the history outlives the audit log.
Each ticket category is visible to a different set of staff roles, and the claim and close actions must also be reachable from the channel itself, so the buttons live in the ticket and share the service checks.
A guild can reroute a notification type to its own channel from SQLite, with the environment values as fallback, without editing the configuration or restarting the bot.
Creating an issue or a pull request needs a title and a description, which do not fit in a slash command option, so the branches chosen as options are kept in memory for a few minutes until the modal is submitted.
Moderation, tickets, polls and Gitea events reuse the same labels, colours and buttons; normalising list responses in the client keeps both commands and webhooks free of version quirks.