This commit is contained in:
Alan Grainger
2024-10-29 15:07:54 +01:00
parent 85b1d8de09
commit 9ddfbcec67
6 changed files with 141 additions and 67 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
import immich from './immich'
import { Response } from 'express-serve-static-core'
import { Asset, AssetType, ImageSize } from './types'
import { Asset, AssetType, ImageSize, SharedLink } from './types'
import dayjs from 'dayjs'
class Render {
@@ -17,16 +17,16 @@ class Render {
}
}
async gallery (res: Response, assets: Asset[], openItem?: number) {
async gallery (res: Response, share: SharedLink, openItem?: number) {
const items = []
for (const asset of assets) {
for (const asset of share.assets) {
let video
if (asset.type === AssetType.video) {
// Populate the data-video property
video = JSON.stringify({
source: [
{
src: immich.videoUrl(asset.id),
src: immich.videoUrl(share.key, asset.id),
type: await immich.getContentType(asset)
}
],
@@ -37,8 +37,8 @@ class Render {
})
}
items.push({
originalUrl: immich.photoUrl(asset.id),
thumbnailUrl: immich.photoUrl(asset.id, ImageSize.thumbnail),
originalUrl: immich.photoUrl(share.key, asset.id),
thumbnailUrl: immich.photoUrl(share.key, asset.id, ImageSize.thumbnail),
video
})
}