1
0
Fork 0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2026-03-04 11:41:36 +00:00

Notify users if they were blocked due to proxy

This commit is contained in:
Cadence Ember 2020-07-31 03:19:55 +12:00
parent f0a28d485f
commit d4f9af44b0
No known key found for this signature in database
GPG key ID: 128B99B1B74A6412
3 changed files with 21 additions and 2 deletions

View file

@ -38,5 +38,14 @@ function add(req, count) {
return limiter.add(identifier, count)
}
function isProxyNetwork(req) {
if (!constants.quota.enabled) return false // no need to try to perform detection if we didn't even load the lists
const ip = getIPFromReq(req)
const identifier = getIdentifier(ip)
return identifier === "proxy"
}
module.exports.remaining = remaining
module.exports.add = add
module.exports.isProxyNetwork = isProxyNetwork