User requested a checkpoint and stopped all agents. Deployed artifacts remain the last verified releases; unfinished settings/categories/forums are preserved as WIP. See TODO/roadmap for verification and remaining release/updater work.
2.8 KiB
Channel image attachments (additive LNEx v4 extension)
Written before implementation. Existing packets and protobuf field numbers remain unchanged; no protocol version bump is needed. Unknown packet IDs remain ignorable. Voice messages and DM attachments are outside this extension.
Authenticated TLS sessions may send AttachmentUpload (0x0220): request_id=1 string, channel_id=2 string, data=3 bytes. The gateway validates PNG/JPEG/GIF content (maximum 3 MiB encoded; dimensions <=4096 each; <=4 million pixels and <=120 frames and <=8,388,608 aggregate frame pixels (32 MiB RGBA)), enforces upload rate and durable per-sender 64 MiB / global 512 MiB quotas (also 10,000 attachments per sender and 100,000 overall to bound row metadata), and requires the session to be currently joined to the channel. Success durably stores bytes in the existing authenticated database and posts an ordinary chat message vnox-attachment:<server UUID>. Such a marker identifies an attachment only within its message channel, never a filesystem path or public URL.
AttachmentFetch (0x0221): request_id=1, channel_id=2, attachment_id=3 strings. The current session must be joined to that exact channel; lookup is scoped by channel and ID. AttachmentResult (0x0222): request_id=1, channel_id=2, attachment_id=3, mime=4 strings, data=5 bytes, error=6 string. Upload responses omit bytes; fetch responses carry validated bytes. Errors carry a bounded human-readable error and no bytes. All traffic uses the existing TLS frame transport; 3 MiB binary protobuf remains below its 4 MiB frame limit. No HTTP listener, bearer URL, cookies, or externally accessible storage is introduced.
Images are validated off the async runtime with at most two concurrent validations per gateway process. Quota check, byte insertion, chat history and outgoing webhook events commit in one database transaction, serialized using the existing SQLite write lock / PostgreSQL advisory transaction lock across gateway processes. Current channel existence, text kind and guild membership are revalidated under the access lock; uploads additionally require MESSAGE_SEND (owner/administrator override). Uploads use the existing chat-send rate limiter. Fetches have a separate per-session budget (50 initial requests, refilling at four per second), stored in the same session entry and removed on disconnect, so opening history cannot consume chat-send tokens. Existing channel history preserves the marker and stored bytes survive restarts. Attachments currently have no automatic eviction; quota exhaustion returns an error. Deleting a message does not free its attachment immediately. Clients must bound decoding/cache and explicitly confirm clipboard previews before uploading. Direct HTTPS image URLs are a separate client capability and must not bypass private-network or redirect protections.