feat: image optimization — client-side resize + server-side thumbnails

Avatars/banners now resize to max 512px/1920px and convert to WebP before
upload (zero server cost). Chat image uploads generate an 800px-wide WebP
thumbnail via Sharp; the feed shows the thumbnail, click opens the full-res
original. Adds lazy loading to avatars. Federation-compatible: remote
instances without this feature fall back gracefully.
This commit is contained in:
Jannis Braun
2026-03-13 16:44:14 +01:00
parent 12b450b7b9
commit 3e97c2b0f5
19 changed files with 449 additions and 20 deletions
+6
View File
@@ -44,6 +44,12 @@ export function runMigrations(db: Database.Database): void {
{ name: 'closed', type: 'INTEGER DEFAULT 0' }
]
},
{
name: 'attachments',
columns: [
{ name: 'thumbnail_filename', type: 'TEXT' }
]
},
{
name: 'dm_channels',
columns: [
+1
View File
@@ -85,6 +85,7 @@ export const attachments = sqliteTable('attachments', {
originalName: text('original_name').notNull(),
mimetype: text('mimetype').notNull(),
size: integer('size').notNull(),
thumbnailFilename: text('thumbnail_filename'),
createdAt: integer('created_at').notNull(),
});