From b764380ac23f4e9d4677d08acdc3474c2931a16d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Jan 2020 10:11:28 +0100 Subject: Add ability to list redundancies --- server/helpers/custom-validators/activitypub/cache-file.ts | 2 +- server/helpers/custom-validators/video-redundancies.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 server/helpers/custom-validators/video-redundancies.ts (limited to 'server/helpers/custom-validators') diff --git a/server/helpers/custom-validators/activitypub/cache-file.ts b/server/helpers/custom-validators/activitypub/cache-file.ts index 21d5c53ca..c5b3b4d9f 100644 --- a/server/helpers/custom-validators/activitypub/cache-file.ts +++ b/server/helpers/custom-validators/activitypub/cache-file.ts @@ -6,7 +6,7 @@ import { CacheFileObject } from '../../../../shared/models/activitypub/objects' function isCacheFileObjectValid (object: CacheFileObject) { return exists(object) && object.type === 'CacheFile' && - isDateValid(object.expires) && + (object.expires === null || isDateValid(object.expires)) && isActivityPubUrlValid(object.object) && (isRemoteVideoUrlValid(object.url) || isPlaylistRedundancyUrlValid(object.url)) } diff --git a/server/helpers/custom-validators/video-redundancies.ts b/server/helpers/custom-validators/video-redundancies.ts new file mode 100644 index 000000000..50a559c4f --- /dev/null +++ b/server/helpers/custom-validators/video-redundancies.ts @@ -0,0 +1,12 @@ +import { exists } from './misc' + +function isVideoRedundancyTarget (value: any) { + return exists(value) && + (value === 'my-videos' || value === 'remote-videos') +} + +// --------------------------------------------------------------------------- + +export { + isVideoRedundancyTarget +} -- cgit v1.2.3