mirror of
https://github.com/alangrainger/immich-public-proxy.git
synced 2024-12-29 12:21:57 +00:00
80 lines
2.7 KiB
Markdown
80 lines
2.7 KiB
Markdown
# Immich Public Proxy
|
|
|
|
Share your Immich photos and albums in a safe way without exposing your Immich instance to the public.
|
|
|
|
<p align="center" width="100%">
|
|
<img src="public/images/immich.png" width="180" height="180">
|
|
</p>
|
|
|
|
Immich is a wonderful bit of software, but since it holds all your private photos it's best to keep it fully locked down.
|
|
This presents a problem when you want to share a photo or a gallery with someone.
|
|
|
|
**Immich Public Proxy** provides a barrier of security between the public and Immich, and _only_ allows through requests
|
|
which you have publicly shared. When it receives a valid request, it talks to Immich locally via API and returns only
|
|
those shared images.
|
|
|
|
It exposes no ports, allows no incoming data, and has no API to exploit.
|
|
|
|
The ideal setup is to have Immich secured privately behind VPN or mTLS, and only allow public access to Immich Public Proxy.
|
|
|
|
[Live demo](https://immich-demo.note.sx/share/ffSw63qnIYMtpmg0RNvOui0Dpio7BbxsObjvH8YZaobIjIAzl5n7zTX5d6EDHdOYEvo)
|
|
|
|
## How to install with Docker
|
|
|
|
1. Clone the repo:
|
|
|
|
```bash
|
|
git clone https://github.com/alangrainger/immich-public-proxy.git
|
|
```
|
|
|
|
2. Create a `.env` file to configure the app.
|
|
|
|
```
|
|
IMMICH_URL=http://localhost:2283
|
|
API_KEY="Get this from your Immich Account Settings page"
|
|
PORT=3000
|
|
CACHE_AGE=2592000
|
|
```
|
|
|
|
- `IMMICH_URL` is the URL to access Immich in your local network. This is not your public URL.
|
|
- `API_KEY` get this from the Account Settings page of your Immich user account.
|
|
- `CACHE_AGE` this is setting the `cache-control` header, to tell the browser to cache the assets. Set to 0 to disable caching.
|
|
|
|
3. Start the docker container:
|
|
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
4. Set the "External domain" in your Immich **Server Settings** to be the same as the public URL for your Immich Public Proxy:
|
|
|
|
<img src="public/images/server-settings.png" width="418" height="205">
|
|
|
|
Now whenever you share an image or gallery through Immich, it will automatically create the
|
|
correct public path for you.
|
|
|
|
## Configuration
|
|
|
|
The gallery is created using [lightGallery](https://github.com/sachinchoolur/lightGallery). You can change various settings to change how your gallery displays by
|
|
updating the `lightGallery` section in `/views/gallery.ejs`:
|
|
|
|
```javascript
|
|
lightGallery(document.getElementById('lightgallery'), {
|
|
plugins: [lgZoom, lgThumbnail, lgVideo, lgFullscreen],
|
|
speed: 500
|
|
})
|
|
```
|
|
|
|
For example to disable the download button for images, you would add `download: false`:
|
|
|
|
```javascript
|
|
lightGallery(document.getElementById('lightgallery'), {
|
|
plugins: [lgZoom, lgThumbnail, lgVideo, lgFullscreen],
|
|
download: false,
|
|
speed: 500
|
|
})
|
|
```
|
|
|
|
You can find all of lightGallery's settings here:
|
|
|
|
https://www.lightgalleryjs.com/docs/settings/
|