1 import { WEBSERVER } from '../../initializers/constants'
12 } from '../../typings/models'
13 import { MVideoPlaylist, MVideoPlaylistUUID } from '../../typings/models/video/video-playlist'
14 import { MVideoFileVideoUUID } from '../../typings/models/video/video-file'
15 import { MStreamingPlaylist } from '../../typings/models/video/video-streaming-playlist'
17 function getVideoActivityPubUrl (video: MVideoUUID) {
18 return WEBSERVER.URL + '/videos/watch/' + video.uuid
21 function getVideoPlaylistActivityPubUrl (videoPlaylist: MVideoPlaylist) {
22 return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid
25 function getVideoPlaylistElementActivityPubUrl (videoPlaylist: MVideoPlaylistUUID, video: MVideoUUID) {
26 return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid + '/' + video.uuid
29 function getVideoCacheFileActivityPubUrl (videoFile: MVideoFileVideoUUID) {
30 const suffixFPS = videoFile.fps && videoFile.fps !== -1 ? '-' + videoFile.fps : ''
32 return `${WEBSERVER.URL}/redundancy/videos/${videoFile.Video.uuid}/${videoFile.resolution}${suffixFPS}`
35 function getVideoCacheStreamingPlaylistActivityPubUrl (video: MVideoUUID, playlist: MStreamingPlaylist) {
36 return `${WEBSERVER.URL}/redundancy/streaming-playlists/${playlist.getStringType()}/${video.uuid}`
39 function getVideoCommentActivityPubUrl (video: MVideoUUID, videoComment: MCommentId) {
40 return WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id
43 function getVideoChannelActivityPubUrl (videoChannelName: string) {
44 return WEBSERVER.URL + '/video-channels/' + videoChannelName
47 function getAccountActivityPubUrl (accountName: string) {
48 return WEBSERVER.URL + '/accounts/' + accountName
51 function getVideoAbuseActivityPubUrl (videoAbuse: MVideoAbuseId) {
52 return WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
55 function getVideoViewActivityPubUrl (byActor: MActorUrl, video: MVideoId) {
56 return byActor.url + '/views/videos/' + video.id + '/' + new Date().toISOString()
59 function getVideoLikeActivityPubUrl (byActor: MActorUrl, video: MVideoId) {
60 return byActor.url + '/likes/' + video.id
63 function getVideoDislikeActivityPubUrl (byActor: MActorUrl, video: MVideoId) {
64 return byActor.url + '/dislikes/' + video.id
67 function getVideoSharesActivityPubUrl (video: MVideoUrl) {
68 return video.url + '/announces'
71 function getVideoCommentsActivityPubUrl (video: MVideoUrl) {
72 return video.url + '/comments'
75 function getVideoLikesActivityPubUrl (video: MVideoUrl) {
76 return video.url + '/likes'
79 function getVideoDislikesActivityPubUrl (video: MVideoUrl) {
80 return video.url + '/dislikes'
83 function getActorFollowActivityPubUrl (follower: MActor, following: MActorId) {
84 return follower.url + '/follows/' + following.id
87 function getActorFollowAcceptActivityPubUrl (actorFollow: MActorFollowActors) {
88 const follower = actorFollow.ActorFollower
89 const me = actorFollow.ActorFollowing
91 return follower.url + '/accepts/follows/' + me.id
94 function getActorFollowRejectActivityPubUrl (follower: MActorUrl, following: MActorId) {
95 return follower.url + '/rejects/follows/' + following.id
98 function getVideoAnnounceActivityPubUrl (byActor: MActorId, video: MVideoUrl) {
99 return video.url + '/announces/' + byActor.id
102 function getDeleteActivityPubUrl (originalUrl: string) {
103 return originalUrl + '/delete'
106 function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
107 return originalUrl + '/updates/' + updatedAt
110 function getUndoActivityPubUrl (originalUrl: string) {
111 return originalUrl + '/undo'
115 getVideoActivityPubUrl,
116 getVideoPlaylistElementActivityPubUrl,
117 getVideoPlaylistActivityPubUrl,
118 getVideoCacheStreamingPlaylistActivityPubUrl,
119 getVideoChannelActivityPubUrl,
120 getAccountActivityPubUrl,
121 getVideoAbuseActivityPubUrl,
122 getActorFollowActivityPubUrl,
123 getActorFollowAcceptActivityPubUrl,
124 getVideoAnnounceActivityPubUrl,
125 getUpdateActivityPubUrl,
126 getUndoActivityPubUrl,
127 getVideoViewActivityPubUrl,
128 getVideoLikeActivityPubUrl,
129 getVideoDislikeActivityPubUrl,
130 getActorFollowRejectActivityPubUrl,
131 getVideoCommentActivityPubUrl,
132 getDeleteActivityPubUrl,
133 getVideoSharesActivityPubUrl,
134 getVideoCommentsActivityPubUrl,
135 getVideoLikesActivityPubUrl,
136 getVideoDislikesActivityPubUrl,
137 getVideoCacheFileActivityPubUrl