aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send-request.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-14 17:31:26 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch)
treef4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/lib/activitypub/send-request.ts
parente34c85e527100c0b5c44567bd951e95be41b8d7e (diff)
downloadPeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.gz
PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.zst
PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.zip
Follow works
Diffstat (limited to 'server/lib/activitypub/send-request.ts')
-rw-r--r--server/lib/activitypub/send-request.ts38
1 files changed, 19 insertions, 19 deletions
diff --git a/server/lib/activitypub/send-request.ts b/server/lib/activitypub/send-request.ts
index c18a69784..d47040d6d 100644
--- a/server/lib/activitypub/send-request.ts
+++ b/server/lib/activitypub/send-request.ts
@@ -10,60 +10,60 @@ import { httpRequestJobScheduler } from '../jobs'
10import { signObject, activityPubContextify } from '../../helpers' 10import { signObject, activityPubContextify } from '../../helpers'
11import { Activity } from '../../../shared' 11import { Activity } from '../../../shared'
12 12
13function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) { 13async function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
14 const videoChannelObject = videoChannel.toActivityPubObject() 14 const videoChannelObject = videoChannel.toActivityPubObject()
15 const data = createActivityData(videoChannel.url, videoChannel.Account, videoChannelObject) 15 const data = await createActivityData(videoChannel.url, videoChannel.Account, videoChannelObject)
16 16
17 return broadcastToFollowers(data, videoChannel.Account, t) 17 return broadcastToFollowers(data, videoChannel.Account, t)
18} 18}
19 19
20function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) { 20async function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
21 const videoChannelObject = videoChannel.toActivityPubObject() 21 const videoChannelObject = videoChannel.toActivityPubObject()
22 const data = updateActivityData(videoChannel.url, videoChannel.Account, videoChannelObject) 22 const data = await updateActivityData(videoChannel.url, videoChannel.Account, videoChannelObject)
23 23
24 return broadcastToFollowers(data, videoChannel.Account, t) 24 return broadcastToFollowers(data, videoChannel.Account, t)
25} 25}
26 26
27function sendDeleteVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) { 27async function sendDeleteVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
28 const data = deleteActivityData(videoChannel.url, videoChannel.Account) 28 const data = await deleteActivityData(videoChannel.url, videoChannel.Account)
29 29
30 return broadcastToFollowers(data, videoChannel.Account, t) 30 return broadcastToFollowers(data, videoChannel.Account, t)
31} 31}
32 32
33function sendAddVideo (video: VideoInstance, t: Sequelize.Transaction) { 33async function sendAddVideo (video: VideoInstance, t: Sequelize.Transaction) {
34 const videoObject = video.toActivityPubObject() 34 const videoObject = video.toActivityPubObject()
35 const data = addActivityData(video.url, video.VideoChannel.Account, video.VideoChannel.url, videoObject) 35 const data = await addActivityData(video.url, video.VideoChannel.Account, video.VideoChannel.url, videoObject)
36 36
37 return broadcastToFollowers(data, video.VideoChannel.Account, t) 37 return broadcastToFollowers(data, video.VideoChannel.Account, t)
38} 38}
39 39
40function sendUpdateVideo (video: VideoInstance, t: Sequelize.Transaction) { 40async function sendUpdateVideo (video: VideoInstance, t: Sequelize.Transaction) {
41 const videoObject = video.toActivityPubObject() 41 const videoObject = video.toActivityPubObject()
42 const data = updateActivityData(video.url, video.VideoChannel.Account, videoObject) 42 const data = await updateActivityData(video.url, video.VideoChannel.Account, videoObject)
43 43
44 return broadcastToFollowers(data, video.VideoChannel.Account, t) 44 return broadcastToFollowers(data, video.VideoChannel.Account, t)
45} 45}
46 46
47function sendDeleteVideo (video: VideoInstance, t: Sequelize.Transaction) { 47async function sendDeleteVideo (video: VideoInstance, t: Sequelize.Transaction) {
48 const data = deleteActivityData(video.url, video.VideoChannel.Account) 48 const data = await deleteActivityData(video.url, video.VideoChannel.Account)
49 49
50 return broadcastToFollowers(data, video.VideoChannel.Account, t) 50 return broadcastToFollowers(data, video.VideoChannel.Account, t)
51} 51}
52 52
53function sendDeleteAccount (account: AccountInstance, t: Sequelize.Transaction) { 53async function sendDeleteAccount (account: AccountInstance, t: Sequelize.Transaction) {
54 const data = deleteActivityData(account.url, account) 54 const data = await deleteActivityData(account.url, account)
55 55
56 return broadcastToFollowers(data, account, t) 56 return broadcastToFollowers(data, account, t)
57} 57}
58 58
59function sendAccept (fromAccount: AccountInstance, toAccount: AccountInstance, t: Sequelize.Transaction) { 59async function sendAccept (fromAccount: AccountInstance, toAccount: AccountInstance, t: Sequelize.Transaction) {
60 const data = acceptActivityData(fromAccount) 60 const data = await acceptActivityData(fromAccount)
61 61
62 return unicastTo(data, toAccount, t) 62 return unicastTo(data, toAccount, t)
63} 63}
64 64
65function sendFollow (fromAccount: AccountInstance, toAccount: AccountInstance, t: Sequelize.Transaction) { 65async function sendFollow (fromAccount: AccountInstance, toAccount: AccountInstance, t: Sequelize.Transaction) {
66 const data = followActivityData(toAccount.url, fromAccount) 66 const data = await followActivityData(toAccount.url, fromAccount)
67 67
68 return unicastTo(data, toAccount, t) 68 return unicastTo(data, toAccount, t)
69} 69}
@@ -97,7 +97,7 @@ async function broadcastToFollowers (data: any, fromAccount: AccountInstance, t:
97 97
98async function unicastTo (data: any, toAccount: AccountInstance, t: Sequelize.Transaction) { 98async function unicastTo (data: any, toAccount: AccountInstance, t: Sequelize.Transaction) {
99 const jobPayload = { 99 const jobPayload = {
100 uris: [ toAccount.url ], 100 uris: [ toAccount.inboxUrl ],
101 body: data 101 body: data
102 } 102 }
103 103