Fix #246 Metadata is not hidden when "Show metadata" is disabled

This commit is contained in:
Alan Grainger
2026-06-09 09:30:36 +12:00
parent b40383e72e
commit e436fd36fb
4 changed files with 29 additions and 12 deletions
+5
View File
@@ -77,6 +77,11 @@ function groupItemsByMonth (): GroupSpec[] {
} }
g.indices.push(i) g.indices.push(i)
} }
// When every item is undated (typically because the share's "Show metadata"
// toggle stripped dates upstream), drop the lone "Undated" header
if (map.size === 1 && map.has('undated')) {
map.get('undated')!.label = null
}
return Array.from(map.values()) return Array.from(map.values())
} }
+8 -4
View File
@@ -37,9 +37,13 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
// Metadata display flags. Read once here and forwarded to the client via // Metadata display flags. Read once here and forwarded to the client via
// `metadataConfig` in the init JSON. // `metadataConfig` in the init JSON.
const descriptionInCaption = !!getConfigOption('ipp.showMetadata.description.caption', false) // The share owner's "Show metadata" toggle in Immich is a kill-switch over
const descriptionInSidebar = !!getConfigOption('ipp.showMetadata.description.sidebar', false) // the operator's own config: when explicitly `false`, no EXIF / location /
const sidebarHasContent = descriptionInSidebar || metadataGroupActive('exif') || metadataGroupActive('location') // description fields are surfaced, regardless of `ipp.showMetadata.*`
const shareMetadataAllowed = share.showMetadata !== false
const descriptionInCaption = shareMetadataAllowed && !!getConfigOption('ipp.showMetadata.description.caption', false)
const descriptionInSidebar = shareMetadataAllowed && !!getConfigOption('ipp.showMetadata.description.sidebar', false)
const sidebarHasContent = shareMetadataAllowed && (descriptionInSidebar || metadataGroupActive('exif') || metadataGroupActive('location'))
// Build structured items in parallel // Build structured items in parallel
const items: GalleryItem[] = await Promise.all(share.assets.map(async (asset): Promise<GalleryItem> => { const items: GalleryItem[] = await Promise.all(share.assets.map(async (asset): Promise<GalleryItem> => {
@@ -97,7 +101,7 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
height, height,
thumbhash: asset.thumbhash, thumbhash: asset.thumbhash,
fileCreatedAt: asset.fileCreatedAt, fileCreatedAt: asset.fileCreatedAt,
exif: pickExif(asset) exif: shareMetadataAllowed ? pickExif(asset) : undefined
} }
})) }))
+5
View File
@@ -68,6 +68,11 @@ export interface SharedLink {
description?: string; description?: string;
assets: Asset[]; assets: Asset[];
allowDownload?: boolean; allowDownload?: boolean;
// Per-share "Show metadata" toggle from Immich. When `false`, the share owner
// has asked that no EXIF / location / description / filename metadata be
// surfaced to viewers. We treat this as a kill-switch over the operator's
// own `ipp.showMetadata.*` config: see `gallery/builder.ts`.
showMetadata?: boolean;
password?: string; password?: string;
album?: { album?: {
id: string; id: string;
+6 -3
View File
@@ -76,12 +76,12 @@ For example, to disable the home page at `/` and at `/share`:
Options that control how the gallery page is rendered. Configured under `ipp.gallery`. Options that control how the gallery page is rendered. Configured under `ipp.gallery`.
| 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. |
| `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. |
| `groupByDate` | `bool` | Group the gallery's thumbnails by month, with headers like "December 2024" above each group. Sorts photos newest-first. Items missing a creation date end up under an "Undated" bucket at the end. Default `false`. | | `groupByDate` | `bool` | Group the gallery's thumbnails by month, with headers like "December 2024" above each group. Sorts photos newest-first. Items missing a creation date end up under an "Undated" bucket at the end (or render without any header when the whole gallery is undated). **Requires "Show metadata" to be enabled on the share in Immich** - when that's off, Immich strips creation dates from the assets it returns to IPP, so grouping won't work. Default `false`. |
Example: show the gallery title and group photos by month. Example: show the gallery title and group photos by month.
@@ -131,7 +131,10 @@ Configured under `ipp.showMetadata`. The lightbox includes a slide-in info sideb
Every per-field flag defaults to `false`. A field is sent to the client only when its flag is explicitly `true`. There is no master switch - this is deliberate, so that fields IPP adds in future releases don't auto-expose without your action. Every per-field flag defaults to `false`. A field is sent to the client only when its flag is explicitly `true`. There is no master switch - this is deliberate, so that fields IPP adds in future releases don't auto-expose without your action.
If Immich itself isn't exposing metadata for the share (the per-share toggle on the Immich side), no metadata is available regardless of these settings. The share owner's **"Show metadata"** toggle in Immich takes precedence over everything here: when it's off,
IPP suppresses all description / EXIF / location output and hides the info sidebar (and its toolbar toggle)
entirely, regardless of these settings. Note that with "Show metadata" off Immich also strips file creation
dates from non-album shares, so [date grouping](#gallery) won't work for those shares.
The info sidebar (and its toolbar toggle button) only appear when there is at least one section the operator has opted into - i.e. `description.sidebar` is true, or `exif` / `location` has at least one flag set to `true`. With all three off, the sidebar UI is suppressed. The info sidebar (and its toolbar toggle button) only appear when there is at least one section the operator has opted into - i.e. `description.sidebar` is true, or `exif` / `location` has at least one flag set to `true`. With all three off, the sidebar UI is suppressed.