1 import { CONFIG } from '../../initializers'
2 import { ActorModel } from '../../models/activitypub/actor'
3 import { ActorFollowModel } from '../../models/activitypub/actor-follow'
4 import { VideoModel } from '../../models/video/video'
5 import { VideoAbuseModel } from '../../models/video/video-abuse'
6 import { VideoCommentModel } from '../../models/video/video-comment'
8 function getVideoActivityPubUrl (video: VideoModel) {
9 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
12 function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) {
13 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id
16 function getVideoChannelActivityPubUrl (videoChannelUUID: string) {
17 return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID
20 function getAccountActivityPubUrl (accountName: string) {
21 return CONFIG.WEBSERVER.URL + '/accounts/' + accountName
24 function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
25 return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
28 function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) {
29 return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString()
32 function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
33 return byActor.url + '/likes/' + video.id
36 function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
37 return byActor.url + '/dislikes/' + video.id
40 function getVideoSharesActivityPubUrl (video: VideoModel) {
41 return video.url + '/announces'
44 function getVideoCommentsActivityPubUrl (video: VideoModel) {
45 return video.url + '/comments'
48 function getVideoLikesActivityPubUrl (video: VideoModel) {
49 return video.url + '/likes'
52 function getVideoDislikesActivityPubUrl (video: VideoModel) {
53 return video.url + '/dislikes'
56 function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) {
57 const me = actorFollow.ActorFollower
58 const following = actorFollow.ActorFollowing
60 return me.url + '/follows/' + following.id
63 function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) {
64 const follower = actorFollow.ActorFollower
65 const me = actorFollow.ActorFollowing
67 return follower.url + '/accepts/follows/' + me.id
70 function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) {
71 return originalUrl + '/announces/' + byActor.id
74 function getDeleteActivityPubUrl (originalUrl: string) {
75 return originalUrl + '/delete'
78 function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
79 return originalUrl + '/updates/' + updatedAt
82 function getUndoActivityPubUrl (originalUrl: string) {
83 return originalUrl + '/undo'
87 getVideoActivityPubUrl,
88 getVideoChannelActivityPubUrl,
89 getAccountActivityPubUrl,
90 getVideoAbuseActivityPubUrl,
91 getActorFollowActivityPubUrl,
92 getActorFollowAcceptActivityPubUrl,
93 getAnnounceActivityPubUrl,
94 getUpdateActivityPubUrl,
95 getUndoActivityPubUrl,
96 getVideoViewActivityPubUrl,
97 getVideoLikeActivityPubUrl,
98 getVideoDislikeActivityPubUrl,
99 getVideoCommentActivityPubUrl,
100 getDeleteActivityPubUrl,
101 getVideoSharesActivityPubUrl,
102 getVideoCommentsActivityPubUrl,
103 getVideoLikesActivityPubUrl,
104 getVideoDislikesActivityPubUrl