aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/url.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-20 10:24:29 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit892211e8493b1f992fce7616cb1e48b7ff87a1dc (patch)
tree7bb218141a20c14d293d695ad4dad12687e537b2 /server/lib/activitypub/url.ts
parent54141398354e6e7b94aa3065a705a1251390111c (diff)
downloadPeerTube-892211e8493b1f992fce7616cb1e48b7ff87a1dc.tar.gz
PeerTube-892211e8493b1f992fce7616cb1e48b7ff87a1dc.tar.zst
PeerTube-892211e8493b1f992fce7616cb1e48b7ff87a1dc.zip
Move activitypub functions from helpers/ to lib/
Diffstat (limited to 'server/lib/activitypub/url.ts')
-rw-r--r--server/lib/activitypub/url.ts60
1 files changed, 60 insertions, 0 deletions
diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts
new file mode 100644
index 000000000..41ac0f9a8
--- /dev/null
+++ b/server/lib/activitypub/url.ts
@@ -0,0 +1,60 @@
1import { CONFIG } from '../../initializers/constants'
2import { VideoInstance } from '../../models/video/video-interface'
3import { VideoChannelInstance } from '../../models/video/video-channel-interface'
4import { VideoAbuseInstance } from '../../models/video/video-abuse-interface'
5import { AccountFollowInstance } from '../../models/account/account-follow-interface'
6import { AccountInstance } from '../../models/account/account-interface'
7
8function getVideoActivityPubUrl (video: VideoInstance) {
9 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
10}
11
12function getVideoChannelActivityPubUrl (videoChannel: VideoChannelInstance) {
13 return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid
14}
15
16function getAccountActivityPubUrl (accountName: string) {
17 return CONFIG.WEBSERVER.URL + '/account/' + accountName
18}
19
20function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseInstance) {
21 return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
22}
23
24function getAccountFollowActivityPubUrl (accountFollow: AccountFollowInstance) {
25 const me = accountFollow.AccountFollower
26 const following = accountFollow.AccountFollowing
27
28 return me.url + '#follows/' + following.id
29}
30
31function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowInstance) {
32 const follower = accountFollow.AccountFollower
33 const me = accountFollow.AccountFollowing
34
35 return follower.url + '#accepts/follows/' + me.id
36}
37
38function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountInstance) {
39 return originalUrl + '#announces/' + byAccount.id
40}
41
42function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
43 return originalUrl + '#updates/' + updatedAt
44}
45
46function getUndoActivityPubUrl (originalUrl: string) {
47 return originalUrl + '/undo'
48}
49
50export {
51 getVideoActivityPubUrl,
52 getVideoChannelActivityPubUrl,
53 getAccountActivityPubUrl,
54 getVideoAbuseActivityPubUrl,
55 getAccountFollowActivityPubUrl,
56 getAccountFollowAcceptActivityPubUrl,
57 getAnnounceActivityPubUrl,
58 getUpdateActivityPubUrl,
59 getUndoActivityPubUrl
60}