Compare commits

...
Author SHA1 Message Date
Lotus CIandClaude Opus 5.5 6cdac33ca4 docs: Synapse 1.164.1
Lint / Shell (shellcheck) (push) Successful in 17s
Lint / JS (eslint) (push) Successful in 16s
Lint / Landing page is rendered (matrix (push) Successful in 7s
Lint / No secrets in webhook configs (push) Successful in 8s
Lint / Python (ruff) (push) Successful in 8s
Lint / Secret scan (gitleaks) (push) Successful in 7s
Lint / Shell (shellcheck) (pull_request) Successful in 10s
Lint / JS (eslint) (pull_request) Successful in 9s
Lint / No secrets in webhook configs (pull_request) Successful in 5s
Lint / Python deps (pip-audit) (push) Successful in 42s
Lint / Landing page is rendered (matrix (pull_request) Successful in 5s
Lint / Python (ruff) (pull_request) Successful in 7s
Lint / Secret scan (gitleaks) (pull_request) Successful in 9s
Lint / Python deps (pip-audit) (pull_request) Successful in 1m24s
Upgraded on LXC 151 (now on large1) on 2026-10-28 from 1.163.2.
1.164.1 brings msgpack 1.2.4 (GHSA-j586-36cw-2gc2: memory exhaustion via
malformed public room list tokens, reachable unauthenticated) on top of
1.164.0. Checked first: no upgrade notes to act on; MSC4210 (legacy mention
push rules off) handled by matrix#42 and Lotus already sending m.mentions;
null profile values not used (Lotus clears with an empty string).
Verified: client and federation versions report 1.164.1, federation tester
OK, no ERROR/CRITICAL since restart, clients resynced (200).
Rollback package kept (1.163.2+trixie1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-28 15:02:28 -04:00
jared 6b39bd931e Merge pull request 'fix: explicit m.mentions for ticket notifications and roasts (ahead of Synapse 1.164)' (#42) from fix/explicit-mentions into main
Lint / JS (eslint) (push) Successful in 10s
Lint / Shell (shellcheck) (push) Successful in 10s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Python (ruff) (push) Successful in 8s
Lint / Secret scan (gitleaks) (push) Successful in 6s
Lint / Python deps (pip-audit) (push) Successful in 42s
2026-10-27 20:06:14 -04:00
Lotus CIandClaude Opus 5.5 e1b2c8575c fix: explicit m.mentions for ticket notifications and roasts (ahead of Synapse 1.164)
Lint / Shell (shellcheck) (push) Successful in 11s
Lint / JS (eslint) (push) Successful in 12s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Python (ruff) (push) Successful in 7s
Lint / Secret scan (gitleaks) (push) Successful in 6s
Lint / Shell (shellcheck) (pull_request) Successful in 10s
Lint / JS (eslint) (pull_request) Successful in 9s
Lint / No secrets in webhook configs (pull_request) Successful in 5s
Lint / Python deps (pip-audit) (push) Successful in 43s
Lint / Landing page is rendered (matrix (pull_request) Successful in 4s
Lint / Python (ruff) (pull_request) Successful in 7s
Lint / Secret scan (gitleaks) (pull_request) Successful in 6s
Lint / Python deps (pip-audit) (pull_request) Successful in 39s
Synapse 1.164 turns on MSC4210 by default: the legacy push rules that
pinged when a user ID or display name appeared in the body are removed, so
a message only notifies the users listed in m.mentions.

- hookshot/tinker-tickets.js deliberately pings assignees/watchers
  (notify_users) with matrix.to links; those pings would stop. Return
  mentions: { user_ids: notifyUsers } (hookshot 7.3.2 v2 transforms
  support it).
- matrixbot: send_html takes optional mention_user_ids; !roast mentions the
  target when given as a full Matrix ID. Winner announcements stay without
  a ping (the player is already in the room).

No @room is sent anywhere. Lotus Chat already sends m.mentions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-27 20:04:27 -04:00
jared 54bdada04d Merge pull request 'docs: Synapse 1.163.2 (Pillow 13 security update)' (#41) from docs/synapse-1.163.2 into main
Lint / JS (eslint) (push) Successful in 14s
Lint / Shell (shellcheck) (push) Successful in 16s
Lint / No secrets in webhook configs (push) Successful in 11s
Lint / Landing page is rendered (matrix (push) Successful in 11s
Lint / Python (ruff) (push) Successful in 22s
Lint / Secret scan (gitleaks) (push) Successful in 9s
Lint / Python deps (pip-audit) (push) Successful in 50s
2026-10-26 19:30:06 -04:00
Lotus CIandClaude Opus 5.5 8a2867e64b docs: Synapse 1.163.2 (Pillow 13 security update)
Lint / Shell (shellcheck) (push) Successful in 15s
Lint / JS (eslint) (push) Successful in 14s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / Python (ruff) (push) Successful in 6s
Lint / Secret scan (gitleaks) (push) Successful in 5s
Lint / Shell (shellcheck) (pull_request) Successful in 7s
Lint / JS (eslint) (pull_request) Successful in 9s
Lint / No secrets in webhook configs (pull_request) Successful in 5s
Lint / Python deps (pip-audit) (push) Successful in 39s
Lint / Landing page is rendered (matrix (pull_request) Successful in 4s
Lint / Python (ruff) (pull_request) Successful in 7s
Lint / Secret scan (gitleaks) (pull_request) Successful in 5s
Lint / Python deps (pip-audit) (pull_request) Successful in 1m1s
Upgraded on LXC 151 on 2026-10-26 from 1.162.0 (the README still said
1.159.0). 1.163.2 brings Pillow 13.0.0 (security fixes in the image
thumbnailer). Upgrade notes checked: the new start-up check for
limit_profile_requests_to_users_who_share_rooms does not apply (unset).
Verified: /versions and federation version report 1.163.2, federation
tester OK, no errors since restart, Synapse thumbnailer works with Pillow 13.
Rollback package kept in /var/cache/apt/archives (1.162.0+trixie1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-26 19:23:53 -04:00
jared 2e6e8e72b8 Merge pull request 'fix(cinny-nginx): own rate budget for content-hashed app files' (#40) from fix/asset-rate-limit into main
Lint / Shell (shellcheck) (push) Successful in 11s
Lint / JS (eslint) (push) Successful in 7s
Lint / No secrets in webhook configs (push) Successful in 4s
Lint / Landing page is rendered (matrix (push) Successful in 4s
Lint / Python (ruff) (push) Successful in 7s
Lint / Python deps (pip-audit) (push) Successful in 37s
Lint / Secret scan (gitleaks) (push) Successful in 5s
2026-10-24 17:39:18 -04:00
Lotus CIandClaude Opus 5.5 d36c782e56 ci(pip-audit): ignore filelock CVEs in pip-audit's own dependency
Lint / Shell (shellcheck) (push) Successful in 10s
Lint / JS (eslint) (push) Successful in 9s
Lint / No secrets in webhook configs (push) Successful in 7s
Lint / Landing page is rendered (matrix (push) Successful in 8s
Lint / Python (ruff) (push) Successful in 7s
Lint / Python deps (pip-audit) (push) Successful in 1m4s
Lint / Secret scan (gitleaks) (push) Successful in 6s
Lint / Shell (shellcheck) (pull_request) Successful in 13s
Lint / JS (eslint) (pull_request) Successful in 10s
Lint / No secrets in webhook configs (pull_request) Successful in 6s
Lint / Landing page is rendered (matrix (pull_request) Successful in 7s
Lint / Python (ruff) (pull_request) Successful in 6s
Lint / Python deps (pip-audit) (pull_request) Successful in 42s
Lint / Secret scan (gitleaks) (pull_request) Successful in 9s
pip-audit --local scans the whole audit env, which includes pip-audit's
own CacheControl[filecache] -> filelock 4.1.0. Six new CVEs (fixed in
4.2.1) started failing every run; 4.2+ requires Python 3.11 and the audit
env is 3.10. The bot does not use filelock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-24 17:35:45 -04:00
Lotus CIandClaude Opus 5.5 ad7d735739 fix(cinny-nginx): give content-hashed app files their own rate budget
Lint / Shell (shellcheck) (pull_request) Successful in 15s
Lint / JS (eslint) (pull_request) Successful in 10s
Lint / No secrets in webhook configs (pull_request) Successful in 5s
Lint / Landing page is rendered (matrix (pull_request) Successful in 5s
Lint / Python (ruff) (pull_request) Successful in 6s
Lint / Python deps (pip-audit) (pull_request) Failing after 57s
Lint / Secret scan (gitleaks) (pull_request) Successful in 11s
Lint / Shell (shellcheck) (push) Successful in 11s
Lint / JS (eslint) (push) Successful in 9s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / Python (ruff) (push) Successful in 8s
Lint / Python deps (pip-audit) (push) Failing after 51s
Lint / Secret scan (gitleaks) (push) Successful in 6s
A cold page load fires ~75 requests within a second and the service worker
precaches all ~126 build files at once (every deploy renames them), both
past chat_limit's burst of 60. The excess got 503 "limiting requests":
a fresh visit to /register/matrix.org rendered blank (4 chunks refused),
and precache installs could fail after deploys. Like decorations (matrix
#22), hashed js/css/fonts/images/wasm now use assets_limit (100 r/s,
burst 400); pages and the webhook keep chat_limit. The deploy validates
with nginx -t and restores the old config on failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-24 17:05:11 -04:00
jared 4bb2dd4449 Merge pull request 'feat(cinny-deploy): fail and alert when a deployed page references missing files' (#39) from fix/deploy-asset-check into main
Lint / Shell (shellcheck) (push) Successful in 11s
Lint / JS (eslint) (push) Successful in 7s
Lint / No secrets in webhook configs (push) Successful in 4s
Lint / Landing page is rendered (matrix (push) Successful in 7s
Lint / Python (ruff) (push) Successful in 8s
Lint / Python deps (pip-audit) (push) Successful in 1m20s
Lint / Secret scan (gitleaks) (push) Successful in 15s
2026-10-20 02:38:06 -04:00
Lotus CIandClaude Opus 5.5 8aea38fc67 feat(cinny-deploy): fail and alert when a deployed page references missing files
Lint / No secrets in webhook configs (pull_request) Successful in 24s
Lint / Landing page is rendered (matrix (pull_request) Successful in 18s
Lint / Python (ruff) (pull_request) Successful in 10s
Lint / Python deps (pip-audit) (pull_request) Successful in 1m0s
Lint / Secret scan (gitleaks) (pull_request) Successful in 8s
Lint / Shell (shellcheck) (push) Successful in 15s
Lint / JS (eslint) (push) Successful in 16s
Lint / No secrets in webhook configs (push) Successful in 10s
Lint / Landing page is rendered (matrix (push) Successful in 9s
Lint / Python (ruff) (push) Successful in 10s
Lint / Python deps (pip-audit) (push) Successful in 1m17s
Lint / Shell (shellcheck) (pull_request) Successful in 13s
Lint / JS (eslint) (pull_request) Successful in 7s
Lint / Secret scan (gitleaks) (push) Successful in 5s
After copying, check every script/stylesheet the app and call pages
reference (src/href in both index.html files) exists in the webroot. If
any is missing, log it, post an alert with the upstream checker's Matrix
credentials (/etc/cinny-monitor.env, best effort) and exit 1. This would
have caught the 2026-10-20 call-page outage at deploy time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-20 02:28:52 -04:00
jared 963bc87c54 Merge pull request 'fix(cinny-deploy): the call page's scripts are deployed again (regression from #30)' (#38) from fix/deploy-call-assets into main
Lint / Shell (shellcheck) (push) Successful in 16s
Lint / JS (eslint) (push) Successful in 13s
Lint / No secrets in webhook configs (push) Successful in 10s
Lint / Landing page is rendered (matrix (push) Successful in 8s
Lint / Python (ruff) (push) Successful in 12s
Lint / Python deps (pip-audit) (push) Successful in 1m31s
Lint / Secret scan (gitleaks) (push) Successful in 7s
2026-10-20 01:55:37 -04:00
Lotus CIandClaude Opus 5.5 85c58d5ed0 fix(cinny-deploy): the call page's scripts are deployed again
Lint / No secrets in webhook configs (pull_request) Successful in 11s
Lint / Landing page is rendered (matrix (pull_request) Successful in 8s
Lint / Python (ruff) (pull_request) Successful in 7s
Lint / Python deps (pip-audit) (pull_request) Successful in 44s
Lint / Secret scan (gitleaks) (pull_request) Successful in 9s
Lint / Shell (shellcheck) (push) Successful in 14s
Lint / JS (eslint) (push) Successful in 9s
Lint / No secrets in webhook configs (push) Successful in 6s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / Python (ruff) (push) Successful in 7s
Lint / Python deps (pip-audit) (push) Successful in 40s
Lint / Secret scan (gitleaks) (push) Successful in 6s
Lint / Shell (shellcheck) (pull_request) Successful in 14s
Lint / JS (eslint) (pull_request) Successful in 10s
#30 added `rsync --exclude assets/` to keep old app assets, but an
unanchored exclude matches every directory named assets, including
public/element-call/assets/. Each deploy then updated the call page's
index.html but not its hashed scripts, so after the lotus.28 deploy the
call page requested files that did not exist (66 x 404 from 00:05 on
2026-10-20 until the assets were copied in by hand).

The excludes are now anchored (/assets/, /public/element-call/assets/), and
both asset directories get the same treatment: copied without --delete,
pruned after 14 days, so an open call page keeps its scripts across a
deploy. config.json stays unanchored on purpose (the production call
config lives at public/element-call/config.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
2026-10-20 00:19:47 -04:00
jared 8e5cdf50b5 Merge pull request 'feat(voice-limit-guard): enforce the limit at connect time too (#25)' (#37) from feat/voice-limit-connect-time into main
Lint / Shell (shellcheck) (push) Successful in 8s
Lint / JS (eslint) (push) Successful in 8s
Lint / No secrets in webhook configs (push) Successful in 11s
Lint / Landing page is rendered (matrix (push) Successful in 10s
Lint / Python (ruff) (push) Successful in 12s
Lint / Python deps (pip-audit) (push) Successful in 1m9s
Lint / Secret scan (gitleaks) (push) Successful in 4s
2026-10-19 23:34:04 -04:00
7 changed files with 109 additions and 15 deletions

No files matched your search

+10 -2
View File
@@ -94,8 +94,16 @@ jobs:
- name: Audit matrixbot dependencies
# --local scans the env without spawning a venv (required for standalone Python)
# CVE-2026-3219 is in pip itself, not our code — ignore it explicitly
run: /opt/python/bin/pip-audit --local --ignore-vuln CVE-2026-3219
# CVE-2026-3219 is in pip itself, not our code — ignore it explicitly.
# The filelock CVEs (fixed in 4.2.1) are in pip-audit's own dependency
# (CacheControl[filecache]); the bot doesn't use filelock, and 4.2+
# needs Python 3.11, which this 3.10 audit env can't install.
run: >-
/opt/python/bin/pip-audit --local
--ignore-vuln CVE-2026-3219
--ignore-vuln CVE-2026-112906 --ignore-vuln CVE-2026-112907
--ignore-vuln CVE-2026-112913 --ignore-vuln CVE-2026-112914
--ignore-vuln CVE-2026-112937 --ignore-vuln CVE-2026-112940
secret-scan:
name: Secret scan (gitleaks)
+1 -1
View File
@@ -50,7 +50,7 @@ matrix/
| Service | IP | LXC | RAM | Disk | Versions |
|---------|----|-----|-----|------|----------|
| Synapse | 10.10.10.29 | 151 | 12GB | 50GB | Synapse 1.159.0, LiveKit 1.9.11, hookshot 7.3.2, coturn latest |
| Synapse | 10.10.10.29 | 151 | 12GB | 50GB | Synapse 1.164.1, LiveKit 1.9.11, hookshot 7.3.2, coturn latest |
| PostgreSQL 17 | 10.10.10.44 | 109 | 6GB | 80GB | PostgreSQL 17.9 |
| Cinny Web | 10.10.10.6 | 106 | 2GB | 8GB | Debian 12, nginx, Node 24, Lotus Cinny fork (custom, tracks `cinnyapp/cinny` main) |
| Draupnir | 10.10.10.24 | 110 | 1GB | 10GB | Draupnir v2.9.0, Node.js v22 |
+56 -3
View File
@@ -164,9 +164,62 @@ echo "[$(date '+%Y-%m-%d %H:%M:%S')] Deploying to $WEBROOT..."
# still holding an older index.html (or service-worker precache) asks for its
# assets/index-<old hash>.js, and deleting them on every deploy broke the app
# for those users until their cached shell expired. Prune after 14 days.
rsync -a --delete --exclude config.json --exclude assets/ dist/ "$WEBROOT/"
rsync -a dist/assets/ "$WEBROOT/assets/"
find "$WEBROOT/assets" -type f -mtime +14 -delete
# The asset excludes are ANCHORED (leading /): an unanchored `assets/` also
# matched public/element-call/assets/, so the call page's index.html was
# updated while its hashed scripts never were, and calls failed to load.
# config.json stays unanchored on purpose: public/element-call/config.json is
# the production call config too.
rsync -a --delete --exclude config.json \
--exclude /assets/ --exclude /public/element-call/assets/ dist/ "$WEBROOT/"
for dir in assets public/element-call/assets; do
mkdir -p "$WEBROOT/$dir"
rsync -a "dist/$dir/" "$WEBROOT/$dir/"
find "$WEBROOT/$dir" -type f -mtime +14 -delete
done
# Every script/stylesheet the app and call pages reference must exist in the
# webroot. 2026-10-20: the call page's index.html pointed at scripts the deploy
# never copied and calls failed to load; this check would have caught it.
missing_assets() { # <index.html> <its directory>
grep -oE '(src|href)="[^"]+\.(js|css)"' "$1" | sed -E 's/^(src|href)="//; s/"$//' |
while read -r ref; do
case "$ref" in
http://*|https://*|//*) continue ;;
/*) path="$WEBROOT$ref" ;;
*) path="$2/${ref#./}" ;;
esac
[ -f "$path" ] || echo "$ref"
done
}
deploy_alert() { # best effort: the upstream checker's Matrix credentials
[ -r /etc/cinny-monitor.env ] || return 0
(
set -a
# shellcheck source=/dev/null
source /etc/cinny-monitor.env
set +a
_ALERT="$1" python3 - <<'PYEOF'
import json, os, time, urllib.parse, urllib.request
server = os.environ.get("MATRIX_SERVER", "").rstrip("/")
room, token = os.environ.get("MATRIX_ROOM", ""), os.environ.get("MATRIX_TOKEN", "")
if server and room and token:
url = f"{server}/_matrix/client/v3/rooms/{urllib.parse.quote(room, safe='')}/send/m.room.message/deploy{int(time.time() * 1000)}"
req = urllib.request.Request(url, method="PUT", data=json.dumps({"msgtype": "m.text", "body": os.environ["_ALERT"]}).encode(),
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"})
try:
urllib.request.urlopen(req, timeout=10)
except Exception as exc:
print(f"alert failed: {exc}")
PYEOF
) || true
}
MISSING=$(missing_assets "$WEBROOT/index.html" "$WEBROOT"; missing_assets "$WEBROOT/public/element-call/index.html" "$WEBROOT/public/element-call")
if [ -n "$MISSING" ]; then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: deployed pages reference missing files:"
echo "$MISSING"
deploy_alert "⚠️ Lotus Chat deploy ($VITE_APP_VERSION): the live pages reference files that are not on the server, so the app or calls may not load: $(echo "$MISSING" | tr '\n' ' ')"
exit 1
fi
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ===== Deploy complete ($VITE_APP_VERSION) ====="
+14
View File
@@ -17,6 +17,14 @@ map $uri $lotus_shell_cache_control {
# decoration picker can fetch hundreds of thumbnails, which would otherwise use
# up chat_limit and 503 the app's own files.
limit_req_zone $binary_remote_addr zone=decorations_limit:10m rate=100r/s;
#
# [cinny #201 follow-up] Content-hashed app files (js/css/fonts/images/wasm)
# likewise: a cold page load fires ~75 requests within a second, and the
# service worker precaches all ~126 build files at once (every deploy renames
# them), both past chat_limit's burst of 60, so chunks 503ed and pages
# rendered blank / the precache install failed. Immutable files, cheap to
# serve; pages and the webhook keep chat_limit.
limit_req_zone $binary_remote_addr zone=assets_limit:10m rate=100r/s;
server {
listen 80;
@@ -85,6 +93,8 @@ server {
}
location ~* \.(?:js|css|woff2?|png|svg|ico|webp|wasm)$ {
include snippets/cinny-security-headers-framed.conf;
# Own budget (replaces the server-level chat_limit; see assets_limit).
limit_req zone=assets_limit burst=400 nodelay;
expires 1y;
add_header Cache-Control "public, immutable" always;
}
@@ -93,6 +103,8 @@ server {
# Cache content-addressed static assets aggressively
location ~* \.(?:js|css|woff2?|png|svg|ico|webp)$ {
include snippets/cinny-security-headers.conf;
# Own budget (replaces the server-level chat_limit; see assets_limit).
limit_req zone=assets_limit burst=400 nodelay;
expires 1y;
add_header Cache-Control "public, immutable" always;
}
@@ -189,6 +201,8 @@ server {
}
location ~* \.(?:js|css|woff2?|png|svg|ico|webp|wasm)$ {
include snippets/cinny-security-headers-call.conf;
# Own budget (replaces the server-level chat_limit; see assets_limit).
limit_req zone=assets_limit burst=400 nodelay;
expires 1y;
add_header Cache-Control "public, immutable" always;
}
+10 -1
View File
@@ -77,4 +77,13 @@ if (event === 'ticket_created') {
html = '[tinker-tickets] event: <code>' + event + '</code> ticket #' + id;
}
result = { version: 'v2', plain: plain, html: html, msgtype: 'm.text' };
// Explicit mentions (m.mentions): from Synapse 1.164 the legacy push rules
// that pinged on a user ID or display name in the body are off by default
// (MSC4210), so the people to notify must be listed here.
result = {
version: 'v2',
plain: plain,
html: html,
msgtype: 'm.text',
mentions: { user_ids: notifyUsers }
};
+3 -1
View File
@@ -2273,7 +2273,9 @@ async def cmd_roast(client: AsyncClient, room_id: str, sender: str, args: str):
f'<blockquote>{roast}</blockquote>'
f'<sup><em>via {_model_label(CREATIVE_MODEL)}</em></sup>'
)
await send_html(client, room_id, plain, html)
# Ping the person being roasted when they were named by Matrix ID.
target_id = target_raw if re.fullmatch(r"@[^\s:]+:[^\s]+", target_raw) else None
await send_html(client, room_id, plain, html, mention_user_ids=[target_id] if target_id else None)
# ---------------------------------------------------------------------------
+15 -7
View File
@@ -70,17 +70,25 @@ async def send_text(client: AsyncClient, room_id: str, text: str):
return resp
async def send_html(client: AsyncClient, room_id: str, plain: str, html: str):
async def send_html(
client: AsyncClient, room_id: str, plain: str, html: str, mention_user_ids: list[str] | None = None
):
logger = logging.getLogger("matrixbot")
content = {
"msgtype": "m.text",
"body": plain,
"format": "org.matrix.custom.html",
"formatted_body": html,
}
# Explicit mentions (m.mentions). From Synapse 1.164 a name or user ID in
# the body no longer pings anyone (MSC4210), so a message that should
# notify someone has to say so.
if mention_user_ids:
content["m.mentions"] = {"user_ids": mention_user_ids}
resp = await _room_send_trusted(
client, room_id,
message_type="m.room.message",
content={
"msgtype": "m.text",
"body": plain,
"format": "org.matrix.custom.html",
"formatted_body": html,
},
content=content,
)
if not isinstance(resp, RoomSendResponse):
logger.error("send_html failed: %s", resp)