Gate shares behind magic-link sessions, add comments and new-photo email digests

This commit is contained in:
zyphlar
2026-10-19 15:10:57 -07:00
parent c8d8dc9dbc
commit f598200e24
34 changed files with 3387 additions and 375 deletions
+62
View File
@@ -1,3 +1,65 @@
# Immich Magic Proxy
A fork of [Immich Public Proxy](https://github.com/alangrainger/immich-public-proxy) (4.1.1) where shares are
**private**: only people you invite can see them.
- **Magic links.** You add an Immich shared link and the people allowed to see it. Each person gets a personal link.
Without a valid link, every page, photo, video, download and API route answers with a "private photos" page or a
404, and never touches Immich.
- **Bookmarkable.** Opening the link signs that browser in with an `HttpOnly` cookie that lasts 400 days (the
browser maximum) and renews itself daily while in use. Sessions live in the database, so restarts don't sign
anyone out. Recipients can bookmark an album, or `/me` for all their albums.
- **New-photo emails.** Each recipient chooses daily, weekly, monthly or never (you set their starting choice). The
proxy checks every album for new photos and sends one summary email per period, with a sign-in link per album.
Photos that were already there when someone got access are never reported as new.
- **Comments.** Recipients can comment on any photo from the lightbox (comment button, or the info sidebar). They can
delete their own; you can moderate all of them from the admin page.
- **Lost links.** A visitor with no session can ask for a new link by email. The reply is the same whether or not the
address was invited, and requests are rate-limited.
- **Password-protected shares.** Store the share password when adding the album, and recipients are never asked
for it.
## Setup
1. Set the environment (see `docker-compose.yml`) and start it with `docker compose up -d --build`. Mount a volume at
`/data`: it holds the SQLite database of recipients, sessions and comments. Back it up.
2. Open `/admin` and sign in with `ADMIN_PASSWORD`.
3. Under **Albums**, paste an Immich shared link (`https://immich.example.com/share/...` or `/s/<slug>`).
4. Under **Recipients**, add each person, tick their albums, and either email the invitation or copy the link.
From a recipient's page you can send a new link, revoke every link and session they have, disable them, or delete
them.
| Variable | |
| --- | --- |
| `IMMICH_URL` | Immich's internal URL, as upstream |
| `PUBLIC_BASE_URL` | This proxy's public URL. Needed for links in emails, and `https://` makes cookies `Secure` |
| `ADMIN_PASSWORD` | Turns on `/admin`. Without it there is no admin console |
| `SMTP_URL` or `SMTP_HOST` / `SMTP_PORT` / `SMTP_USER` / `SMTP_PASS` / `SMTP_SECURE` | Outgoing mail. Without it, no emails are sent; you copy links by hand |
| `MAIL_FROM` | Sender address, e.g. `Our photos <photos@example.com>` |
| `SITE_NAME` | Name used in email subjects. Default `Shared photos` |
| `DIGEST_HOUR` | Hour (0-23) that notification emails go out. Default `8` |
| `TZ` | Timezone for `DIGEST_HOUR`. Default UTC |
| `NOTIFY_INTERVAL_MINUTES` | How often albums are checked for new photos. Default `60` |
| `DATA_DIR` | Database directory. `/data` in the image, `./data` otherwise |
| `TRUST_PROXY` | Express `trust proxy` setting. Default trusts private-network proxies |
## Differences from upstream
- Responses are cached `private` only, with no CORS header, so a CDN can't hand a photo to someone without a session.
If you set `ipp.responseHeaders` yourself, keep `Cache-Control` private.
- The gallery page is `private, no-cache`; `ipp.gallery.cacheTime` and `ipp.showHomePage` are no longer used. `/`
goes to the recipient's albums.
- `ipp.gallery.singleImage` defaults to `true`, so a one-photo share opens in the gallery where it can be commented on.
- `ipp.uploadUrl` defaults to off. The separate upload service (`upload-app/`) does not check magic-link sessions,
so don't route it unless you accept that anyone with a share key can upload.
- An Immich share link still works directly on Immich itself; this proxy only controls access through the proxy.
Keep Immich private, as upstream recommends.
The rest of this README is upstream's.
---
# Immich Public Proxy
<p align="center" width="100%">