Add config option for direct link to single video share
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
"customInvalidResponse": false,
|
||||
"gallery": {
|
||||
"singleImage": false,
|
||||
"singleVideo": true,
|
||||
"singleItemAutoOpen": true,
|
||||
"showTitle": true,
|
||||
"showDescription": false,
|
||||
|
||||
+7
-3
@@ -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
|
||||
|
||||
@@ -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. |
|
||||
|
||||
Reference in New Issue
Block a user