X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fredis.ts;h=d6d053d2f8b1b29a5cb2674bfee6df3ce36c7ba6;hb=14f7ad399fddd00362eabdf8d32e453ebc8be453;hp=b86aefa0ebba99f7f538f719d09fc5067b335b79;hpb=b211106695bb82f6c32e53306081b5262c3d109d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/redis.ts b/server/lib/redis.ts index b86aefa0e..d6d053d2f 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts @@ -1,4 +1,4 @@ -import { createClient, RedisClientOptions, RedisModules, RedisScripts } from 'redis' +import { createClient, RedisClientOptions, RedisModules } from 'redis' import { exists } from '@server/helpers/custom-validators/misc' import { sha256 } from '@shared/extra-utils' import { logger } from '../helpers/logger' @@ -16,16 +16,12 @@ import { WEBSERVER } from '../initializers/constants' -// Only used for typings -// TODO: remove when https://github.com/microsoft/TypeScript/issues/37181 is fixed -const redisClientWrapperForType = () => createClient<{}, RedisScripts>() - class Redis { private static instance: Redis private initialized = false private connected = false - private client: ReturnType + private client: ReturnType private prefix: string private constructor () { @@ -145,18 +141,10 @@ class Redis { return this.setValue(this.generateIPViewKey(ip, videoUUID), '1', VIEW_LIFETIME.VIEW) } - setIPVideoViewer (ip: string, videoUUID: string) { - return this.setValue(this.generateIPViewerKey(ip, videoUUID), '1', VIEW_LIFETIME.VIEWER) - } - async doesVideoIPViewExist (ip: string, videoUUID: string) { return this.exists(this.generateIPViewKey(ip, videoUUID)) } - async doesVideoIPViewerExist (ip: string, videoUUID: string) { - return this.exists(this.generateIPViewerKey(ip, videoUUID)) - } - /* ************ Tracker IP block ************ */ setTrackerBlockIP (ip: string) { @@ -316,7 +304,7 @@ class Redis { return this.deleteKey('resumable-upload-' + uploadId) } - /* ************ AP ressource unavailability ************ */ + /* ************ AP resource unavailability ************ */ async addAPUnavailability (url: string) { const key = this.generateAPUnavailabilityKey(url) @@ -361,10 +349,6 @@ class Redis { return `views-${videoUUID}-${ip}` } - private generateIPViewerKey (ip: string, videoUUID: string) { - return `viewer-${videoUUID}-${ip}` - } - private generateTrackerBlockIPKey (ip: string) { return `tracker-block-ip-${ip}` }