added stealth mode

This commit is contained in:
preeperkiller
2025-02-28 17:54:17 +01:00
parent 8f80ddcc23
commit 8c5adb2dac
5 changed files with 24 additions and 1 deletions
+2 -1
View File
@@ -9,7 +9,8 @@
"downloadOriginalPhoto": true,
"showGalleryTitle": false,
"allowDownloadAll": false,
"showHomePage": true
"showHomePage": true,
"stealthMode": false
},
"lightGallery": {
"controls": true,
+6
View File
@@ -49,6 +49,9 @@ class Immich {
// Check that the key is a valid format
if (!immich.isKey(request.key)) {
log('Invalid share key ' + request.key)
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
return
}
@@ -57,6 +60,9 @@ class Immich {
const sharedLinkRes = await immich.getShareByKey(request.key, request.password)
if (!sharedLinkRes.valid) {
// This isn't a valid request - check the console for more information
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
return
}
+12
View File
@@ -107,6 +107,9 @@ app.get('/share/:type(photo|video)/:key/:id/:size?', decodeCookie, async (req, r
// Check for valid key and ID
if (!immich.isKey(req.params.key) || !immich.isId(req.params.id)) {
log('Invalid key or ID for ' + req.path)
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
return
}
@@ -114,6 +117,9 @@ app.get('/share/:type(photo|video)/:key/:id/:size?', decodeCookie, async (req, r
// Validate the size parameter
if (req.params.size && !Object.values(ImageSize).includes(req.params.size as ImageSize)) {
log('Invalid size parameter ' + req.path)
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
return
}
@@ -135,6 +141,9 @@ app.get('/share/:type(photo|video)/:key/:id/:size?', decodeCookie, async (req, r
}
} else {
log('No asset found for ' + req.path)
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
}
})
@@ -160,6 +169,9 @@ if (getConfigOption('ipp.showHomePage', true)) {
*/
app.get('*', (req, res) => {
log('Invalid route ' + req.path)
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
})
+3
View File
@@ -74,6 +74,9 @@ class Render {
)
res.end()
} else {
if (getConfigOption('ipp.stealthMode', true)) {
res.destroy();
}
res.status(404).send()
}
}