]>
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 | ||
24 | function getAccountFollowActivityPubUrl (accountFollow: AccountFollowInstance) { | |
25 | const me = accountFollow.AccountFollower | |
26 | const following = accountFollow.AccountFollowing | |
27 | ||
28 | return me.url + '#follows/' + following.id | |
29 | } | |
30 | ||
31 | function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowInstance) { | |
32 | const follower = accountFollow.AccountFollower | |
33 | const me = accountFollow.AccountFollowing | |
34 | ||
35 | return follower.url + '#accepts/follows/' + me.id | |
36 | } | |
37 | ||
38 | function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountInstance) { | |
39 | return originalUrl + '#announces/' + byAccount.id | |
40 | } | |
41 | ||
42 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { | |
43 | return originalUrl + '#updates/' + updatedAt | |
44 | } | |
45 | ||
46 | function getUndoActivityPubUrl (originalUrl: string) { | |
47 | return originalUrl + '/undo' | |
48 | } | |
49 | ||
50 | export { | |
51 | getVideoActivityPubUrl, | |
52 | getVideoChannelActivityPubUrl, | |
53 | getAccountActivityPubUrl, | |
54 | getVideoAbuseActivityPubUrl, | |
55 | getAccountFollowActivityPubUrl, | |
56 | getAccountFollowAcceptActivityPubUrl, | |
57 | getAnnounceActivityPubUrl, | |
58 | getUpdateActivityPubUrl, | |
59 | getUndoActivityPubUrl | |
60 | } |