From 0a19d8af7e506b28608d741ac35392beb74321f6 Mon Sep 17 00:00:00 2001
From: Alan Grainger <16197738+alangrainger@users.noreply.github.com>
Date: Tue, 28 Oct 2025 17:03:00 +0800
Subject: [PATCH] #149 Add option to keep original filename when downloading
---
README.md | 1 +
app/config.json | 1 +
app/package-lock.json | 4 ++--
app/package.json | 2 +-
app/src/render.ts | 10 +++++++++-
5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 66401d1..76696ff 100644
--- a/README.md
+++ b/README.md
@@ -151,6 +151,7 @@ Alternatively, you can [pass the configuration inline](docs/inline-configuration
| `responseHeaders` | `object` | Change the headers sent with your web responses. By default there is `cache-control` and CORS added. |
| `singleImageGallery` | `bool` | By default a link to a single image will directly open the image file. Set to `true` if you want to show a gallery page instead for a single item. |
| `downloadOriginalPhoto` | `bool` | Set to `false` if you only want people to be able to download the 'preview' quality photo, rather than your original photo. |
+| `downloadedFilename` | `int` | The filename of the downloaded image.
`0` for the current time
`1` for the original filename
`2` for the Immich asset ID number |
| `showGalleryTitle` | `bool` | Show a title on the gallery page. |
| `allowDownloadAll` | `int` | Allow visitors to download all files as a zip.
`0` disable downloads
`1` follow Immich setting per share ([example](https://github.com/user-attachments/assets/79ea8c08-71ce-42ab-b025-10aec384938a))
`2` always allowed |
| `allowSlugLinks` | `bool` | Enable/disable the custom URL links. |
diff --git a/app/config.json b/app/config.json
index 6e8e92d..2e7c744 100644
--- a/app/config.json
+++ b/app/config.json
@@ -7,6 +7,7 @@
"singleImageGallery": false,
"singleItemAutoOpen": true,
"downloadOriginalPhoto": true,
+ "downloadedFilename": 0,
"allowDownloadAll": 0,
"allowSlugLinks": true,
"showHomePage": true,
diff --git a/app/package-lock.json b/app/package-lock.json
index 066a3f6..92cbe78 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -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",
diff --git a/app/package.json b/app/package.json
index 8a92dc5..9f8b911 100644
--- a/app/package.json
+++ b/app/package.json
@@ -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",
diff --git a/app/src/render.ts b/app/src/render.ts
index 6d4cc94..2901396 100644
--- a/app/src/render.ts
+++ b/app/src/render.ts
@@ -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 ? `
`,
+ ` data-download="${filename}">
`,
video ? '' : '',
''
].join('')