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