Remove locked assets from shares
This commit is contained in:
+2
-1
@@ -204,7 +204,7 @@ async function fetchShareByKey (key: string, password?: string, keyType: KeyType
|
||||
log('Shared link ' + key + ' returned no assets array (type ' + link.type + ')')
|
||||
link.assets = []
|
||||
}
|
||||
// Drop trashed assets, and any Immich hasn't finished processing
|
||||
// Drop trashed and locked assets, and any Immich hasn't finished processing
|
||||
link.assets = servableAssets(link.assets)
|
||||
// Populate the shared assets with the public key/password
|
||||
link.assets.forEach(asset => {
|
||||
@@ -284,6 +284,7 @@ function timelineBucketToAssets (bucket: TimelineBucketAssets): Asset[] {
|
||||
localDateTime: localDateTimeFromOffset(fileCreatedAt, bucket.localOffsetHours?.[i]),
|
||||
thumbhash: bucket.thumbhash?.[i] || undefined,
|
||||
livePhotoVideoId: bucket.livePhotoVideoId?.[i] || undefined,
|
||||
visibility: bucket.visibility?.[i],
|
||||
width,
|
||||
height,
|
||||
needsDetail: true
|
||||
|
||||
+8
-5
@@ -1,4 +1,4 @@
|
||||
import { Asset, getConfigOption, KeyType, log, SharedLink, TtlLruCache } from '@ipp/core'
|
||||
import { Asset, AssetVisibility, getConfigOption, KeyType, log, SharedLink, TtlLruCache } from '@ipp/core'
|
||||
import { DownloadAll } from './types'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
@@ -72,14 +72,17 @@ export function uploadLink (share: SharedLink): string | undefined {
|
||||
const warnedUnprocessed = new TtlLruCache<true>({ ttlMs: 24 * 60 * 60_000, max: 1000 })
|
||||
|
||||
/**
|
||||
* Narrow a share's assets to what IPP can render: not trashed, and finished
|
||||
* processing in Immich. `thumbhash` is the readiness signal: Immich's
|
||||
* thumbnail job writes the files and only then sets it, so until it appears
|
||||
* every image URL IPP hands out would 404.
|
||||
* Narrow a share's assets to what IPP can render: not trashed, not in the
|
||||
* owner's locked folder, and finished processing in Immich. Immich's share
|
||||
* listing does not filter on visibility, so a locked asset has to go here.
|
||||
* `thumbhash` is the readiness signal: Immich's thumbnail job writes the
|
||||
* files and only then sets it, so until it appears every image URL IPP hands
|
||||
* out would 404.
|
||||
*/
|
||||
export function servableAssets (assets: Asset[]): Asset[] {
|
||||
return assets.filter(asset => {
|
||||
if (asset.isTrashed) return false
|
||||
if (asset.visibility === AssetVisibility.locked) return false
|
||||
if (asset.thumbhash) return true
|
||||
if (!warnedUnprocessed.get(asset.id)) {
|
||||
warnedUnprocessed.set(asset.id, true)
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
import { Request } from 'express-serve-static-core'
|
||||
import { KeyType } from '@ipp/core'
|
||||
import { AssetVisibility, KeyType } from '@ipp/core'
|
||||
|
||||
/**
|
||||
* One entry of `GET /timeline/buckets` - a time bucket (month) and its count.
|
||||
@@ -27,6 +27,7 @@ export interface TimelineBucketAssets {
|
||||
localOffsetHours: number[];
|
||||
// Motion photo (Live Photo) clip id; null for ordinary assets.
|
||||
livePhotoVideoId: (string | null)[];
|
||||
visibility: AssetVisibility[];
|
||||
}
|
||||
|
||||
export enum ImageSize {
|
||||
|
||||
Reference in New Issue
Block a user