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'
7 function getVideoActivityPubUrl (video: VideoModel) {
8 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
11 function getVideoChannelActivityPubUrl (videoChannelUUID: string) {
12 return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID
15 function getApplicationActivityPubUrl () {
16 return CONFIG.WEBSERVER.URL + '/application/peertube'
19 function getAccountActivityPubUrl (accountName: string) {
20 return CONFIG.WEBSERVER.URL + '/account/' + accountName
23 function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
24 return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
27 function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) {
28 return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString()
31 function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
32 return byActor.url + '/likes/' + video.id
35 function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
36 return byActor.url + '/dislikes/' + video.id
39 function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) {
40 const me = actorFollow.ActorFollower
41 const following = actorFollow.ActorFollowing
43 return me.url + '/follows/' + following.id
46 function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) {
47 const follower = actorFollow.ActorFollower
48 const me = actorFollow.ActorFollowing
50 return follower.url + '/accepts/follows/' + me.id
53 function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) {
54 return originalUrl + '/announces/' + byActor.id
57 function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
58 return originalUrl + '/updates/' + updatedAt
61 function getUndoActivityPubUrl (originalUrl: string) {
62 return originalUrl + '/undo'
66 getApplicationActivityPubUrl,
67 getVideoActivityPubUrl,
68 getVideoChannelActivityPubUrl,
69 getAccountActivityPubUrl,
70 getVideoAbuseActivityPubUrl,
71 getActorFollowActivityPubUrl,
72 getActorFollowAcceptActivityPubUrl,
73 getAnnounceActivityPubUrl,
74 getUpdateActivityPubUrl,
75 getUndoActivityPubUrl,
76 getVideoViewActivityPubUrl,
77 getVideoLikeActivityPubUrl,
78 getVideoDislikeActivityPubUrl