Files
SponsorBlockServer/src/utils/isUserTempVIP.ts
Michael C 62a9b0eddd add innerTube as primary videoInfo endpoint
- drop videoInfo.genreUrl since it's always empty
- bump ts target to ES2021 for Promise.any
- fix mocks to return err: false
- get maxResThumbnail from static endpoint
2022-09-15 17:02:33 -04:00

18 lines
693 B
TypeScript

import redis from "../utils/redis";
import { tempVIPKey } from "../utils/redisKeys";
import { HashedUserID } from "../types/user.model";
import { VideoID } from "../types/segments.model";
import { Logger } from "./logger";
import { getVideoDetails } from "./getVideoDetails";
export const isUserTempVIP = async (hashedUserID: HashedUserID, videoID: VideoID): Promise<boolean> => {
const apiVideoDetails = await getVideoDetails(videoID);
const channelID = apiVideoDetails?.authorId;
try {
const reply = await redis.get(tempVIPKey(hashedUserID));
return reply && reply == channelID;
} catch (e) {
Logger.error(e as string);
return false;
}
};