added stealth mode
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@
|
||||
"downloadOriginalPhoto": true,
|
||||
"showGalleryTitle": false,
|
||||
"allowDownloadAll": false,
|
||||
"showHomePage": true
|
||||
"showHomePage": true,
|
||||
"stealthMode": false
|
||||
},
|
||||
"lightGallery": {
|
||||
"controls": true,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
|
||||
|
||||
@@ -74,6 +74,9 @@ class Render {
|
||||
)
|
||||
res.end()
|
||||
} else {
|
||||
if (getConfigOption('ipp.stealthMode', true)) {
|
||||
res.destroy();
|
||||
}
|
||||
res.status(404).send()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user