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 })
)
}
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 ],
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
})
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
})
}
url.push({
type: 'Link',
mimeType: 'text/html',
- url: CONFIG.WEBSERVER.URL + '/videos/watch/' + this.uuid
+ href: CONFIG.WEBSERVER.URL + '/videos/watch/' + this.uuid
})
return {
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
}