diff --git a/app/public/style.css b/app/public/style.css index c4044a7..0342c99 100644 --- a/app/public/style.css +++ b/app/public/style.css @@ -169,11 +169,24 @@ html, body { justify-content: center; } -#gallery a:hover .tile-check, #gallery.select-mode .tile-check { opacity: 1; } +/* Hover reveal only where hover is real: iOS spends a first tap on it #294 */ +@media (hover: hover) { + #gallery a:hover .tile-check { + opacity: 1; + } +} + +/* Touch outside select mode: no invisible tap target. Long-press selects */ +@media (hover: none) { + #gallery:not(.select-mode) .tile-check { + pointer-events: none; + } +} + .tile-check svg { width: 16px; height: 16px; diff --git a/app/src/gallery/builder.ts b/app/src/gallery/builder.ts index d68824c..2a7045b 100644 --- a/app/src/gallery/builder.ts +++ b/app/src/gallery/builder.ts @@ -160,9 +160,12 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb metaBase } - // HTML gallery page cache time - const cacheTime = Math.max(0, getNumericConfigOption('ipp.gallery.cacheTime', 300)) - res.header('Cache-Control', 'public, max-age=' + cacheTime) + // HTML gallery page cache time. A password-protected gallery keeps the + // no-store that handleShareRequest set. + if (!share.password) { + const cacheTime = Math.max(0, getNumericConfigOption('ipp.gallery.cacheTime', 300)) + res.header('Cache-Control', 'public, max-age=' + cacheTime) + } res.send(renderPage(h(Gallery, props))) } diff --git a/app/src/http.ts b/app/src/http.ts index fa78ae5..fc69319 100644 --- a/app/src/http.ts +++ b/app/src/http.ts @@ -15,6 +15,13 @@ export function addResponseHeaders (res: Response): void { }) } +/** Stop browsers and shared caches storing a response from a password-protected share. */ +export function addNoStoreHeaders (res: Response): void { + res.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate') + res.set('Pragma', 'no-cache') + res.set('Expires', '0') +} + /** * Wrap an async route handler so a rejected promise is passed to Express's * error chain (and on to `errorHandler`). diff --git a/app/src/immich.ts b/app/src/immich.ts index 3b6215d..2e0012c 100644 --- a/app/src/immich.ts +++ b/app/src/immich.ts @@ -13,7 +13,7 @@ import { } from './types' import dayjs from 'dayjs' import { getConfigOption } from './config/access' -import { addResponseHeaders } from './http' +import { addNoStoreHeaders, addResponseHeaders } from './http' import { canDownload } from './share' import { log } from './utils/log' import { assetBuffer } from './stream/asset' @@ -162,11 +162,7 @@ export async function handleShareRequest (req: IncomingShareRequest, res: Respon } // Don't cache password-protected albums - if (sharedLinkRes.passwordRequired || req.password) { - res.header('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate') - res.header('Pragma', 'no-cache') - res.header('Expires', '0') - } + if (sharedLinkRes.passwordRequired || req.password) addNoStoreHeaders(res) // Password required - show the visitor the password page if (sharedLinkRes.passwordRequired) { @@ -495,14 +491,18 @@ export function fetchAssetDetail (asset: Asset): Promise { } /** - * Get the content-type of a video, for the lightbox