#61 don't assume a fileCreatedAt property

This commit is contained in:
Alan Grainger
2025-02-02 21:16:10 +08:00
parent 5f19270df7
commit f1c7210685
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -152,9 +152,9 @@ class Immich {
// Sort album if there is a sort order specified // Sort album if there is a sort order specified
const sortOrder = link.album?.order const sortOrder = link.album?.order
if (sortOrder === 'asc') { if (sortOrder === 'asc') {
link.assets.sort((a, b) => a.fileCreatedAt.localeCompare(b.fileCreatedAt)) link.assets.sort((a, b) => a?.fileCreatedAt?.localeCompare(b.fileCreatedAt))
} else if (sortOrder === 'desc') { } else if (sortOrder === 'desc') {
link.assets.sort((a, b) => b.fileCreatedAt.localeCompare(a.fileCreatedAt)) link.assets.sort((a, b) => b?.fileCreatedAt?.localeCompare(a.fileCreatedAt))
} }
return { return {
valid: true, valid: true,
@@ -220,7 +220,7 @@ class Immich {
/** /**
* Return the image data URL for a photo * Return the image data URL for a photo
*/ */
photoUrl (key: string, id: string, size?: ImageSize, password?: string) { photoUrl (key: string, id: string, size?: ImageSize) {
const path = ['photo', key, id] const path = ['photo', key, id]
if (size) path.push(size) if (size) path.push(size)
return this.buildUrl('/share/' + path.join('/')) return this.buildUrl('/share/' + path.join('/'))
@@ -229,7 +229,7 @@ class Immich {
/** /**
* Return the video data URL for a video * Return the video data URL for a video
*/ */
videoUrl (key: string, id: string, password?: string) { videoUrl (key: string, id: string) {
return this.buildUrl(`/share/video/${key}/${id}`) return this.buildUrl(`/share/video/${key}/${id}`)
} }
+4 -4
View File
@@ -94,7 +94,7 @@ class Render {
video = JSON.stringify({ video = JSON.stringify({
source: [ source: [
{ {
src: immich.videoUrl(share.key, asset.id, asset.password), src: immich.videoUrl(share.key, asset.id),
type: await immich.getVideoContentType(asset) type: await immich.getVideoContentType(asset)
} }
], ],
@@ -106,12 +106,12 @@ class Render {
} }
if (getConfigOption('ipp.downloadOriginalPhoto', true)) { if (getConfigOption('ipp.downloadOriginalPhoto', true)) {
// Add a download link for the original-size image, if configured in config.json // Add a download link for the original-size image, if configured in config.json
downloadUrl = immich.photoUrl(share.key, asset.id, ImageSize.original, asset.password) downloadUrl = immich.photoUrl(share.key, asset.id, ImageSize.original)
} }
items.push({ items.push({
previewUrl: immich.photoUrl(share.key, asset.id, ImageSize.preview, asset.password), previewUrl: immich.photoUrl(share.key, asset.id, ImageSize.preview),
downloadUrl, downloadUrl,
thumbnailUrl: immich.photoUrl(share.key, asset.id, ImageSize.thumbnail, asset.password), thumbnailUrl: immich.photoUrl(share.key, asset.id, ImageSize.thumbnail),
video video
}) })
} }