feat: share files/images/videos into Matrix via /send #1

Merged
mxm merged 10 commits from feat/matrix-media-send into main 2026-06-08 17:35:42 +00:00
Owner

Summary

  • Extend POST /send to send media (image/video/audio/file) into Matrix rooms, including E2EE
  • n8n passes a mediaUrl (+ kind, filename, optional fetchAuthHeader, replyToEventId); the bot downloads, encrypts for E2EE rooms, uploads to the content repo, and sends the event
  • Configurable download cap MATRIX_MAX_DOWNLOAD_BYTES (default 50 MB); http/https-only fetch guard

Test Plan

  • 41/41 unit tests pass (cd bot && npm test); build clean (npm run build)
  • Manual: POST a media mediaUrl to /send → renders inline in an encrypted room
  • Manual: oversized file → HTTP 413; replyToEventId → threads as reply
## Summary - Extend `POST /send` to send media (image/video/audio/file) into Matrix rooms, including E2EE - n8n passes a `mediaUrl` (+ `kind`, `filename`, optional `fetchAuthHeader`, `replyToEventId`); the bot downloads, encrypts for E2EE rooms, uploads to the content repo, and sends the event - Configurable download cap `MATRIX_MAX_DOWNLOAD_BYTES` (default 50 MB); http/https-only fetch guard ## Test Plan - [x] 41/41 unit tests pass (`cd bot && npm test`); build clean (`npm run build`) - [ ] Manual: POST a media `mediaUrl` to `/send` → renders inline in an encrypted room - [ ] Manual: oversized file → HTTP 413; `replyToEventId` → threads as reply
Extend POST /send to share files/images/videos/audio into Matrix rooms
(including E2EE) via URL delivery. Bot downloads, encrypts when the room
is encrypted, uploads to the content repo, and sends the media event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- fail hard on invalid MATRIX_MAX_DOWNLOAD_BYTES (was silently NaN → cap disabled)
- restrict media downloads to http/https schemes (SSRF guard)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mxm left a comment

looks good

looks good
mxm merged commit 285514e84d into main 2026-06-08 17:35:42 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mxm/n8n-matrix-bridge!1
No description provided.