Add config option for direct link to single video share

This commit is contained in:
Alan Grainger
2026-07-24 10:06:21 +12:00
parent 88167d9965
commit 862ff269b7
3 changed files with 9 additions and 3 deletions
+1
View File
@@ -39,6 +39,7 @@
"customInvalidResponse": false, "customInvalidResponse": false,
"gallery": { "gallery": {
"singleImage": false, "singleImage": false,
"singleVideo": true,
"singleItemAutoOpen": true, "singleItemAutoOpen": true,
"showTitle": true, "showTitle": true,
"showDescription": false, "showDescription": false,
+7 -3
View File
@@ -202,9 +202,13 @@ export async function handleShareRequest (req: IncomingShareRequest, res: Respon
// This is an individual item (not a gallery) // This is an individual item (not a gallery)
log('Serving link ' + req.key) log('Serving link ' + req.key)
const asset = link.assets[0] const asset = link.assets[0]
if ((asset.type === AssetType.image || asset.type === AssetType.video) && !getConfigOption('ipp.gallery.singleImage') && !req.password) { // Photos default to a direct image unless `singleImage` opts into a gallery;
// For photos and videos, output them directly unless configured to show a gallery, // videos default to a gallery unless `singleVideo` is explicitly disabled.
// or unless it's a password-protected link const directImage = asset.type === AssetType.image && !getConfigOption('ipp.gallery.singleImage')
const directVideo = asset.type === AssetType.video && !getConfigOption('ipp.gallery.singleVideo', true)
if ((directImage || directVideo) && !req.password) {
// Output the asset directly rather than a gallery page, unless it's a
// password-protected link
await assetBuffer(req, res, link.assets[0], ImageSize.preview) await assetBuffer(req, res, link.assets[0], ImageSize.preview)
} else { } else {
// Show a gallery page // Show a gallery page
+1
View File
@@ -81,6 +81,7 @@ Options that control how the gallery page is rendered. Configured under `ipp.gal
| Option | Type | Description | | Option | Type | Description |
|----------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |----------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `singleImage` | `bool` | By default a link to a single image will directly open the image file. Set to `true` if you want to show a gallery page instead for a single item. | | `singleImage` | `bool` | By default a link to a single image will directly open the image file. Set to `true` if you want to show a gallery page instead for a single item. |
| `singleVideo` | `bool` | When a share contains a single video, show a gallery page (Default `true`). Set to `false` to link directly to the video file instead. |
| `singleItemAutoOpen` | `bool` | When a share contains a single item and is opened on its gallery page, automatically open the lightbox on the asset. Default `true`. | | `singleItemAutoOpen` | `bool` | When a share contains a single item and is opened on its gallery page, automatically open the lightbox on the asset. Default `true`. |
| `showTitle` | `bool` | Show a title on the gallery page. This is taken from the album title if it is an album being shared, otherwise the "Description" from the shared link will be used. | | `showTitle` | `bool` | Show a title on the gallery page. This is taken from the album title if it is an album being shared, otherwise the "Description" from the shared link will be used. |
| `showDescription` | `bool` | Show the album description below the title. This only applies if it is an album which is being shared. | | `showDescription` | `bool` | Show the album description below the title. This only applies if it is an album which is being shared. |