From 862ff269b7b4746f9b06f70c764f0670d4073c12 Mon Sep 17 00:00:00 2001 From: Alan Grainger <16197738+alangrainger@users.noreply.github.com> Date: Fri, 24 Jul 2026 10:06:21 +1200 Subject: [PATCH] Add config option for direct link to single video share --- app/config.json | 1 + app/src/immich.ts | 10 +++++++--- docs/configuration.md | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/config.json b/app/config.json index 7021cef..d8ec2e5 100644 --- a/app/config.json +++ b/app/config.json @@ -39,6 +39,7 @@ "customInvalidResponse": false, "gallery": { "singleImage": false, + "singleVideo": true, "singleItemAutoOpen": true, "showTitle": true, "showDescription": false, diff --git a/app/src/immich.ts b/app/src/immich.ts index 199062c..1f1584d 100644 --- a/app/src/immich.ts +++ b/app/src/immich.ts @@ -202,9 +202,13 @@ export async function handleShareRequest (req: IncomingShareRequest, res: Respon // This is an individual item (not a gallery) log('Serving link ' + req.key) const asset = link.assets[0] - if ((asset.type === AssetType.image || asset.type === AssetType.video) && !getConfigOption('ipp.gallery.singleImage') && !req.password) { - // For photos and videos, output them directly unless configured to show a gallery, - // or unless it's a password-protected link + // Photos default to a direct image unless `singleImage` opts into a gallery; + // videos default to a gallery unless `singleVideo` is explicitly disabled. + 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) } else { // Show a gallery page diff --git a/docs/configuration.md b/docs/configuration.md index d6ea3d6..b691f84 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -81,6 +81,7 @@ Options that control how the gallery page is rendered. Configured under `ipp.gal | 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. | +| `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`. | | `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. |