From 6c98fe515c2354e26c803737ae57ff8888b0d241 Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Fri, 25 Apr 2025 07:46:51 +1200 Subject: [PATCH 1/5] Update docs --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5f3c1b5..2d5c4dc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # Immich Public Proxy +## WARNING - Don't update to Immich v1.132 + +This will cause IPP to stop functioning. I'm working to resolve this. + +See https://github.com/alangrainger/immich-public-proxy/issues/87 + +--- +

Docker pulls From 07064d1a44e012be609b81b7bb0a0b0bedd8a4dc Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Fri, 25 Apr 2025 07:54:18 +1200 Subject: [PATCH 2/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d5c4dc..591b854 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Immich Public Proxy -## WARNING - Don't update to Immich v1.132 +## 🚨 WARNING - Don't update to Immich v1.132+ 🚨 -This will cause IPP to stop functioning. I'm working to resolve this. +This will cause IPP to stop functioning, as Immich no longer outputs shared album info without an API key. I'm working to resolve this. See https://github.com/alangrainger/immich-public-proxy/issues/87 From b538e12f64925c8e068d0001536bf01fee06c0d9 Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Fri, 25 Apr 2025 08:19:05 +1200 Subject: [PATCH 3/5] #87 fetch album assets separately to address change in Immich 1.132+ --- app/src/immich.ts | 35 ++++++++++++++++++++++++++++++++--- app/src/types.ts | 10 ++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/app/src/immich.ts b/app/src/immich.ts index ec0107a..6aa67e7 100644 --- a/app/src/immich.ts +++ b/app/src/immich.ts @@ -1,4 +1,13 @@ -import { Asset, AssetType, ImageSize, IncomingShareRequest, SharedLink, SharedLinkResult } from './types' +import { + Album, + AlbumType, + Asset, + AssetType, + ImageSize, + IncomingShareRequest, + SharedLink, + SharedLinkResult +} from './types' import dayjs from 'dayjs' import { addResponseHeaders, canDownload, getConfigOption, log } from './functions' import render from './render' @@ -94,14 +103,15 @@ class Immich { respondToInvalidRequest(res, 404) return } + const link = sharedLinkRes.link // Make sure there are some photo/video assets for this link - const link = sharedLinkRes.link + /* if (!link.assets.length) { log('No assets for key ' + request.key) respondToInvalidRequest(res, 404) return - } + } */ // Everything is ok - output the shared link data @@ -145,6 +155,25 @@ class Immich { if (res.status === 200) { // Normal response - get the shared assets link = jsonBody as SharedLink + + // For an album, we need to make a second request to Immich to populate + // the array of assets + if (link.type === AlbumType.album) { + const albumRes = await fetch(this.buildUrl(this.apiUrl() + '/albums/' + link?.album?.id, { + key, + password + })) + const album = await albumRes.json() as Album + if (!album?.id) { + log('Invalid album ID - ' + link?.album?.id) + return { + valid: false + } + } + // Replace the empty link.assets array with the array of assets from the album + link.assets = album.assets + } + link.password = password if (link.expiresAt && dayjs(link.expiresAt) < dayjs()) { // This link has expired diff --git a/app/src/types.ts b/app/src/types.ts index 8ac6d84..c86a402 100644 --- a/app/src/types.ts +++ b/app/src/types.ts @@ -5,6 +5,11 @@ export enum AssetType { video = 'VIDEO' } +export enum AlbumType { + album = 'ALBUM', + individual = 'INDIVIDUAL' +} + export interface Asset { id: string; key: string; @@ -15,6 +20,11 @@ export interface Asset { isTrashed: boolean; } +export interface Album { + id: string; + assets: Asset[]; +} + export interface SharedLink { key: string; type: string; From 437c941f4eff0110538b2ead1b445b6c3c5fe488 Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Fri, 25 Apr 2025 08:30:13 +1200 Subject: [PATCH 4/5] #87 fetch album assets separately to address change in Immich 1.132+ --- Dockerfile | 2 -- README.md | 12 ++---------- app/package.json | 2 +- docker-compose.yml | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9f671f..d6e1883 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,4 @@ ENV NODE_ENV=production # Type checking is done in the repo before building the image. RUN npx tsc --noCheck -HEALTHCHECK --interval=30s --start-period=10s --timeout=5s CMD wget -q --spider http://localhost:3000/share/healthcheck || exit 1 - CMD ["node", "dist/index.js" ] diff --git a/README.md b/README.md index 591b854..07b7fbb 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,10 @@ # Immich Public Proxy -## 🚨 WARNING - Don't update to Immich v1.132+ 🚨 - -This will cause IPP to stop functioning, as Immich no longer outputs shared album info without an API key. I'm working to resolve this. - -See https://github.com/alangrainger/immich-public-proxy/issues/87 - ---- -

- Docker pulls + Docker pulls - Latest release + Latest release Open demo gallery

diff --git a/app/package.json b/app/package.json index 8bd39af..9577e7b 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "immich-public-proxy", - "version": "1.9.1", + "version": "1.10.0", "scripts": { "dev": "ts-node src/index.ts", "build": "npx tsc", diff --git a/docker-compose.yml b/docker-compose.yml index 1e86a81..130a3bd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,6 @@ services: environment: - IMMICH_URL=http://your-internal-immich-server:2283 healthcheck: - test: wget -q --spider http://localhost:3000/share/healthcheck || exit 1 + test: wget -q --connect-timeout=10 --tries=1 --spider http://localhost:3000/share/healthcheck || exit 1 start_period: 10s timeout: 5s From 01812fb43a4b4edad48c472604f76edc11453387 Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Fri, 25 Apr 2025 08:41:44 +1200 Subject: [PATCH 5/5] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 130a3bd..ac3d96f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,6 @@ services: environment: - IMMICH_URL=http://your-internal-immich-server:2283 healthcheck: - test: wget -q --connect-timeout=10 --tries=1 --spider http://localhost:3000/share/healthcheck || exit 1 + test: wget -q -T 10 --spider http://localhost:3000/share/healthcheck || exit 1 start_period: 10s timeout: 5s