#27 #66 #77 Add caption from image description metadata

This commit is contained in:
Alan Grainger
2025-05-05 12:25:30 +12:00
parent 4fd13219a6
commit fd73263cc1
8 changed files with 36 additions and 20 deletions
+2
View File
@@ -1,5 +1,7 @@
FROM node:lts-alpine FROM node:lts-alpine
RUN apk --no-cache add curl
WORKDIR /app WORKDIR /app
COPY app/ ./ COPY app/ ./
+9 -4
View File
@@ -2,9 +2,9 @@
<p align="center" width="100%"> <p align="center" width="100%">
<a href="https://hub.docker.com/r/alangrainger/immich-public-proxy/tags"> <a href="https://hub.docker.com/r/alangrainger/immich-public-proxy/tags">
<img alt="Docker pulls" src="https://badgen.net/docker/pulls/alangrainger/immich-public-proxy?v1.10.0&icon=docker&label=docker%20pulls&color=green&scale=1.1"></a> <img alt="Docker pulls" src="https://badgen.net/docker/pulls/alangrainger/immich-public-proxy?v1.11.0&icon=docker&label=docker%20pulls&color=green&scale=1.1"></a>
<a href="https://github.com/alangrainger/immich-public-proxy/releases/latest"> <a href="https://github.com/alangrainger/immich-public-proxy/releases/latest">
<img alt="Latest release" src="https://badgen.net/github/release/alangrainger/immich-public-proxy?v1.10.0&scale=1.1"></a> <img alt="Latest release" src="https://badgen.net/github/release/alangrainger/immich-public-proxy?v1.11.0&scale=1.1"></a>
<a href="https://immich-demo.note.sx/share/gJfs8l4LcJJrBUpjhMnDoKXFt1Tm5vKXPbXl8BgwPtLtEBCOOObqbQdV5i0oun5hZjQ"><img alt="Open demo gallery" src="https://badgen.net/static/↗🖼️/live%20demo/green?scale=1.1"></a> <a href="https://immich-demo.note.sx/share/gJfs8l4LcJJrBUpjhMnDoKXFt1Tm5vKXPbXl8BgwPtLtEBCOOObqbQdV5i0oun5hZjQ"><img alt="Open demo gallery" src="https://badgen.net/static/↗🖼️/live%20demo/green?scale=1.1"></a>
</p> </p>
@@ -148,6 +148,7 @@ There are some additional configuration options you can change, for example the
| `showGalleryTitle` | `bool` | Show a title on the gallery page. | | `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 | | `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 |
| `showHomePage` | `bool` | Set to `false` to remove the IPP shield page at `/` and at `/share` | | `showHomePage` | `bool` | Set to `false` to remove the IPP shield page at `/` and at `/share` |
| `showMetadata` | `object` | See the [Metadata](#metadata) section below. |
| `customInvalidResponse` | various | Send a custom response instead of the default 404 - see [Custom responses](docs/custom-responses.md) for more details. | | `customInvalidResponse` | various | Send a custom response instead of the default 404 - see [Custom responses](docs/custom-responses.md) for more details. |
For example, to disable the home page at `/` and at `/share` you need to change `showHomePage` to `false`: For example, to disable the home page at `/` and at `/share` you need to change `showHomePage` to `false`:
@@ -159,10 +160,14 @@ For example, to disable the home page at `/` and at `/share` you need to change
... ...
} }
} }
``` ```
#### Metadata
| Option | Type | Description |
|---------------|--------|----------------------------------------------------|
| `description` | `bool` | Show the description as a caption below the photo. |
### lightGallery ### lightGallery
The gallery is created using [lightGallery](https://github.com/sachinchoolur/lightGallery). The gallery is created using [lightGallery](https://github.com/sachinchoolur/lightGallery).
+4 -1
View File
@@ -7,9 +7,12 @@
"singleImageGallery": false, "singleImageGallery": false,
"singleItemAutoOpen": true, "singleItemAutoOpen": true,
"downloadOriginalPhoto": true, "downloadOriginalPhoto": true,
"showGalleryTitle": false,
"allowDownloadAll": 0, "allowDownloadAll": 0,
"showHomePage": true, "showHomePage": true,
"showGalleryTitle": false,
"showMetadata": {
"description": false
},
"customInvalidResponse": false "customInvalidResponse": false
}, },
"lightGallery": { "lightGallery": {
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "immich-public-proxy", "name": "immich-public-proxy",
"version": "1.9.1", "version": "1.11.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "immich-public-proxy", "name": "immich-public-proxy",
"version": "1.9.1", "version": "1.11.0",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"archiver": "^7.0.1", "archiver": "^7.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "immich-public-proxy", "name": "immich-public-proxy",
"version": "1.10.0", "version": "1.11.0",
"scripts": { "scripts": {
"dev": "ts-node src/index.ts", "dev": "ts-node src/index.ts",
"build": "npx tsc", "build": "npx tsc",
+1 -1
View File
@@ -122,7 +122,7 @@ class Render {
downloadUrl, downloadUrl,
thumbnailUrl: baseUrl + immich.photoUrl(share.key, asset.id, ImageSize.thumbnail), thumbnailUrl: baseUrl + immich.photoUrl(share.key, asset.id, ImageSize.thumbnail),
video, video,
description: asset?.exifInfo?.description ?? '' description: getConfigOption('ipp.showMetadata.description', false) && typeof asset?.exifInfo?.description === 'string' ? asset.exifInfo.description : ''
}) })
} }
res.render('gallery', { res.render('gallery', {
+7 -1
View File
@@ -32,6 +32,8 @@
<% <%
// Load the first 50 thumbnails, then load more as the user scrolls. See web.js // Load the first 50 thumbnails, then load more as the user scrolls. See web.js
items.slice(0, 50).forEach(item => { items.slice(0, 50).forEach(item => {
// Replace HTML entities for description text (if any)
item.description = item.description.replace(/'/g, '&apos;')
if (item.video) { %> if (item.video) { %>
<a data-video='<%- item.video %>' <a data-video='<%- item.video %>'
<% if (item.description) { %> <% if (item.description) { %>
@@ -65,7 +67,11 @@
<script src="/share/static/lg/lg-video.min.js"></script> <script src="/share/static/lg/lg-video.min.js"></script>
<script src="/share/static/lg/lg-zoom.min.js"></script> <script src="/share/static/lg/lg-zoom.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
lgallery.init(<%- JSON.stringify({lgConfig, items, openItem}) %>) // initLightGallery imported from web.js lgallery.init(<%- JSON.stringify({
lgConfig,
items,
openItem
}) %>) // initLightGallery imported from web.js
<% if (openItem) { %> <% if (openItem) { %>
const openItem = <%- openItem %> const openItem = <%- openItem %>
const thumbs = document.querySelectorAll('#lightgallery a') const thumbs = document.querySelectorAll('#lightgallery a')
+1 -1
View File
@@ -8,6 +8,6 @@ services:
environment: environment:
- IMMICH_URL=http://your-internal-immich-server:2283 - IMMICH_URL=http://your-internal-immich-server:2283
healthcheck: healthcheck:
test: wget -q -T 10 --spider http://localhost:3000/share/healthcheck || exit 1 test: curl -s http://localhost:3000/share/healthcheck -o /dev/null || exit 1
start_period: 10s start_period: 10s
timeout: 5s timeout: 5s