mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-14 23:47:00 +03:00
Merge branch 'master' into voteOnSponsorTime
This commit is contained in:
@@ -56,15 +56,11 @@ function getYouTubeVideoInfo(videoID: VideoID, ignoreCache = false): Promise<API
|
||||
}
|
||||
|
||||
const isUserTempVIP = async (nonAnonUserID: HashedUserID, videoID: VideoID): Promise<boolean> => {
|
||||
// fetch videoInfo from cache
|
||||
const apiVideoInfo = await getYouTubeVideoInfo(videoID);
|
||||
// get channelID or fallback to invalid channelID (<> are invalid URL characters and & is not a valid ChannelID character)
|
||||
const channelID = apiVideoInfo?.data?.authorId ?? "<INVALID_CHANNEL_ID_&&&&&>";
|
||||
const channelID = apiVideoInfo?.data?.authorId;
|
||||
const { err, reply } = await redis.getAsync(tempVIPKey(nonAnonUserID));
|
||||
// return false if error, reply mismatch or reply is not length 21 and not in testing mode
|
||||
return err ? false :
|
||||
(config.mode === "test") ? reply == channelID
|
||||
: (reply?.length === 21 && reply == channelID);
|
||||
|
||||
return err || !reply ? false : (reply == channelID);
|
||||
};
|
||||
|
||||
const videoDurationChanged = (segmentDuration: number, APIDuration: number) => (APIDuration > 0 && Math.abs(segmentDuration - APIDuration) > 2);
|
||||
|
||||
Reference in New Issue
Block a user