From 28c2ed696c713306747a61f7a4b6b85adc4d748f Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Fri, 1 Nov 2024 14:19:15 +0100 Subject: [PATCH] Add album title #8 --- package.json | 2 +- src/render.ts | 10 +++++++++- src/types.ts | 2 ++ views/gallery.ejs | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f34327c..349ced8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "immich-public-proxy", - "version": "1.3.0", + "version": "1.3.1", "scripts": { "dev": "ts-node src/index.ts", "build": "npx tsc", diff --git a/src/render.ts b/src/render.ts index 9c63924..a557a18 100644 --- a/src/render.ts +++ b/src/render.ts @@ -49,9 +49,17 @@ class Render { } res.render('gallery', { items, - openItem + openItem, + title: this.title(share) }) } + + /** + * Attempt to get a title from the link description or the album title + */ + title (share: SharedLink) { + return share.description || share?.album?.albumName || '' + } } const render = new Render() diff --git a/src/types.ts b/src/types.ts index b384766..8270a73 100644 --- a/src/types.ts +++ b/src/types.ts @@ -14,9 +14,11 @@ export interface Asset { export interface SharedLink { key: string; type: string; + description?: string; assets: Asset[]; album?: { id: string; + albumName?: string; } expiresAt: string | null; } diff --git a/views/gallery.ejs b/views/gallery.ejs index 5f5daec..56db5c3 100644 --- a/views/gallery.ejs +++ b/views/gallery.ejs @@ -2,7 +2,7 @@ - Gallery + <%- title || 'Gallery' %>