]>
Commit | Line | Data |
---|---|---|
74dc3bca | 1 | import { WEBSERVER } from '../../initializers/constants' |
453e83ea | 2 | import { |
de94ac86 | 3 | MAbuseId, |
453e83ea C |
4 | MActor, |
5 | MActorFollowActors, | |
6 | MActorId, | |
7 | MActorUrl, | |
8 | MCommentId, | |
453e83ea | 9 | MVideoId, |
de94ac86 | 10 | MVideoPlaylistElement, |
453e83ea | 11 | MVideoUrl, |
de94ac86 | 12 | MVideoUUID |
26d6bf65 | 13 | } from '../../types/models' |
26d6bf65 | 14 | import { MVideoFileVideoUUID } from '../../types/models/video/video-file' |
de94ac86 | 15 | import { MVideoPlaylist, MVideoPlaylistUUID } from '../../types/models/video/video-playlist' |
26d6bf65 | 16 | import { MStreamingPlaylist } from '../../types/models/video/video-streaming-playlist' |
453e83ea | 17 | |
de94ac86 | 18 | function getLocalVideoActivityPubUrl (video: MVideoUUID) { |
6dd9de95 | 19 | return WEBSERVER.URL + '/videos/watch/' + video.uuid |
892211e8 C |
20 | } |
21 | ||
de94ac86 | 22 | function getLocalVideoPlaylistActivityPubUrl (videoPlaylist: MVideoPlaylist) { |
6dd9de95 | 23 | return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid |
418d092a C |
24 | } |
25 | ||
de94ac86 | 26 | function getLocalVideoPlaylistElementActivityPubUrl (videoPlaylist: MVideoPlaylistUUID, videoPlaylistElement: MVideoPlaylistElement) { |
37190663 | 27 | return WEBSERVER.URL + '/video-playlists/' + videoPlaylist.uuid + '/videos/' + videoPlaylistElement.id |
418d092a C |
28 | } |
29 | ||
de94ac86 | 30 | function getLocalVideoCacheFileActivityPubUrl (videoFile: MVideoFileVideoUUID) { |
d05be4d9 | 31 | const suffixFPS = videoFile.fps && videoFile.fps !== -1 ? '-' + videoFile.fps : '' |
c48e82b5 | 32 | |
6dd9de95 | 33 | return `${WEBSERVER.URL}/redundancy/videos/${videoFile.Video.uuid}/${videoFile.resolution}${suffixFPS}` |
c48e82b5 C |
34 | } |
35 | ||
de94ac86 | 36 | function getLocalVideoCacheStreamingPlaylistActivityPubUrl (video: MVideoUUID, playlist: MStreamingPlaylist) { |
6dd9de95 | 37 | return `${WEBSERVER.URL}/redundancy/streaming-playlists/${playlist.getStringType()}/${video.uuid}` |
09209296 C |
38 | } |
39 | ||
de94ac86 | 40 | function getLocalVideoCommentActivityPubUrl (video: MVideoUUID, videoComment: MCommentId) { |
6dd9de95 | 41 | return WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id |
50d6de9c C |
42 | } |
43 | ||
de94ac86 | 44 | function getLocalVideoChannelActivityPubUrl (videoChannelName: string) { |
6dd9de95 | 45 | return WEBSERVER.URL + '/video-channels/' + videoChannelName |
892211e8 C |
46 | } |
47 | ||
de94ac86 | 48 | function getLocalAccountActivityPubUrl (accountName: string) { |
6dd9de95 | 49 | return WEBSERVER.URL + '/accounts/' + accountName |
892211e8 C |
50 | } |
51 | ||
de94ac86 | 52 | function getLocalAbuseActivityPubUrl (abuse: MAbuseId) { |
d95d1559 | 53 | return WEBSERVER.URL + '/admin/abuses/' + abuse.id |
892211e8 C |
54 | } |
55 | ||
de94ac86 | 56 | function getLocalVideoViewActivityPubUrl (byActor: MActorUrl, video: MVideoId) { |
5c6d985f | 57 | return byActor.url + '/views/videos/' + video.id + '/' + new Date().toISOString() |
40ff5707 C |
58 | } |
59 | ||
de94ac86 | 60 | function getVideoLikeActivityPubUrlByLocalActor (byActor: MActorUrl, video: MVideoId) { |
50d6de9c | 61 | return byActor.url + '/likes/' + video.id |
0032ebe9 C |
62 | } |
63 | ||
de94ac86 | 64 | function getVideoDislikeActivityPubUrlByLocalActor (byActor: MActorUrl, video: MVideoId) { |
50d6de9c | 65 | return byActor.url + '/dislikes/' + video.id |
0032ebe9 C |
66 | } |
67 | ||
de94ac86 | 68 | function getLocalVideoSharesActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
69 | return video.url + '/announces' |
70 | } | |
71 | ||
de94ac86 | 72 | function getLocalVideoCommentsActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
73 | return video.url + '/comments' |
74 | } | |
75 | ||
de94ac86 | 76 | function getLocalVideoLikesActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
77 | return video.url + '/likes' |
78 | } | |
79 | ||
de94ac86 | 80 | function getLocalVideoDislikesActivityPubUrl (video: MVideoUrl) { |
46531a0a C |
81 | return video.url + '/dislikes' |
82 | } | |
83 | ||
de94ac86 | 84 | function getLocalActorFollowActivityPubUrl (follower: MActor, following: MActorId) { |
5b9c965d | 85 | return follower.url + '/follows/' + following.id |
892211e8 C |
86 | } |
87 | ||
de94ac86 | 88 | function getLocalActorFollowAcceptActivityPubUrl (actorFollow: MActorFollowActors) { |
50d6de9c C |
89 | const follower = actorFollow.ActorFollower |
90 | const me = actorFollow.ActorFollowing | |
892211e8 | 91 | |
de94ac86 | 92 | return WEBSERVER.URL + '/accepts/follows/' + follower.id + '/' + me.id |
892211e8 C |
93 | } |
94 | ||
de94ac86 C |
95 | function getLocalActorFollowRejectActivityPubUrl (follower: MActorId, following: MActorId) { |
96 | return WEBSERVER.URL + '/rejects/follows/' + follower.id + '/' + following.id | |
5b9c965d C |
97 | } |
98 | ||
de94ac86 | 99 | function getLocalVideoAnnounceActivityPubUrl (byActor: MActorId, video: MVideoUrl) { |
5c6d985f | 100 | return video.url + '/announces/' + byActor.id |
892211e8 C |
101 | } |
102 | ||
c3badc81 C |
103 | function getDeleteActivityPubUrl (originalUrl: string) { |
104 | return originalUrl + '/delete' | |
105 | } | |
106 | ||
892211e8 | 107 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { |
4e50b6a1 | 108 | return originalUrl + '/updates/' + updatedAt |
892211e8 C |
109 | } |
110 | ||
111 | function getUndoActivityPubUrl (originalUrl: string) { | |
112 | return originalUrl + '/undo' | |
113 | } | |
114 | ||
115 | export { | |
de94ac86 C |
116 | getLocalVideoActivityPubUrl, |
117 | getLocalVideoPlaylistActivityPubUrl, | |
118 | getLocalVideoPlaylistElementActivityPubUrl, | |
119 | getLocalVideoCacheFileActivityPubUrl, | |
120 | getLocalVideoCacheStreamingPlaylistActivityPubUrl, | |
121 | getLocalVideoCommentActivityPubUrl, | |
122 | getLocalVideoChannelActivityPubUrl, | |
123 | getLocalAccountActivityPubUrl, | |
124 | getLocalAbuseActivityPubUrl, | |
125 | getLocalActorFollowActivityPubUrl, | |
126 | getLocalActorFollowAcceptActivityPubUrl, | |
127 | getLocalVideoAnnounceActivityPubUrl, | |
892211e8 | 128 | getUpdateActivityPubUrl, |
40ff5707 | 129 | getUndoActivityPubUrl, |
de94ac86 C |
130 | getVideoLikeActivityPubUrlByLocalActor, |
131 | getLocalVideoViewActivityPubUrl, | |
132 | getVideoDislikeActivityPubUrlByLocalActor, | |
133 | getLocalActorFollowRejectActivityPubUrl, | |
46531a0a | 134 | getDeleteActivityPubUrl, |
de94ac86 C |
135 | getLocalVideoSharesActivityPubUrl, |
136 | getLocalVideoCommentsActivityPubUrl, | |
137 | getLocalVideoLikesActivityPubUrl, | |
55d5fbc5 | 138 | getLocalVideoDislikesActivityPubUrl |
892211e8 | 139 | } |