#149 Add option to keep original filename when downloading

This commit is contained in:
Alan Grainger
2025-10-28 17:03:00 +08:00
parent 2f3fd7cacb
commit 0a19d8af7e
5 changed files with 14 additions and 4 deletions
+1
View File
@@ -7,6 +7,7 @@
"singleImageGallery": false,
"singleItemAutoOpen": true,
"downloadOriginalPhoto": true,
"downloadedFilename": 0,
"allowDownloadAll": 0,
"allowSlugLinks": true,
"showHomePage": true,
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "immich-public-proxy",
"version": "1.13.7",
"version": "1.14.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "immich-public-proxy",
"version": "1.13.7",
"version": "1.14.0",
"license": "AGPL-3.0",
"dependencies": {
"archiver": "^7.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich-public-proxy",
"version": "1.13.7",
"version": "1.14.0",
"scripts": {
"dev": "ts-node src/index.ts",
"build": "npx tsc",
+9 -1
View File
@@ -137,12 +137,20 @@ class Render {
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, ''') : ''
// Filename for the downloaded image
let filename = 'img_' + Date.now()
if (getConfigOption('ipp.downloadedFilename') === 1) {
filename = asset.originalFileName || filename
} else if (getConfigOption('ipp.downloadedFilename') === 2) {
filename = asset.id
}
// Create the full HTML element source to pass to the gallery view
const itemHtml = [
video ? `<a data-video='${video}'` : `<a href="${previewUrl}"`,
downloadUrl ? ` data-download-url="${downloadUrl}"` : '',
description ? ` data-sub-html='<p>${description}</p>'` : '',
`><img alt="" src="${thumbnailUrl}"/>`,
` data-download="${filename}"><img alt="" src="${thumbnailUrl}"/>`,
video ? '<div class="play-icon"></div>' : '',
'</a>'
].join('')