Merge branch 'metadata' into description
This commit is contained in:
@@ -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" ]
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
<p align="center" width="100%">
|
||||
<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.9.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.10.0&icon=docker&label=docker%20pulls&color=green&scale=1.1"></a>
|
||||
<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.9.0&scale=1.1"></a>
|
||||
<img alt="Latest release" src="https://badgen.net/github/release/alangrainger/immich-public-proxy?v1.10.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>
|
||||
</p>
|
||||
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
+32
-3
@@ -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
|
||||
|
||||
@@ -9,6 +9,11 @@ export interface ExifInfo {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export enum AlbumType {
|
||||
album = 'ALBUM',
|
||||
individual = 'INDIVIDUAL'
|
||||
}
|
||||
|
||||
export interface Asset {
|
||||
id: string;
|
||||
key: string;
|
||||
@@ -20,6 +25,11 @@ export interface Asset {
|
||||
exifInfo?: ExifInfo;
|
||||
}
|
||||
|
||||
export interface Album {
|
||||
id: string;
|
||||
assets: Asset[];
|
||||
}
|
||||
|
||||
export interface SharedLink {
|
||||
key: string;
|
||||
type: string;
|
||||
|
||||
+1
-1
@@ -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 -T 10 --spider http://localhost:3000/share/healthcheck || exit 1
|
||||
start_period: 10s
|
||||
timeout: 5s
|
||||
|
||||
Reference in New Issue
Block a user