aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/activitypub.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/activitypub.ts')
-rw-r--r--server/helpers/activitypub.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index b91490a0b..3e77e0581 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -35,7 +35,7 @@ async function getOrCreateAccount (accountUrl: string) {
35 35
36 // We don't have this account in our database, fetch it on remote 36 // We don't have this account in our database, fetch it on remote
37 if (!account) { 37 if (!account) {
38 const res = await fetchRemoteAccountAndCreatePod(accountUrl) 38 const res = await fetchRemoteAccountAndCreateServer(accountUrl)
39 if (res === undefined) throw new Error('Cannot fetch remote account.') 39 if (res === undefined) throw new Error('Cannot fetch remote account.')
40 40
41 // Save our new account in database 41 // Save our new account in database
@@ -46,7 +46,7 @@ async function getOrCreateAccount (accountUrl: string) {
46 return account 46 return account
47} 47}
48 48
49async function fetchRemoteAccountAndCreatePod (accountUrl: string) { 49async function fetchRemoteAccountAndCreateServer (accountUrl: string) {
50 const options = { 50 const options = {
51 uri: accountUrl, 51 uri: accountUrl,
52 method: 'GET', 52 method: 'GET',
@@ -90,7 +90,7 @@ async function fetchRemoteAccountAndCreatePod (accountUrl: string) {
90 }) 90 })
91 91
92 const accountHost = url.parse(account.url).host 92 const accountHost = url.parse(account.url).host
93 const podOptions = { 93 const serverOptions = {
94 where: { 94 where: {
95 host: accountHost 95 host: accountHost
96 }, 96 },
@@ -98,15 +98,15 @@ async function fetchRemoteAccountAndCreatePod (accountUrl: string) {
98 host: accountHost 98 host: accountHost
99 } 99 }
100 } 100 }
101 const [ pod ] = await db.Pod.findOrCreate(podOptions) 101 const [ server ] = await db.Server.findOrCreate(serverOptions)
102 account.set('podId', pod.id) 102 account.set('serverId', server.id)
103 103
104 return { account, pod } 104 return { account, server }
105} 105}
106 106
107function fetchRemoteVideoPreview (video: VideoInstance) { 107function fetchRemoteVideoPreview (video: VideoInstance) {
108 // FIXME: use url 108 // FIXME: use url
109 const host = video.VideoChannel.Account.Pod.host 109 const host = video.VideoChannel.Account.Server.host
110 const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName()) 110 const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName())
111 111
112 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path) 112 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path)
@@ -163,7 +163,7 @@ function activityPubCollectionPagination (url: string, page: number, result: Res
163// --------------------------------------------------------------------------- 163// ---------------------------------------------------------------------------
164 164
165export { 165export {
166 fetchRemoteAccountAndCreatePod, 166 fetchRemoteAccountAndCreateServer,
167 activityPubContextify, 167 activityPubContextify,
168 activityPubCollectionPagination, 168 activityPubCollectionPagination,
169 getActivityPubUrl, 169 getActivityPubUrl,