aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/custom-validators/activitypub/videos.ts6
-rw-r--r--server/lib/activitypub/videos.ts6
-rw-r--r--server/models/video/video.ts8
-rw-r--r--shared/models/activitypub/objects/common-objects.ts2
4 files changed, 11 insertions, 11 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts
index fb1d2d094..5d2a1f171 100644
--- a/server/helpers/custom-validators/activitypub/videos.ts
+++ b/server/helpers/custom-validators/activitypub/videos.ts
@@ -115,18 +115,18 @@ function isRemoteVideoUrlValid (url: any) {
115 return url.type === 'Link' && 115 return url.type === 'Link' &&
116 ( 116 (
117 ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 && 117 ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 &&
118 isActivityPubUrlValid(url.url) && 118 isActivityPubUrlValid(url.href) &&
119 validator.isInt(url.width + '', { min: 0 }) && 119 validator.isInt(url.width + '', { min: 0 }) &&
120 validator.isInt(url.size + '', { min: 0 }) 120 validator.isInt(url.size + '', { min: 0 })
121 ) || 121 ) ||
122 ( 122 (
123 ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 && 123 ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 &&
124 isActivityPubUrlValid(url.url) && 124 isActivityPubUrlValid(url.href) &&
125 validator.isInt(url.width + '', { min: 0 }) 125 validator.isInt(url.width + '', { min: 0 })
126 ) || 126 ) ||
127 ( 127 (
128 ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 && 128 ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 &&
129 validator.isLength(url.url, { min: 5 }) && 129 validator.isLength(url.href, { min: 5 }) &&
130 validator.isInt(url.width + '', { min: 0 }) 130 validator.isInt(url.width + '', { min: 0 })
131 ) 131 )
132} 132}
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 708f4a897..5b429709f 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -122,10 +122,10 @@ function videoFileActivityUrlToDBAttributes (videoCreated: VideoModel, videoObje
122 return u.mimeType === 'application/x-bittorrent;x-scheme-handler/magnet' && u.width === fileUrl.width 122 return u.mimeType === 'application/x-bittorrent;x-scheme-handler/magnet' && u.width === fileUrl.width
123 }) 123 })
124 124
125 if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.url) 125 if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href)
126 126
127 const parsed = magnetUtil.decode(magnet.url) 127 const parsed = magnetUtil.decode(magnet.href)
128 if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) throw new Error('Cannot parse magnet URI ' + magnet.url) 128 if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) throw new Error('Cannot parse magnet URI ' + magnet.href)
129 129
130 const attribute = { 130 const attribute = {
131 extname: VIDEO_MIMETYPE_EXT[ fileUrl.mimeType ], 131 extname: VIDEO_MIMETYPE_EXT[ fileUrl.mimeType ],
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 391568df4..3e2b4ce64 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -920,7 +920,7 @@ export class VideoModel extends Model<VideoModel> {
920 url.push({ 920 url.push({
921 type: 'Link', 921 type: 'Link',
922 mimeType: 'video/' + file.extname.replace('.', ''), 922 mimeType: 'video/' + file.extname.replace('.', ''),
923 url: this.getVideoFileUrl(file, baseUrlHttp), 923 href: this.getVideoFileUrl(file, baseUrlHttp),
924 width: file.resolution, 924 width: file.resolution,
925 size: file.size 925 size: file.size
926 }) 926 })
@@ -928,14 +928,14 @@ export class VideoModel extends Model<VideoModel> {
928 url.push({ 928 url.push({
929 type: 'Link', 929 type: 'Link',
930 mimeType: 'application/x-bittorrent', 930 mimeType: 'application/x-bittorrent',
931 url: this.getTorrentUrl(file, baseUrlHttp), 931 href: this.getTorrentUrl(file, baseUrlHttp),
932 width: file.resolution 932 width: file.resolution
933 }) 933 })
934 934
935 url.push({ 935 url.push({
936 type: 'Link', 936 type: 'Link',
937 mimeType: 'application/x-bittorrent;x-scheme-handler/magnet', 937 mimeType: 'application/x-bittorrent;x-scheme-handler/magnet',
938 url: this.generateMagnetUri(file, baseUrlHttp, baseUrlWs), 938 href: this.generateMagnetUri(file, baseUrlHttp, baseUrlWs),
939 width: file.resolution 939 width: file.resolution
940 }) 940 })
941 } 941 }
@@ -944,7 +944,7 @@ export class VideoModel extends Model<VideoModel> {
944 url.push({ 944 url.push({
945 type: 'Link', 945 type: 'Link',
946 mimeType: 'text/html', 946 mimeType: 'text/html',
947 url: CONFIG.WEBSERVER.URL + '/videos/watch/' + this.uuid 947 href: CONFIG.WEBSERVER.URL + '/videos/watch/' + this.uuid
948 }) 948 })
949 949
950 return { 950 return {
diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts
index aef728b82..3127d0565 100644
--- a/shared/models/activitypub/objects/common-objects.ts
+++ b/shared/models/activitypub/objects/common-objects.ts
@@ -20,7 +20,7 @@ export interface ActivityIconObject {
20export interface ActivityUrlObject { 20export interface ActivityUrlObject {
21 type: 'Link' 21 type: 'Link'
22 mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' 22 mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
23 url: string 23 href: string
24 width: number 24 width: number
25 size?: number 25 size?: number
26} 26}