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