Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix communication with mastodon

Chocobozzz9fb3abfdac5c
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts
index fb1d2d094a..5d2a1f1713 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) {
return url.type === 'Link' &&
(
ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 &&
- isActivityPubUrlValid(url.url) &&
+ isActivityPubUrlValid(url.href) &&
validator.isInt(url.width + '', { min: 0 }) &&
validator.isInt(url.size + '', { min: 0 })
) ||
(
ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 &&
- isActivityPubUrlValid(url.url) &&
+ isActivityPubUrlValid(url.href) &&
validator.isInt(url.width + '', { min: 0 })
) ||
(
ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 &&
- validator.isLength(url.url, { min: 5 }) &&
+ validator.isLength(url.href, { min: 5 }) &&
validator.isInt(url.width + '', { min: 0 })
)
}
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 708f4a8974..5b429709f7 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -122,10 +122,10 @@ function videoFileActivityUrlToDBAttributes (videoCreated: VideoModel, videoObje
return u.mimeType === 'application/x-bittorrent;x-scheme-handler/magnet' && u.width === fileUrl.width
})
- if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.url)
+ if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href)
- const parsed = magnetUtil.decode(magnet.url)
- if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) throw new Error('Cannot parse magnet URI ' + magnet.url)
+ const parsed = magnetUtil.decode(magnet.href)
+ if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) throw new Error('Cannot parse magnet URI ' + magnet.href)
const attribute = {
extname: VIDEO_MIMETYPE_EXT[ fileUrl.mimeType ],
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 391568df43..3e2b4ce64b 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -920,7 +920,7 @@ export class VideoModel extends Model<VideoModel> {
url.push({
type: 'Link',
mimeType: 'video/' + file.extname.replace('.', ''),
- url: this.getVideoFileUrl(file, baseUrlHttp),
+ href: this.getVideoFileUrl(file, baseUrlHttp),
width: file.resolution,
size: file.size
})
@@ -928,14 +928,14 @@ export class VideoModel extends Model<VideoModel> {
url.push({
type: 'Link',
mimeType: 'application/x-bittorrent',
- url: this.getTorrentUrl(file, baseUrlHttp),
+ href: this.getTorrentUrl(file, baseUrlHttp),
width: file.resolution
})
url.push({
type: 'Link',
mimeType: 'application/x-bittorrent;x-scheme-handler/magnet',
- url: this.generateMagnetUri(file, baseUrlHttp, baseUrlWs),
+ href: this.generateMagnetUri(file, baseUrlHttp, baseUrlWs),
width: file.resolution
})
}
@@ -944,7 +944,7 @@ export class VideoModel extends Model<VideoModel> {
url.push({
type: 'Link',
mimeType: 'text/html',
- url: CONFIG.WEBSERVER.URL + '/videos/watch/' + this.uuid
+ href: CONFIG.WEBSERVER.URL + '/videos/watch/' + this.uuid
})
return {
diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts
index aef728b824..3127d0565c 100644
--- a/shared/models/activitypub/objects/common-objects.ts
+++ b/shared/models/activitypub/objects/common-objects.ts
@@ -20,7 +20,7 @@ export interface ActivityIconObject {
export interface ActivityUrlObject {
type: 'Link'
mimeType: 'video/mp4' | 'video/webm' | 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
- url: string
+ href: string
width: number
size?: number
}