- setView (ip: string, videoUUID: string) {
- return this.setValue(this.buildViewKey(ip, videoUUID), '1', VIDEO_VIEW_LIFETIME)
+ /* ************ Email verification ************ */
+
+ async setVerifyEmailVerificationString (userId: number) {
+ const generatedString = await generateRandomString(32)
+
+ await this.setValue(this.generateVerifyEmailKey(userId), generatedString, USER_EMAIL_VERIFY_LIFETIME)
+
+ return generatedString
+ }
+
+ async getVerifyEmailLink (userId: number) {
+ return this.getValue(this.generateVerifyEmailKey(userId))
+ }
+
+ /* ************ Contact form per IP ************ */
+
+ async setContactFormIp (ip: string) {
+ return this.setValue(this.generateContactFormKey(ip), '1', CONTACT_FORM_LIFETIME)
+ }
+
+ async doesContactFormIpExist (ip: string) {
+ return this.exists(this.generateContactFormKey(ip))
+ }
+
+ /* ************ Views per IP ************ */
+
+ setIPVideoView (ip: string, videoUUID: string, isLive: boolean) {
+ const lifetime = isLive
+ ? VIEW_LIFETIME.LIVE
+ : VIEW_LIFETIME.VIDEO
+
+ return this.setValue(this.generateViewKey(ip, videoUUID), '1', lifetime)
+ }
+
+ async doesVideoIPViewExist (ip: string, videoUUID: string) {
+ return this.exists(this.generateViewKey(ip, videoUUID))
+ }
+
+ /* ************ Tracker IP block ************ */
+
+ setTrackerBlockIP (ip: string) {
+ return this.setValue(this.generateTrackerBlockIPKey(ip), '1', TRACKER_RATE_LIMITS.BLOCK_IP_LIFETIME)