mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 21:47:02 +03:00
Don't crash if failed to get ip from db
This commit is contained in:
@@ -31,14 +31,14 @@ async function prepareCategorySegments(req: Request, videoID: VideoID, category:
|
||||
}
|
||||
|
||||
//if this isn't their ip, don't send it to them
|
||||
return cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted].some((shadowHiddenSegment) => {
|
||||
return cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted]?.some((shadowHiddenSegment) => {
|
||||
if (cache.userHashedIP === undefined) {
|
||||
//hash the IP only if it's strictly necessary
|
||||
cache.userHashedIP = getHash((getIP(req) + config.globalSalt) as IPAddress);
|
||||
}
|
||||
|
||||
return shadowHiddenSegment.hashedIP === cache.userHashedIP;
|
||||
});
|
||||
}) ?? false;
|
||||
}));
|
||||
|
||||
const filteredSegments = segments.filter((_, index) => shouldFilter[index]);
|
||||
|
||||
Reference in New Issue
Block a user