]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/activitypub/url.ts
Use height instead of width to represent the video resolution
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / url.ts
CommitLineData
3fd3ab2d 1import { CONFIG } from '../../initializers'
50d6de9c
C
2import { ActorModel } from '../../models/activitypub/actor'
3import { ActorFollowModel } from '../../models/activitypub/actor-follow'
3fd3ab2d
C
4import { VideoModel } from '../../models/video/video'
5import { VideoAbuseModel } from '../../models/video/video-abuse'
bf1f6508 6import { VideoCommentModel } from '../../models/video/video-comment'
892211e8 7
3fd3ab2d 8function getVideoActivityPubUrl (video: VideoModel) {
892211e8
C
9 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
10}
11
bf1f6508 12function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) {
da854ddd 13 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id
50d6de9c
C
14}
15
bf1f6508
C
16function getVideoChannelActivityPubUrl (videoChannelUUID: string) {
17 return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID
892211e8
C
18}
19
20function getAccountActivityPubUrl (accountName: string) {
c5911fd3 21 return CONFIG.WEBSERVER.URL + '/accounts/' + accountName
892211e8
C
22}
23
3fd3ab2d 24function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
892211e8
C
25 return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
26}
27
50d6de9c
C
28function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) {
29 return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString()
40ff5707
C
30}
31
50d6de9c
C
32function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
33 return byActor.url + '/likes/' + video.id
0032ebe9
C
34}
35
50d6de9c
C
36function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
37 return byActor.url + '/dislikes/' + video.id
0032ebe9
C
38}
39
46531a0a
C
40function getVideoSharesActivityPubUrl (video: VideoModel) {
41 return video.url + '/announces'
42}
43
44function getVideoCommentsActivityPubUrl (video: VideoModel) {
45 return video.url + '/comments'
46}
47
48function getVideoLikesActivityPubUrl (video: VideoModel) {
49 return video.url + '/likes'
50}
51
52function getVideoDislikesActivityPubUrl (video: VideoModel) {
53 return video.url + '/dislikes'
54}
55
50d6de9c
C
56function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) {
57 const me = actorFollow.ActorFollower
58 const following = actorFollow.ActorFollowing
892211e8 59
4e50b6a1 60 return me.url + '/follows/' + following.id
892211e8
C
61}
62
50d6de9c
C
63function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) {
64 const follower = actorFollow.ActorFollower
65 const me = actorFollow.ActorFollowing
892211e8 66
4e50b6a1 67 return follower.url + '/accepts/follows/' + me.id
892211e8
C
68}
69
50d6de9c
C
70function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) {
71 return originalUrl + '/announces/' + byActor.id
892211e8
C
72}
73
c3badc81
C
74function getDeleteActivityPubUrl (originalUrl: string) {
75 return originalUrl + '/delete'
76}
77
892211e8 78function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
4e50b6a1 79 return originalUrl + '/updates/' + updatedAt
892211e8
C
80}
81
82function getUndoActivityPubUrl (originalUrl: string) {
83 return originalUrl + '/undo'
84}
85
86export {
87 getVideoActivityPubUrl,
88 getVideoChannelActivityPubUrl,
89 getAccountActivityPubUrl,
90 getVideoAbuseActivityPubUrl,
50d6de9c
C
91 getActorFollowActivityPubUrl,
92 getActorFollowAcceptActivityPubUrl,
892211e8
C
93 getAnnounceActivityPubUrl,
94 getUpdateActivityPubUrl,
40ff5707 95 getUndoActivityPubUrl,
0032ebe9
C
96 getVideoViewActivityPubUrl,
97 getVideoLikeActivityPubUrl,
bf1f6508 98 getVideoDislikeActivityPubUrl,
c3badc81 99 getVideoCommentActivityPubUrl,
46531a0a
C
100 getDeleteActivityPubUrl,
101 getVideoSharesActivityPubUrl,
102 getVideoCommentsActivityPubUrl,
103 getVideoLikesActivityPubUrl,
104 getVideoDislikesActivityPubUrl
892211e8 105}