2019-04-11 14:26:41 +02:00
|
|
|
import { WEBSERVER } from '../../initializers/constants'
|
2019-08-15 11:53:26 +02:00
|
|
|
import {
|
|
|
|
MActor,
|
|
|
|
MActorFollowActors,
|
|
|
|
MActorId,
|
|
|
|
MActorUrl,
|
|
|
|
MCommentId,
|
|
|
|
MVideoAbuseId,
|
|
|
|
MVideoId,
|
|
|
|
MVideoUrl,
|
|
|
|
MVideoUUID
|
|
|
|
} from '../../typings/models'
|
|
|
|
import { MVideoPlaylist, MVideoPlaylistUUID } from '../../typings/models/video/video-playlist'
|
|
|
|
import { MVideoFileVideoUUID } from '../../typings/models/video/video-file'
|
|
|
|
import { MStreamingPlaylist } from '../../typings/models/video/video-streaming-playlist'
|
|
|
|
|
|
|
|
function getVideoActivityPubUrl (video: MVideoUUID) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/videos/watch/' + video.uuid
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoPlaylistActivityPubUrl (videoPlaylist: MVideoPlaylist) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid
|
2019-02-26 10:55:40 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoPlaylistElementActivityPubUrl (videoPlaylist: MVideoPlaylistUUID, video: MVideoUUID) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid + '/' + video.uuid
|
2019-02-26 10:55:40 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoCacheFileActivityPubUrl (videoFile: MVideoFileVideoUUID) {
|
2018-10-01 18:40:17 +02:00
|
|
|
const suffixFPS = videoFile.fps && videoFile.fps !== -1 ? '-' + videoFile.fps : ''
|
2018-09-11 16:27:07 +02:00
|
|
|
|
2019-04-11 11:33:44 +02:00
|
|
|
return `${WEBSERVER.URL}/redundancy/videos/${videoFile.Video.uuid}/${videoFile.resolution}${suffixFPS}`
|
2018-09-11 16:27:07 +02:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoCacheStreamingPlaylistActivityPubUrl (video: MVideoUUID, playlist: MStreamingPlaylist) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return `${WEBSERVER.URL}/redundancy/streaming-playlists/${playlist.getStringType()}/${video.uuid}`
|
2019-01-29 08:37:25 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoCommentActivityPubUrl (video: MVideoUUID, videoComment: MCommentId) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id
|
2017-12-14 17:38:41 +01:00
|
|
|
}
|
|
|
|
|
2018-08-17 15:45:42 +02:00
|
|
|
function getVideoChannelActivityPubUrl (videoChannelName: string) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/video-channels/' + videoChannelName
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getAccountActivityPubUrl (accountName: string) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/accounts/' + accountName
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoAbuseActivityPubUrl (videoAbuse: MVideoAbuseId) {
|
2019-04-11 11:33:44 +02:00
|
|
|
return WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoViewActivityPubUrl (byActor: MActorUrl, video: MVideoId) {
|
2018-11-14 15:01:28 +01:00
|
|
|
return byActor.url + '/views/videos/' + video.id + '/' + new Date().toISOString()
|
2017-11-22 16:25:03 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoLikeActivityPubUrl (byActor: MActorUrl, video: MVideoId) {
|
2017-12-14 17:38:41 +01:00
|
|
|
return byActor.url + '/likes/' + video.id
|
2017-11-23 14:19:55 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoDislikeActivityPubUrl (byActor: MActorUrl, video: MVideoId) {
|
2017-12-14 17:38:41 +01:00
|
|
|
return byActor.url + '/dislikes/' + video.id
|
2017-11-23 14:19:55 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoSharesActivityPubUrl (video: MVideoUrl) {
|
2018-01-29 10:52:19 +01:00
|
|
|
return video.url + '/announces'
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoCommentsActivityPubUrl (video: MVideoUrl) {
|
2018-01-29 10:52:19 +01:00
|
|
|
return video.url + '/comments'
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoLikesActivityPubUrl (video: MVideoUrl) {
|
2018-01-29 10:52:19 +01:00
|
|
|
return video.url + '/likes'
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoDislikesActivityPubUrl (video: MVideoUrl) {
|
2018-01-29 10:52:19 +01:00
|
|
|
return video.url + '/dislikes'
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getActorFollowActivityPubUrl (follower: MActor, following: MActorId) {
|
2019-04-08 14:04:57 +02:00
|
|
|
return follower.url + '/follows/' + following.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getActorFollowAcceptActivityPubUrl (actorFollow: MActorFollowActors) {
|
2017-12-14 17:38:41 +01:00
|
|
|
const follower = actorFollow.ActorFollower
|
|
|
|
const me = actorFollow.ActorFollowing
|
2017-11-20 10:24:29 +01:00
|
|
|
|
2017-11-27 14:44:51 +01:00
|
|
|
return follower.url + '/accepts/follows/' + me.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getActorFollowRejectActivityPubUrl (follower: MActorUrl, following: MActorId) {
|
2019-04-08 14:04:57 +02:00
|
|
|
return follower.url + '/rejects/follows/' + following.id
|
|
|
|
}
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
function getVideoAnnounceActivityPubUrl (byActor: MActorId, video: MVideoUrl) {
|
2018-11-14 15:01:28 +01:00
|
|
|
return video.url + '/announces/' + byActor.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2018-01-04 16:56:36 +01:00
|
|
|
function getDeleteActivityPubUrl (originalUrl: string) {
|
|
|
|
return originalUrl + '/delete'
|
|
|
|
}
|
|
|
|
|
2017-11-20 10:24:29 +01:00
|
|
|
function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
|
2017-11-27 14:44:51 +01:00
|
|
|
return originalUrl + '/updates/' + updatedAt
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getUndoActivityPubUrl (originalUrl: string) {
|
|
|
|
return originalUrl + '/undo'
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getVideoActivityPubUrl,
|
2019-02-26 10:55:40 +01:00
|
|
|
getVideoPlaylistElementActivityPubUrl,
|
|
|
|
getVideoPlaylistActivityPubUrl,
|
2019-01-29 08:37:25 +01:00
|
|
|
getVideoCacheStreamingPlaylistActivityPubUrl,
|
2017-11-20 10:24:29 +01:00
|
|
|
getVideoChannelActivityPubUrl,
|
|
|
|
getAccountActivityPubUrl,
|
|
|
|
getVideoAbuseActivityPubUrl,
|
2017-12-14 17:38:41 +01:00
|
|
|
getActorFollowActivityPubUrl,
|
|
|
|
getActorFollowAcceptActivityPubUrl,
|
2018-11-14 15:01:28 +01:00
|
|
|
getVideoAnnounceActivityPubUrl,
|
2017-11-20 10:24:29 +01:00
|
|
|
getUpdateActivityPubUrl,
|
2017-11-22 16:25:03 +01:00
|
|
|
getUndoActivityPubUrl,
|
2017-11-23 14:19:55 +01:00
|
|
|
getVideoViewActivityPubUrl,
|
|
|
|
getVideoLikeActivityPubUrl,
|
2017-12-22 10:50:07 +01:00
|
|
|
getVideoDislikeActivityPubUrl,
|
2019-04-08 14:04:57 +02:00
|
|
|
getActorFollowRejectActivityPubUrl,
|
2018-01-04 16:56:36 +01:00
|
|
|
getVideoCommentActivityPubUrl,
|
2018-01-29 10:52:19 +01:00
|
|
|
getDeleteActivityPubUrl,
|
|
|
|
getVideoSharesActivityPubUrl,
|
|
|
|
getVideoCommentsActivityPubUrl,
|
|
|
|
getVideoLikesActivityPubUrl,
|
2018-09-11 16:27:07 +02:00
|
|
|
getVideoDislikesActivityPubUrl,
|
|
|
|
getVideoCacheFileActivityPubUrl
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|