feat(backend): enhance social previews for single-file shares
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 42s
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:
@@ -110,19 +110,18 @@
|
||||
}
|
||||
|
||||
function chooseDefaultMode(type, tabs) {
|
||||
if (state.sizeBytes > LARGE_PREVIEW_BYTES) {
|
||||
if (type.isAudio && hasMode(tabs, "browser-audio")) {
|
||||
return "browser-audio";
|
||||
}
|
||||
return "default";
|
||||
}
|
||||
|
||||
if (type.isImage) {
|
||||
return "image";
|
||||
}
|
||||
if (type.isVideo) {
|
||||
return "video";
|
||||
}
|
||||
if (state.sizeBytes > LARGE_PREVIEW_BYTES) {
|
||||
if (type.isAudio && hasMode(tabs, "browser-audio")) {
|
||||
return "browser-audio";
|
||||
}
|
||||
return "default";
|
||||
}
|
||||
if (type.isAudio) {
|
||||
return "browser-audio";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user