#162 revert previous - fullsize Immich API appears to not yet be functional
This commit is contained in:
@@ -22,7 +22,6 @@ import { thumbHashToDataURL } from '/share/static/thumbhash/thumbhash.js'
|
||||
* @property {'IMAGE'|'VIDEO'} type
|
||||
* @property {string} previewUrl
|
||||
* @property {string} thumbnailUrl
|
||||
* @property {string} [fullsizeUrl] Optional full-res JPEG; used as the zoom-upgrade target in the lightbox
|
||||
* @property {string} [downloadUrl]
|
||||
* @property {string} [videoData] JSON-stringified video source info
|
||||
* @property {string} [description] Escaped HTML fragment for the lightbox caption
|
||||
|
||||
+5
-17
@@ -78,22 +78,19 @@ class Render {
|
||||
* Map an ImageSize to the Immich endpoint that serves it.
|
||||
*
|
||||
* Policy: when `ipp.downloadOriginalPhoto` is off, requests for the original
|
||||
* or fullsize image are silently downgraded to preview — the operator has
|
||||
* opted out of serving full-resolution files. (The original may also be a
|
||||
* RAW/HEIC file the browser can't render.)
|
||||
* image are silently downgraded to preview — the operator has opted out of
|
||||
* serving full-resolution files. (The original may also be a RAW/HEIC file
|
||||
* the browser can't render.)
|
||||
*/
|
||||
private resolveImageEndpoint (size: ImageSize): { subpath: string; sizeQueryParam?: string; attachment: boolean } {
|
||||
const allowOriginal = getConfigOption('ipp.downloadOriginalPhoto', true)
|
||||
if (size === ImageSize.original && allowOriginal) {
|
||||
return { subpath: '/original', attachment: true }
|
||||
}
|
||||
if (size === ImageSize.fullsize && allowOriginal) {
|
||||
return { subpath: '/thumbnail', sizeQueryParam: 'fullsize', attachment: false }
|
||||
}
|
||||
if (size === ImageSize.thumbnail) {
|
||||
return { subpath: '/thumbnail', attachment: false }
|
||||
}
|
||||
// preview, or original/fullsize downgraded because downloadOriginalPhoto is off
|
||||
// preview, or original downgraded because downloadOriginalPhoto is off
|
||||
return { subpath: '/thumbnail', sizeQueryParam: 'preview', attachment: false }
|
||||
}
|
||||
|
||||
@@ -140,15 +137,7 @@ class Render {
|
||||
}
|
||||
|
||||
const thumbnailUrl = immich.photoUrl(share.key, asset.id, ImageSize.thumbnail)
|
||||
const previewSize = immich.getPreviewImageSize(asset)
|
||||
const previewUrl = immich.photoUrl(share.key, asset.id, previewSize)
|
||||
// Emit a zoom-upgrade URL for the lightbox only when it would actually
|
||||
// be larger than the preview. GIFs already serve as `original` (to keep
|
||||
// animation), and if the operator has disabled original downloads they
|
||||
// don't want full-res served at all.
|
||||
const fullsizeUrl = previewSize === ImageSize.preview && getConfigOption('ipp.downloadOriginalPhoto', true)
|
||||
? immich.photoUrl(share.key, asset.id, ImageSize.fullsize)
|
||||
: undefined
|
||||
const previewUrl = immich.photoUrl(share.key, asset.id, immich.getPreviewImageSize(asset))
|
||||
const description = getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string'
|
||||
? escapeHtml(asset.exifInfo.description)
|
||||
: ''
|
||||
@@ -165,7 +154,6 @@ class Render {
|
||||
type: asset.type,
|
||||
previewUrl,
|
||||
thumbnailUrl,
|
||||
fullsizeUrl,
|
||||
downloadUrl,
|
||||
videoData,
|
||||
description: description || undefined,
|
||||
|
||||
@@ -71,7 +71,6 @@ export interface SharedLinkResult {
|
||||
export enum ImageSize {
|
||||
thumbnail = 'thumbnail',
|
||||
preview = 'preview',
|
||||
fullsize = 'fullsize',
|
||||
original = 'original'
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,6 @@ export interface GalleryItem {
|
||||
type: AssetType
|
||||
previewUrl: string
|
||||
thumbnailUrl: string
|
||||
// Full-resolution JPEG render. Omitted for GIFs (preview is already the
|
||||
// original, so animation is preserved) and when ipp.downloadOriginalPhoto
|
||||
// is off (operator opted out of serving full-res). When present, the
|
||||
// lightbox swaps to this on zoom.
|
||||
fullsizeUrl?: string
|
||||
downloadUrl?: string
|
||||
// pre-stringified JSON describing the video source (used to build a <video>
|
||||
// element for video slides in the PhotoSwipe lightbox)
|
||||
|
||||
Reference in New Issue
Block a user