Fixing Issue #80: "Images in messages affected by Discord's new Signed Attachment CDN URLs". Adding attachment archiver.#94
Conversation
…URLs Discord's signed CDN URLs expire after ~24h, breaking images in logs. This adds an optional background archiver downloads attachments and avatars before they expire, compresses images to JPEG, and stores them in MongoDB GridFS. Archived files are served via a new /attachments/ route. Configurable retention period, image quality, max resolution, and scan interval. To fix modmail-dev#80
Changed the mongo query from `$ne: []` as it was matching 0 logs, now checking messages.attachments.0 instead which picks up the attachments and loads them correctly in the log viewer.
Added more detailed logging so you can understand what's happening in the console.
|
In general I like the idea but in my opinion most of the users are relying on the free mongodb tier which has limited data storage. So many of them wouldn't really benefit from this feature as it gets limited quickly by the said storage limitation. |
Understand your point, right now I have 72 archived attachments in my mongo database and it uses 3mb currently. However I did add the compression settings and retention periods. I think it probably depends how big your server is, this was tested in a 10k member server and we got those 72 images in 3 days. Any server that heavily relies on modmail more may have problems. |
What this does
Discord CDN links expire after about 24 hours so any images/attachments in old logs just break. This adds an optional background archiver that downloads them before they expire and stores them in Mongodb GridFS so they always load.
Fixes #80 - #80
Changes
Config
Off by default, set SAVE_ATTACHMENTS=yes to enable. All the options are in the env example file.
Edit
Just wanted to say I have 72 archived attachments in my mongo database and it uses 3mb currently.