aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-28 16:03:39 +0100
committerChocobozzz <me@florianbigard.com>2020-02-28 16:21:34 +0100
commitbdd428a6d9138d751f8cde82867022a93f1a76cc (patch)
treec2b671c3d6a34daddd20e30656f573cf59905f13 /server/lib/activitypub/videos.ts
parent9d94e5d7b96332d628ed835c67c2986289ead9b2 (diff)
downloadPeerTube-bdd428a6d9138d751f8cde82867022a93f1a76cc.tar.gz
PeerTube-bdd428a6d9138d751f8cde82867022a93f1a76cc.tar.zst
PeerTube-bdd428a6d9138d751f8cde82867022a93f1a76cc.zip
Update dependencies
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r--server/lib/activitypub/videos.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index d182ca5a2..bce1666be 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -111,7 +111,7 @@ async function fetchRemoteVideo (videoUrl: string): Promise<{ response: request.
111 111
112 logger.info('Fetching remote video %s.', videoUrl) 112 logger.info('Fetching remote video %s.', videoUrl)
113 113
114 const { response, body } = await doRequest(options) 114 const { response, body } = await doRequest<any>(options)
115 115
116 if (sanitizeAndCheckVideoTorrentObject(body) === false || checkUrlsSameHost(body.id, videoUrl) !== true) { 116 if (sanitizeAndCheckVideoTorrentObject(body) === false || checkUrlsSameHost(body.id, videoUrl) !== true) {
117 logger.debug('Remote video JSON is not valid.', { body }) 117 logger.debug('Remote video JSON is not valid.', { body })
@@ -129,7 +129,7 @@ async function fetchRemoteVideoDescription (video: MVideoAccountLight) {
129 json: true 129 json: true
130 } 130 }
131 131
132 const { body } = await doRequest(options) 132 const { body } = await doRequest<any>(options)
133 return body.description ? body.description : '' 133 return body.description ? body.description : ''
134} 134}
135 135
@@ -507,7 +507,7 @@ function isAPVideoUrlObject (url: any): url is ActivityVideoUrlObject {
507 const mimeTypes = Object.keys(MIMETYPES.VIDEO.MIMETYPE_EXT) 507 const mimeTypes = Object.keys(MIMETYPES.VIDEO.MIMETYPE_EXT)
508 508
509 const urlMediaType = url.mediaType 509 const urlMediaType = url.mediaType
510 return mimeTypes.indexOf(urlMediaType) !== -1 && urlMediaType.startsWith('video/') 510 return mimeTypes.includes(urlMediaType) && urlMediaType.startsWith('video/')
511} 511}
512 512
513function isAPStreamingPlaylistUrlObject (url: ActivityUrlObject): url is ActivityPlaylistUrlObject { 513function isAPStreamingPlaylistUrlObject (url: ActivityUrlObject): url is ActivityPlaylistUrlObject {
@@ -623,9 +623,11 @@ async function createVideo (videoObject: VideoTorrentObject, channel: MChannelAc
623} 623}
624 624
625function videoActivityObjectToDBAttributes (videoChannel: MChannelId, videoObject: VideoTorrentObject, to: string[] = []) { 625function videoActivityObjectToDBAttributes (videoChannel: MChannelId, videoObject: VideoTorrentObject, to: string[] = []) {
626 const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPrivacy.PUBLIC : VideoPrivacy.UNLISTED 626 const privacy = to.includes(ACTIVITY_PUB.PUBLIC)
627 const duration = videoObject.duration.replace(/[^\d]+/, '') 627 ? VideoPrivacy.PUBLIC
628 : VideoPrivacy.UNLISTED
628 629
630 const duration = videoObject.duration.replace(/[^\d]+/, '')
629 const language = videoObject.language?.identifier 631 const language = videoObject.language?.identifier
630 632
631 const category = videoObject.category 633 const category = videoObject.category