Add image uploads in chat messages (Gitea issue #10)

Images live on the app server's local disk (uploads/), served through an
authenticated, room-membership-gated endpoint since rooms can be private.
Uploads are streamed with a byte-count cap, validated as genuine decodable
images with Pillow (not just a spoofed Content-Type), and downscaled to
2000px on the longer side (except GIF, to preserve animation).

Backend: MessageImage model + nullable Message.content/image_id with a
content-or-image CheckConstraint, upload/serve endpoints in rooms.py, WS
message envelope gains image_id, push notification body says "sent an
image" for image-only messages.

Frontend: Composer gets an attach button with upload progress and a
thumbnail chip; MessageList renders images inline with a click-to-zoom
ImageLightbox.
This commit is contained in:
ksmith committed 2026-08-14 12:21:42 -06:00
1 parent 559adf9b7e
commit f2a59f798b
27 files changed
+829 -40

No files matched your search

+11
View File
@@ -51,6 +51,17 @@
font-family: var(--mono);
}
.message-image {
display: block;
max-width: min(320px, 100%);
max-height: 240px;
object-fit: contain;
border-radius: var(--radius);
border: 1px solid var(--ds-border);
cursor: zoom-in;
margin-bottom: 4px;
}
.message-text {
font-size: 0.88rem;
line-height: 1.45;