discord-bridge: Matrix avatars on Discord, catch up missed messages
Lint / JS (eslint) (push) Successful in 15s
Lint / Shell (shellcheck) (push) Successful in 15s
Lint / Landing page is rendered (matrix (push) Successful in 9s
Lint / No secrets in webhook configs (push) Successful in 9s
Lint / Python (ruff) (push) Successful in 11s
Lint / Secret scan (gitleaks) (push) Successful in 15s
Lint / Shell (shellcheck) (pull_request) Successful in 14s
Lint / JS (eslint) (pull_request) Successful in 8s
Lint / No secrets in webhook configs (pull_request) Successful in 7s
Lint / Landing page is rendered (matrix (pull_request) Successful in 7s
Lint / Python deps (pip-audit) (push) Successful in 1m6s
Lint / Python (ruff) (pull_request) Successful in 5s
Lint / Secret scan (gitleaks) (pull_request) Successful in 9s
Lint / Python deps (pip-audit) (pull_request) Successful in 54s

Set bridge.public_address so relayed messages carry the sender's avatar
(served through a new NPM location for /mautrix-discord/avatar/), listen
on 0.0.0.0 so NPM can reach it, and backfill all Discord messages missed
while the bridge was down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
Lotus CI
2026-10-28 21:51:02 -04:00
co-authored by Claude Opus 5.5
parent 1e4922d6a3
commit 8f35ab23a3
2 changed files with 13 additions and 6 deletions
+10 -3
View File
@@ -290,7 +290,7 @@ The token in `draupnir/production.yaml` in this repo is **intentionally redacted
| 9002 | Hookshot bridge (appservice) | 127.0.0.1 |
| 9003 | Hookshot webhooks | 0.0.0.0 |
| 9004 | Hookshot metrics | 0.0.0.0 |
| 29334 | mautrix-discord (appservice) | 127.0.0.1 |
| 29334 | mautrix-discord (appservice + avatar proxy for NPM) | 0.0.0.0 |
| 9100 | node_exporter | 0.0.0.0 |
| 9101 | matrix-admin exporter | 0.0.0.0 |
| 9500 | webhook (auto-deploy) | 0.0.0.0 |
@@ -427,8 +427,15 @@ can't overwrite the room's name and icon with the Discord channel's.
**Rotating the bot token:** reset it in the Developer Portal, then DM the bridge bot `logout` and
`login-token bot <new token>`.
**Not set up yet:** `bridge.public_address`, so Matrix users' avatars aren't shown on their relayed
Discord messages (names are). It needs a public NPM route to `/mautrix-discord/avatar/`.
**Matrix avatars on Discord:** relayed messages carry the sender's avatar as a signed URL under
`bridge.public_address` (`https://matrix.lotusguild.org`), which Discord fetches. NPM proxies
`/mautrix-discord/avatar/` → `http://10.10.10.29:29334` (hand-added location in
`/data/nginx/proxy_host/49.conf` on LXC 139, like `/sfu/get` — **re-add it after any NPM UI save of
proxy host 49**). The bridge listens on `0.0.0.0:29334` for this; the appservice API on that port
still requires the `hs_token`, and only the avatar path is proxied publicly.
**Catch-up after downtime:** `backfill.forward_limits.missed.channel: -1`, so Discord messages sent
while the bridge or Synapse was down are bridged when it starts again.
---
+3 -3
View File
@@ -31,7 +31,7 @@ appservice:
address: http://127.0.0.1:29334
# The hostname and port where this appservice should listen.
hostname: 127.0.0.1
hostname: 0.0.0.0
port: 29334
# Database config.
@@ -114,7 +114,7 @@ bridge:
# Publicly accessible base URL that Discord can use to reach the bridge, used for avatars in relay mode.
# If not set, avatars will not be bridged. Only the /mautrix-discord/avatar/{server}/{id}/{hash} endpoint is used on this address.
# This should not have a trailing slash, the endpoint above will be appended to the provided address.
public_address: null
public_address: https://matrix.lotusguild.org
# A random key used to sign the avatar URLs. The bridge will only accept requests with a valid signature.
avatar_proxy_key: generate
@@ -257,7 +257,7 @@ bridge:
# With limits, all messages up to the limit are fetched first and backfilled afterwards.
missed:
dm: 0
channel: 0
channel: -1
thread: 0
# Maximum members in a guild to enable backfilling. Set to -1 to disable limit.
# This can be used as a rough heuristic to disable backfilling in channels that are too active.