mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 22:17:14 +03:00
Fix shadow ban exiting early
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
|
container_name: somethingelse
|
||||||
image: postgres:alpine
|
image: postgres:alpine
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=${PG_USER}
|
- POSTGRES_USER=${PG_USER}
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ export async function shadowBanUser(req: Request, res: Response): Promise<Respon
|
|||||||
|
|
||||||
if (userID) {
|
if (userID) {
|
||||||
const result = await banUser(userID, enabled, unHideOldSubmissions, type, categories);
|
const result = await banUser(userID, enabled, unHideOldSubmissions, type, categories);
|
||||||
if (result) {
|
|
||||||
res.sendStatus(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enabled && lookForIPs) {
|
if (enabled && lookForIPs) {
|
||||||
const ipLoggingFixedTime = 1674590916069;
|
const ipLoggingFixedTime = 1674590916069;
|
||||||
@@ -54,14 +51,20 @@ export async function shadowBanUser(req: Request, res: Response): Promise<Respon
|
|||||||
return privateDB.prepare("all", `SELECT "hashedIP" FROM "sponsorTimes" WHERE "timeSubmitted" = ?`, [s.timeSubmitted]) as Promise<{ hashedIP: HashedIP }[]>;
|
return privateDB.prepare("all", `SELECT "hashedIP" FROM "sponsorTimes" WHERE "timeSubmitted" = ?`, [s.timeSubmitted]) as Promise<{ hashedIP: HashedIP }[]>;
|
||||||
}))).flat();
|
}))).flat();
|
||||||
|
|
||||||
await Promise.all(ips.map((ip) => {
|
await Promise.all([...new Set(ips.map((ip) => ip.hashedIP))].map((ip) => {
|
||||||
return banIP(ip.hashedIP, enabled, unHideOldSubmissions, type, categories, true);
|
return banIP(ip, enabled, unHideOldSubmissions, type, categories, true);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
res.sendStatus(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (hashedIP) {
|
} else if (hashedIP) {
|
||||||
const result = await banIP(hashedIP, enabled, unHideOldSubmissions, type, categories, banUsers);
|
const result = await banIP(hashedIP, enabled, unHideOldSubmissions, type, categories, banUsers);
|
||||||
if (result) {
|
if (result) {
|
||||||
res.sendStatus(result);
|
res.sendStatus(result);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.sendStatus(200);
|
return res.sendStatus(200);
|
||||||
|
|||||||
Reference in New Issue
Block a user