PeerTube/server/helpers/custom-validators/activitypub/cache-file.ts

17 lines
501 B
TypeScript

import { isActivityPubUrlValid } from './misc'
import { isRemoteVideoUrlValid } from './videos'
import { exists, isDateValid } from '../misc'
import { CacheFileObject } from '../../../../shared/models/activitypub/objects'
function isCacheFileObjectValid (object: CacheFileObject) {
return exists(object) &&
object.type === 'CacheFile' &&
isDateValid(object.expires) &&
isActivityPubUrlValid(object.object) &&
isRemoteVideoUrlValid(object.url)
}
export {
isCacheFileObjectValid
}