Prettier
This commit is contained in:
+36
-36
@@ -111,45 +111,45 @@ class Render {
|
|||||||
|
|
||||||
// Use .map to generate an array of promises, then await them all to load in parallel.
|
// Use .map to generate an array of promises, then await them all to load in parallel.
|
||||||
const items = await Promise.all(share.assets.map(async (asset) => {
|
const items = await Promise.all(share.assets.map(async (asset) => {
|
||||||
let video, downloadUrl
|
let video, downloadUrl
|
||||||
if (asset.type === AssetType.video) {
|
if (asset.type === AssetType.video) {
|
||||||
// Populate the data-video property
|
// Populate the data-video property
|
||||||
video = JSON.stringify({
|
video = JSON.stringify({
|
||||||
source: [
|
source: [
|
||||||
{
|
{
|
||||||
src: immich.videoUrl(share.key, asset.id),
|
src: immich.videoUrl(share.key, asset.id),
|
||||||
type: await immich.getVideoContentType(asset)
|
type: await immich.getVideoContentType(asset)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
attributes: {
|
attributes: {
|
||||||
playsinline: 'playsinline',
|
playsinline: 'playsinline',
|
||||||
controls: 'controls'
|
controls: 'controls'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
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)
|
downloadUrl = immich.photoUrl(share.key, asset.id, ImageSize.original)
|
||||||
}
|
}
|
||||||
|
|
||||||
const thumbnailUrl = immich.photoUrl(share.key, asset.id, ImageSize.thumbnail)
|
const thumbnailUrl = immich.photoUrl(share.key, asset.id, ImageSize.thumbnail)
|
||||||
const previewUrl = immich.photoUrl(share.key, asset.id, immich.getPreviewImageSize(asset))
|
const previewUrl = immich.photoUrl(share.key, asset.id, immich.getPreviewImageSize(asset))
|
||||||
const description = getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description.replace(/'/g, ''') : ''
|
const description = getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description.replace(/'/g, ''') : ''
|
||||||
|
|
||||||
// Create the full HTML element source to pass to the gallery view
|
// Create the full HTML element source to pass to the gallery view
|
||||||
const itemHtml = [
|
const itemHtml = [
|
||||||
video ? `<a data-video='${video}'` : `<a href="${previewUrl}"`,
|
video ? `<a data-video='${video}'` : `<a href="${previewUrl}"`,
|
||||||
downloadUrl ? ` data-download-url="${downloadUrl}"` : '',
|
downloadUrl ? ` data-download-url="${downloadUrl}"` : '',
|
||||||
description ? ` data-sub-html='<p>${description}</p>'` : '',
|
description ? ` data-sub-html='<p>${description}</p>'` : '',
|
||||||
` data-download="${this.getFilename(asset)}"><img alt="" src="${thumbnailUrl}"/>`,
|
` data-download="${this.getFilename(asset)}"><img alt="" src="${thumbnailUrl}"/>`,
|
||||||
video ? '<div class="play-icon"></div>' : '',
|
video ? '<div class="play-icon"></div>' : '',
|
||||||
'</a>'
|
'</a>'
|
||||||
].join('')
|
].join('')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
html: itemHtml,
|
html: itemHtml,
|
||||||
thumbnailUrl
|
thumbnailUrl
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
res.render('gallery', {
|
res.render('gallery', {
|
||||||
|
|||||||
Reference in New Issue
Block a user