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
+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