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