This commit is contained in:
Alan Grainger
2025-02-03 09:36:52 +08:00
parent 6885eec193
commit 650427db28
4 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -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.7.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.7.1&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/static/release/v1.7.0/blue?scale=1.1"></a>
<img alt="Latest release" src="https://badgen.net/static/release/v1.7.1/blue?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
View File
@@ -1,6 +1,6 @@
{
"name": "immich-public-proxy",
"version": "1.7.0",
"version": "1.7.1",
"scripts": {
"dev": "ts-node src/index.ts",
"build": "npx tsc",
+4 -3
View File
@@ -43,9 +43,6 @@ class Immich {
* 404 - any other failed request. Check console.log for details.
*/
async handleShareRequest (request: IncomingShareRequest, res: Response) {
// Add the headers configured in config.json (most likely `cache-control`)
addResponseHeaders(res)
// Check that the key is a valid format
if (!immich.isKey(request.key)) {
log('Invalid share key ' + request.key)
@@ -73,6 +70,9 @@ class Immich {
if (sharedLinkRes.passwordRequired) {
// `request.key` is already sanitised at this point, but it never hurts to be explicit
const key = request.key.replace(/[^\w-]/g, '')
res.header('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate')
res.header('Pragma', 'no-cache')
res.header('Expires', '0')
res.render('password', {
key,
lgConfig: render.lgConfig,
@@ -96,6 +96,7 @@ class Immich {
}
// Everything is ok - output the shared link data
addResponseHeaders(res)
if (request.mode === 'download' && getConfigOption('ipp.allowDownloadAll', false)) {
// Download all assets as a zip file
+2
View File
@@ -35,6 +35,8 @@ app.use(express.json())
app.use('/share/static', express.static('public', { setHeaders: addResponseHeaders }))
// Serve the same assets on /, to allow for /robots.txt and /favicon.ico
app.use(express.static('public', { setHeaders: addResponseHeaders }))
// Remove the X-Powered-By ExpressJS header
app.disable('x-powered-by')
/**
* Middleware to decode the encrypted data stored in the session cookie