forked from ppfun/pixelplanet
check for ban desync between redis and sql on baninfo
This commit is contained in:
parent
2707fb6123
commit
7dd96fc8f9
|
@ -9,6 +9,10 @@ import {
|
||||||
getBanInfo,
|
getBanInfo,
|
||||||
unbanIP,
|
unbanIP,
|
||||||
} from '../../data/sql/Ban';
|
} from '../../data/sql/Ban';
|
||||||
|
import {
|
||||||
|
getCacheAllowed,
|
||||||
|
cleanCacheForIP,
|
||||||
|
} from '../../data/redis/isAllowedCache';
|
||||||
|
|
||||||
async function baninfo(req, res, next) {
|
async function baninfo(req, res, next) {
|
||||||
try {
|
try {
|
||||||
|
@ -21,6 +25,10 @@ async function baninfo(req, res, next) {
|
||||||
const info = await getBanInfo(ip);
|
const info = await getBanInfo(ip);
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
|
const cache = await getCacheAllowed(ip);
|
||||||
|
if (cache && cache.status === 2) {
|
||||||
|
cleanCacheForIP(ip);
|
||||||
|
}
|
||||||
throw new Error(t`You are not banned`);
|
throw new Error(t`You are not banned`);
|
||||||
}
|
}
|
||||||
let sleft = (info.expires)
|
let sleft = (info.expires)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user