#149 Add option to keep original filename when downloading
This commit is contained in:
@@ -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.<br>`0` for the current time<br>`1` for the original filename<br>`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.<br>`0` disable downloads<br>`1` follow Immich setting per share ([example](https://github.com/user-attachments/assets/79ea8c08-71ce-42ab-b025-10aec384938a))<br>`2` always allowed |
|
||||
| `allowSlugLinks` | `bool` | Enable/disable the custom URL links. |
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"singleImageGallery": false,
|
||||
"singleItemAutoOpen": true,
|
||||
"downloadOriginalPhoto": true,
|
||||
"downloadedFilename": 0,
|
||||
"allowDownloadAll": 0,
|
||||
"allowSlugLinks": true,
|
||||
"showHomePage": true,
|
||||
|
||||
Generated
+2
-2
@@ -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
@@ -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
@@ -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('')
|
||||
|
||||
Reference in New Issue
Block a user