]>
Commit | Line | Data |
---|---|---|
892211e8 C |
1 | import { CONFIG } from '../../initializers/constants' |
2 | import { VideoInstance } from '../../models/video/video-interface' | |
3 | import { VideoChannelInstance } from '../../models/video/video-channel-interface' | |
4 | import { VideoAbuseInstance } from '../../models/video/video-abuse-interface' | |
5 | import { AccountFollowInstance } from '../../models/account/account-follow-interface' | |
6 | import { AccountInstance } from '../../models/account/account-interface' | |
7 | ||
8 | function getVideoActivityPubUrl (video: VideoInstance) { | |
9 | return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid | |
10 | } | |
11 | ||
12 | function getVideoChannelActivityPubUrl (videoChannel: VideoChannelInstance) { | |
13 | return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid | |
14 | } | |
15 | ||
16 | function getAccountActivityPubUrl (accountName: string) { | |
17 | return CONFIG.WEBSERVER.URL + '/account/' + accountName | |
18 | } | |
19 | ||
20 | function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseInstance) { | |
21 | return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id | |
22 | } | |
23 | ||
40ff5707 | 24 | function getVideoViewActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) { |
4e50b6a1 | 25 | return video.url + '/views/' + byAccount.uuid + '/' + new Date().toISOString() |
40ff5707 C |
26 | } |
27 | ||
0032ebe9 | 28 | function getVideoLikeActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) { |
4e50b6a1 | 29 | return byAccount.url + '/likes/' + video.id |
0032ebe9 C |
30 | } |
31 | ||
32 | function getVideoDislikeActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) { | |
4e50b6a1 | 33 | return byAccount.url + '/dislikes/' + video.id |
0032ebe9 C |
34 | } |
35 | ||
892211e8 C |
36 | function getAccountFollowActivityPubUrl (accountFollow: AccountFollowInstance) { |
37 | const me = accountFollow.AccountFollower | |
38 | const following = accountFollow.AccountFollowing | |
39 | ||
4e50b6a1 | 40 | return me.url + '/follows/' + following.id |
892211e8 C |
41 | } |
42 | ||
43 | function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowInstance) { | |
44 | const follower = accountFollow.AccountFollower | |
45 | const me = accountFollow.AccountFollowing | |
46 | ||
4e50b6a1 | 47 | return follower.url + '/accepts/follows/' + me.id |
892211e8 C |
48 | } |
49 | ||
50 | function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountInstance) { | |
4e50b6a1 | 51 | return originalUrl + '/announces/' + byAccount.id |
892211e8 C |
52 | } |
53 | ||
54 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { | |
4e50b6a1 | 55 | return originalUrl + '/updates/' + updatedAt |
892211e8 C |
56 | } |
57 | ||
58 | function getUndoActivityPubUrl (originalUrl: string) { | |
59 | return originalUrl + '/undo' | |
60 | } | |
61 | ||
62 | export { | |
63 | getVideoActivityPubUrl, | |
64 | getVideoChannelActivityPubUrl, | |
65 | getAccountActivityPubUrl, | |
66 | getVideoAbuseActivityPubUrl, | |
67 | getAccountFollowActivityPubUrl, | |
68 | getAccountFollowAcceptActivityPubUrl, | |
69 | getAnnounceActivityPubUrl, | |
70 | getUpdateActivityPubUrl, | |
40ff5707 | 71 | getUndoActivityPubUrl, |
0032ebe9 C |
72 | getVideoViewActivityPubUrl, |
73 | getVideoLikeActivityPubUrl, | |
74 | getVideoDislikeActivityPubUrl | |
892211e8 | 75 | } |