1
0
Fork 0
mirror of https://github.com/alangrainger/immich-public-proxy.git synced 2024-12-29 12:21:57 +00:00

Removed API key requirement thanks to #3

This commit is contained in:
Alan Grainger 2024-10-31 07:09:11 +01:00
parent 690bd3f688
commit f9f868f025
3 changed files with 5 additions and 13 deletions

View file

@ -62,7 +62,7 @@ When the proxy receives a request, it will come as a link like this:
https://your-proxy-url.com/share/ffSw63qnIYMtpmg0RNvOui0Dpio7BbxsObjvH8YZaobIjIAzl5n7zTX5d6EDHdOYEvo https://your-proxy-url.com/share/ffSw63qnIYMtpmg0RNvOui0Dpio7BbxsObjvH8YZaobIjIAzl5n7zTX5d6EDHdOYEvo
``` ```
The part after `/share/` is Immich's shared link public ID (called the `key` [in the docs](https://immich.app/docs/api/get-all-shared-links/)). The part after `/share/` is Immich's shared link public ID (called the `key` [in the docs](https://immich.app/docs/api/get-my-shared-link)).
**Immich Public Proxy** takes that key and makes an API call to your Immich instance over your local network, to ask what **Immich Public Proxy** takes that key and makes an API call to your Immich instance over your local network, to ask what
photos or videos are shared in that share URL. photos or videos are shared in that share URL.
@ -70,7 +70,7 @@ photos or videos are shared in that share URL.
If it is a valid share URL, the proxy fetches just those assets via local API and returns them to the visitor as an If it is a valid share URL, the proxy fetches just those assets via local API and returns them to the visitor as an
individual image or gallery. individual image or gallery.
If the shared link is expired or any of the assets have been put in the Immich trash, it will not return those. If the shared link has expired or any of the assets have been put in the Immich trash, it will not return those.
## Configuration ## Configuration

8
dist/immich.js vendored

File diff suppressed because one or more lines are too long

View file

@ -8,11 +8,7 @@ class Immich {
* the possible attack surface of this app. * the possible attack surface of this app.
*/ */
async request (endpoint: string) { async request (endpoint: string) {
const res = await fetch(process.env.IMMICH_URL + '/api' + endpoint, { const res = await fetch(process.env.IMMICH_URL + '/api' + endpoint)
headers: {
'x-api-key': process.env.API_KEY || ''
}
})
if (res.status === 200) { if (res.status === 200) {
const contentType = res.headers.get('Content-Type') || '' const contentType = res.headers.get('Content-Type') || ''
if (contentType.includes('application/json')) { if (contentType.includes('application/json')) {