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

17 lines
501 B
TypeScript
Raw Normal View History

import { isActivityPubUrlValid } from './misc'
2018-09-11 09:27:07 -05:00
import { isRemoteVideoUrlValid } from './videos'
import { exists, isDateValid } from '../misc'
2018-09-11 09:27:07 -05:00
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
}