auto-smart-security 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,12 +12,16 @@ class RedisBlacklistStore {
|
|
|
12
12
|
return `${this.prefix}${ip}`;
|
|
13
13
|
}
|
|
14
14
|
async isBlocked(ip) {
|
|
15
|
+
if (!this.redis)
|
|
16
|
+
return false;
|
|
15
17
|
if (this.staticBlacklist.includes(ip))
|
|
16
18
|
return true;
|
|
17
19
|
const value = await this.redis.get(this.key(ip));
|
|
18
20
|
return value === '1';
|
|
19
21
|
}
|
|
20
22
|
async block(ip, ttlSeconds) {
|
|
23
|
+
if (!this.redis)
|
|
24
|
+
return;
|
|
21
25
|
const ttl = ttlSeconds ?? this.ttlSeconds;
|
|
22
26
|
await this.redis.set(this.key(ip), '1', 'EX', ttl);
|
|
23
27
|
}
|