#307 Add ipp.shareCacheTime and cachebusted link after an upload

This commit is contained in:
Alan Grainger
2026-10-19 14:42:43 +13:00
parent 8bf1d753aa
commit a958559247
11 changed files with 159 additions and 11 deletions
+1
View File
@@ -51,6 +51,7 @@ export const LABELS: Record<string, string> = {
'ipp.gallery.singleImage': 'Gallery page for a single image',
'ipp.gallery.singleVideo': 'Gallery page for a single video',
'ipp.gallery.singleItemAutoOpen': 'Open single items in the lightbox',
'ipp.shareCacheTime': 'Share cache time (seconds)',
'ipp.gallery.cacheTime': 'Cache time (seconds)',
'ipp.lightbox.autoPlayVideos': 'Autoplay videos',
'ipp.showMetadata.exif.dateTimeOriginal': 'Date taken',
+10
View File
@@ -146,6 +146,16 @@ Where the optional upload service (the `immich-public-proxy-upload` container) i
- **An absolute URL**, such as `https://upload.example.com`, means the service has a hostname of its own. It is trusted without a check. The URL may include a path, such as `https://photos.example.com/upload`, which points at the same place as the default but without the check.
- **An empty string** never shows the button.
## `shareCacheTime`
**Type:** `int` · **Default:** `120`
How long, in seconds, IPP keeps a share's list of photos in memory before it asks Immich again. Photos added to a share, including [visitor uploads](/visitor-uploads#when-do-uploads-appear), don't show in the gallery until this runs out. The minimum is `1`.
A shorter time costs more calls to Immich. Each refresh of an album takes one call, plus one for each month that has photos in it, so an album that spans two years takes about 25 calls. While someone is viewing that album, IPP refreshes it once per `shareCacheTime`: about 12 calls a minute at the default, and about 100 a minute at `15`. A share that nobody is viewing costs nothing.
Other visitors also wait for [`gallery.cacheTime`](/config/gallery#cachetime), a separate cache in their browser. The visitor who sent the photo skips that one: the upload page's "Back to gallery" link fetches a fresh copy of the gallery page.
## `gallery`
**Type:** `object`
+1 -1
View File
@@ -48,7 +48,7 @@ have no album.
Two things to know:
- The upload is pulled back, not held back. The workflow runs a few seconds after the file is stored, and IPP
caches a share's photo list for up to 2 minutes, so a visitor who has the gallery open can see the photo for a
caches a share's photo list for [`shareCacheTime`](/config/ipp-options#sharecachetime), 2 minutes by default, so a visitor who has the gallery open can see the photo for a
short while. Anyone who copied the photo's address in that window can keep opening it until you delete it.
- Keeping a photo relies on Immich leaving it in the album while it is locked, which it does for photos a workflow
moves. If a future Immich version removes it from the album instead, add the approved photos back to the album
+5 -2
View File
@@ -315,11 +315,14 @@ The owner sees them in Immich at once. Other visitors see them in the gallery on
1. Immich has made the thumbnail. That takes seconds for a photo and longer for a video, and IPP hides a photo until
then.
2. IPP's cache of the share has expired. It is kept for up to 2 minutes.
2. IPP's cache of the share has expired. It is kept for [`shareCacheTime`](/config/ipp-options#sharecachetime),
2 minutes by default. You can lower it, at the cost of more calls to Immich.
3. The visitor's browser has fetched the gallery page again. It keeps the page for
[`gallery.cacheTime`](/config/gallery#cachetime), 5 minutes by default.
So a new photo can take up to about 7 minutes to show for a visitor who already had the gallery open. The upload page
So a new photo can take up to about 7 minutes to show for a visitor who already had the gallery open. The visitor
who sent it skips step 3: after an upload, the upload page's "Back to gallery" link fetches a fresh copy of the
gallery page. The upload page
includes a short notice to let visitors know about the delay; you can change the wording or hide it with the
[`notice`](/config/upload-service#notice) option.