]>
Commit | Line | Data |
---|---|---|
74dc3bca | 1 | import { WEBSERVER } from '../../initializers/constants' |
453e83ea C |
2 | import { |
3 | MActor, | |
4 | MActorFollowActors, | |
5 | MActorId, | |
6 | MActorUrl, | |
7 | MCommentId, | |
8 | MVideoAbuseId, | |
9 | MVideoId, | |
10 | MVideoUrl, | |
11 | MVideoUUID | |
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' | |
16 | ||
17 | function getVideoActivityPubUrl (video: MVideoUUID) { | |
6dd9de95 | 18 | return WEBSERVER.URL + '/videos/watch/' + video.uuid |
892211e8 C |
19 | } |
20 | ||
453e83ea | 21 | function getVideoPlaylistActivityPubUrl (videoPlaylist: MVideoPlaylist) { |
6dd9de95 | 22 | return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid |
418d092a C |
23 | } |
24 | ||
453e83ea | 25 | function getVideoPlaylistElementActivityPubUrl (videoPlaylist: MVideoPlaylistUUID, video: MVideoUUID) { |
6dd9de95 | 26 | return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid + '/' + video.uuid |
418d092a C |
27 | } |
28 | ||
453e83ea | 29 | function getVideoCacheFileActivityPubUrl (videoFile: MVideoFileVideoUUID) { |
d05be4d9 | 30 | const suffixFPS = videoFile.fps && videoFile.fps !== -1 ? '-' + videoFile.fps : '' |
c48e82b5 | 31 | |
6dd9de95 | 32 | return `${WEBSERVER.URL}/redundancy/videos/${videoFile.Video.uuid}/${videoFile.resolution}${suffixFPS}` |
c48e82b5 C |
33 | } |
34 | ||
453e83ea | 35 | function getVideoCacheStreamingPlaylistActivityPubUrl (video: MVideoUUID, playlist: MStreamingPlaylist) { |
6dd9de95 | 36 | return `${WEBSERVER.URL}/redundancy/streaming-playlists/${playlist.getStringType()}/${video.uuid}` |
09209296 C |
37 | } |
38 | ||
453e83ea | 39 | function getVideoCommentActivityPubUrl (video: MVideoUUID, videoComment: MCommentId) { |
6dd9de95 | 40 | return WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id |
50d6de9c C |
41 | } |
42 | ||
8a19bee1 | 43 | function getVideoChannelActivityPubUrl (videoChannelName: string) { |
6dd9de95 | 44 | return WEBSERVER.URL + '/video-channels/' + videoChannelName |
892211e8 C |
45 | } |
46 | ||
47 | function getAccountActivityPubUrl (accountName: string) { | |
6dd9de95 | 48 | return WEBSERVER.URL + '/accounts/' + accountName |
892211e8 C |
49 | } |
50 | ||
453e83ea | 51 | function getVideoAbuseActivityPubUrl (videoAbuse: MVideoAbuseId) { |
6dd9de95 | 52 | return WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id |
892211e8 C |
53 | } |
54 | ||
453e83ea | 55 | function getVideoViewActivityPubUrl (byActor: MActorUrl, video: MVideoId) { |
5c6d985f | 56 | return byActor.url + '/views/videos/' + video.id + '/' + new Date().toISOString() |
40ff5707 C |
57 | } |
58 | ||
453e83ea | 59 | function getVideoLikeActivityPubUrl (byActor: MActorUrl, video: MVideoId) { |
50d6de9c | 60 | return byActor.url + '/likes/' + video.id |
0032ebe9 C |
61 | } |
62 | ||
453e83ea | 63 | function getVideoDislikeActivityPubUrl (byActor: MActorUrl, video: MVideoId) { |
50d6de9c | 64 | return byActor.url + '/dislikes/' + video.id |
0032ebe9 C |
65 | } |
66 | ||
453e83ea | 67 | function getVideoSharesActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
68 | return video.url + '/announces' |
69 | } | |
70 | ||
453e83ea | 71 | function getVideoCommentsActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
72 | return video.url + '/comments' |
73 | } | |
74 | ||
453e83ea | 75 | function getVideoLikesActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
76 | return video.url + '/likes' |
77 | } | |
78 | ||
453e83ea | 79 | function getVideoDislikesActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
80 | return video.url + '/dislikes' |
81 | } | |
82 | ||
453e83ea | 83 | function getActorFollowActivityPubUrl (follower: MActor, following: MActorId) { |
5b9c965d | 84 | return follower.url + '/follows/' + following.id |
892211e8 C |
85 | } |
86 | ||
453e83ea | 87 | function getActorFollowAcceptActivityPubUrl (actorFollow: MActorFollowActors) { |
50d6de9c C |
88 | const follower = actorFollow.ActorFollower |
89 | const me = actorFollow.ActorFollowing | |
892211e8 | 90 | |
4e50b6a1 | 91 | return follower.url + '/accepts/follows/' + me.id |
892211e8 C |
92 | } |
93 | ||
453e83ea | 94 | function getActorFollowRejectActivityPubUrl (follower: MActorUrl, following: MActorId) { |
5b9c965d C |
95 | return follower.url + '/rejects/follows/' + following.id |
96 | } | |
97 | ||
453e83ea | 98 | function getVideoAnnounceActivityPubUrl (byActor: MActorId, video: MVideoUrl) { |
5c6d985f | 99 | return video.url + '/announces/' + byActor.id |
892211e8 C |
100 | } |
101 | ||
c3badc81 C |
102 | function getDeleteActivityPubUrl (originalUrl: string) { |
103 | return originalUrl + '/delete' | |
104 | } | |
105 | ||
892211e8 | 106 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { |
4e50b6a1 | 107 | return originalUrl + '/updates/' + updatedAt |
892211e8 C |
108 | } |
109 | ||
110 | function getUndoActivityPubUrl (originalUrl: string) { | |
111 | return originalUrl + '/undo' | |
112 | } | |
113 | ||
114 | export { | |
115 | getVideoActivityPubUrl, | |
418d092a C |
116 | getVideoPlaylistElementActivityPubUrl, |
117 | getVideoPlaylistActivityPubUrl, | |
09209296 | 118 | getVideoCacheStreamingPlaylistActivityPubUrl, |
892211e8 C |
119 | getVideoChannelActivityPubUrl, |
120 | getAccountActivityPubUrl, | |
121 | getVideoAbuseActivityPubUrl, | |
50d6de9c C |
122 | getActorFollowActivityPubUrl, |
123 | getActorFollowAcceptActivityPubUrl, | |
5c6d985f | 124 | getVideoAnnounceActivityPubUrl, |
892211e8 | 125 | getUpdateActivityPubUrl, |
40ff5707 | 126 | getUndoActivityPubUrl, |
0032ebe9 C |
127 | getVideoViewActivityPubUrl, |
128 | getVideoLikeActivityPubUrl, | |
bf1f6508 | 129 | getVideoDislikeActivityPubUrl, |
5b9c965d | 130 | getActorFollowRejectActivityPubUrl, |
c3badc81 | 131 | getVideoCommentActivityPubUrl, |
46531a0a C |
132 | getDeleteActivityPubUrl, |
133 | getVideoSharesActivityPubUrl, | |
134 | getVideoCommentsActivityPubUrl, | |
135 | getVideoLikesActivityPubUrl, | |
c48e82b5 C |
136 | getVideoDislikesActivityPubUrl, |
137 | getVideoCacheFileActivityPubUrl | |
892211e8 | 138 | } |