]>
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' |
892211e8 | 7 | |
3fd3ab2d | 8 | function getVideoActivityPubUrl (video: VideoModel) { |
892211e8 C |
9 | return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid |
10 | } | |
11 | ||
bf1f6508 | 12 | function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) { |
da854ddd | 13 | return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id |
50d6de9c C |
14 | } |
15 | ||
bf1f6508 C |
16 | function getVideoChannelActivityPubUrl (videoChannelUUID: string) { |
17 | return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID | |
892211e8 C |
18 | } |
19 | ||
20 | function getAccountActivityPubUrl (accountName: string) { | |
c5911fd3 | 21 | return CONFIG.WEBSERVER.URL + '/accounts/' + accountName |
892211e8 C |
22 | } |
23 | ||
3fd3ab2d | 24 | function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) { |
892211e8 C |
25 | return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id |
26 | } | |
27 | ||
50d6de9c C |
28 | function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) { |
29 | return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString() | |
40ff5707 C |
30 | } |
31 | ||
50d6de9c C |
32 | function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { |
33 | return byActor.url + '/likes/' + video.id | |
0032ebe9 C |
34 | } |
35 | ||
50d6de9c C |
36 | function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { |
37 | return byActor.url + '/dislikes/' + video.id | |
0032ebe9 C |
38 | } |
39 | ||
50d6de9c C |
40 | function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) { |
41 | const me = actorFollow.ActorFollower | |
42 | const following = actorFollow.ActorFollowing | |
892211e8 | 43 | |
4e50b6a1 | 44 | return me.url + '/follows/' + following.id |
892211e8 C |
45 | } |
46 | ||
50d6de9c C |
47 | function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) { |
48 | const follower = actorFollow.ActorFollower | |
49 | const me = actorFollow.ActorFollowing | |
892211e8 | 50 | |
4e50b6a1 | 51 | return follower.url + '/accepts/follows/' + me.id |
892211e8 C |
52 | } |
53 | ||
50d6de9c C |
54 | function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) { |
55 | return originalUrl + '/announces/' + byActor.id | |
892211e8 C |
56 | } |
57 | ||
c3badc81 C |
58 | function getDeleteActivityPubUrl (originalUrl: string) { |
59 | return originalUrl + '/delete' | |
60 | } | |
61 | ||
892211e8 | 62 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { |
4e50b6a1 | 63 | return originalUrl + '/updates/' + updatedAt |
892211e8 C |
64 | } |
65 | ||
66 | function getUndoActivityPubUrl (originalUrl: string) { | |
67 | return originalUrl + '/undo' | |
68 | } | |
69 | ||
70 | export { | |
71 | getVideoActivityPubUrl, | |
72 | getVideoChannelActivityPubUrl, | |
73 | getAccountActivityPubUrl, | |
74 | getVideoAbuseActivityPubUrl, | |
50d6de9c C |
75 | getActorFollowActivityPubUrl, |
76 | getActorFollowAcceptActivityPubUrl, | |
892211e8 C |
77 | getAnnounceActivityPubUrl, |
78 | getUpdateActivityPubUrl, | |
40ff5707 | 79 | getUndoActivityPubUrl, |
0032ebe9 C |
80 | getVideoViewActivityPubUrl, |
81 | getVideoLikeActivityPubUrl, | |
bf1f6508 | 82 | getVideoDislikeActivityPubUrl, |
c3badc81 C |
83 | getVideoCommentActivityPubUrl, |
84 | getDeleteActivityPubUrl | |
892211e8 | 85 | } |