feat(backend): enhance social previews for single-file shares
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 42s

Implements dynamic Open Graph (OG) metadata and image generation for
single-file shared boxes to improve social media previews.

Changes include:
- Added a new route `/d/{boxID}/f/{fileID}/og-image.jpg` for file-specific OG images.
- Updated `DownloadPage` to dynamically set the page title, description, and OG image properties when a box contains only one file.
- Restricted raw media inline serving for social bots to images and videos.
- Added helper functions to format file share descriptions and determine appropriate social image URLs and types.
- Integrated basic font rendering to support dynamic OG image generation.
This commit is contained in:
2026-06-03 14:55:19 +03:00
parent 3a0dd04e61
commit 3b278642dc
9 changed files with 581 additions and 32 deletions

View File

@@ -23,10 +23,14 @@ type PageData struct {
BaseURL string
CanonicalURL string
Robots string
OGType string
Title string
Description string
ImageURL string
ImageAlt string
ImageType string
MediaURL string
MediaType string
CurrentYear int
CurrentUser any
CSRFToken string