diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/activitypub.ts | 16 | ||||
-rw-r--r-- | server/helpers/custom-validators/accounts.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/index.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/servers.ts (renamed from server/helpers/custom-validators/pods.ts) | 0 | ||||
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 4 | ||||
-rw-r--r-- | server/helpers/webfinger.ts | 6 |
6 files changed, 16 insertions, 16 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 | ||
49 | async function fetchRemoteAccountAndCreatePod (accountUrl: string) { | 49 | async 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 | ||
107 | function fetchRemoteVideoPreview (video: VideoInstance) { | 107 | function 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 | ||
165 | export { | 165 | export { |
166 | fetchRemoteAccountAndCreatePod, | 166 | fetchRemoteAccountAndCreateServer, |
167 | activityPubContextify, | 167 | activityPubContextify, |
168 | activityPubCollectionPagination, | 168 | activityPubCollectionPagination, |
169 | getActivityPubUrl, | 169 | getActivityPubUrl, |
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts index 6d6219a95..088d5fc8f 100644 --- a/server/helpers/custom-validators/accounts.ts +++ b/server/helpers/custom-validators/accounts.ts | |||
@@ -8,7 +8,7 @@ import { AccountInstance } from '../../models' | |||
8 | import { logger } from '../logger' | 8 | import { logger } from '../logger' |
9 | 9 | ||
10 | import { isUserUsernameValid } from './users' | 10 | import { isUserUsernameValid } from './users' |
11 | import { isHostValid } from './pods' | 11 | import { isHostValid } from './servers' |
12 | 12 | ||
13 | function isAccountNameValid (value: string) { | 13 | function isAccountNameValid (value: string) { |
14 | return isUserUsernameValid(value) | 14 | return isUserUsernameValid(value) |
diff --git a/server/helpers/custom-validators/index.ts b/server/helpers/custom-validators/index.ts index 1c475e301..d3b2f5393 100644 --- a/server/helpers/custom-validators/index.ts +++ b/server/helpers/custom-validators/index.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | export * from './activitypub' | 1 | export * from './activitypub' |
2 | export * from './misc' | 2 | export * from './misc' |
3 | export * from './pods' | 3 | export * from './servers' |
4 | export * from './pods' | 4 | export * from './servers' |
5 | export * from './users' | 5 | export * from './users' |
6 | export * from './accounts' | 6 | export * from './accounts' |
7 | export * from './video-channels' | 7 | export * from './video-channels' |
diff --git a/server/helpers/custom-validators/pods.ts b/server/helpers/custom-validators/servers.ts index d5021bf38..d5021bf38 100644 --- a/server/helpers/custom-validators/pods.ts +++ b/server/helpers/custom-validators/servers.ts | |||
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 715119cf6..d68de6609 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -171,9 +171,9 @@ function isVideoFileInfoHashValid (value: string) { | |||
171 | function checkVideoExists (id: string, res: express.Response, callback: () => void) { | 171 | function checkVideoExists (id: string, res: express.Response, callback: () => void) { |
172 | let promise: Promise<VideoInstance> | 172 | let promise: Promise<VideoInstance> |
173 | if (validator.isInt(id)) { | 173 | if (validator.isInt(id)) { |
174 | promise = db.Video.loadAndPopulateAccountAndPodAndTags(+id) | 174 | promise = db.Video.loadAndPopulateAccountAndServerAndTags(+id) |
175 | } else { // UUID | 175 | } else { // UUID |
176 | promise = db.Video.loadByUUIDAndPopulateAccountAndPodAndTags(id) | 176 | promise = db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(id) |
177 | } | 177 | } |
178 | 178 | ||
179 | promise.then(video => { | 179 | promise.then(video => { |
diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts index 0155e5f3e..31417e728 100644 --- a/server/helpers/webfinger.ts +++ b/server/helpers/webfinger.ts | |||
@@ -3,7 +3,7 @@ import * as WebFinger from 'webfinger.js' | |||
3 | import { isTestInstance } from './core-utils' | 3 | import { isTestInstance } from './core-utils' |
4 | import { isActivityPubUrlValid } from './custom-validators' | 4 | import { isActivityPubUrlValid } from './custom-validators' |
5 | import { WebFingerData } from '../../shared' | 5 | import { WebFingerData } from '../../shared' |
6 | import { fetchRemoteAccountAndCreatePod } from './activitypub' | 6 | import { fetchRemoteAccountAndCreateServer } from './activitypub' |
7 | 7 | ||
8 | const webfinger = new WebFinger({ | 8 | const webfinger = new WebFinger({ |
9 | webfist_fallback: false, | 9 | webfist_fallback: false, |
@@ -22,8 +22,8 @@ async function getAccountFromWebfinger (nameWithHost: string) { | |||
22 | throw new Error('Cannot find self link or href is not a valid URL.') | 22 | throw new Error('Cannot find self link or href is not a valid URL.') |
23 | } | 23 | } |
24 | 24 | ||
25 | const res = await fetchRemoteAccountAndCreatePod(selfLink.href) | 25 | const res = await fetchRemoteAccountAndCreateServer(selfLink.href) |
26 | if (res === undefined) throw new Error('Cannot fetch and create pod of remote account ' + selfLink.href) | 26 | if (res === undefined) throw new Error('Cannot fetch and create server of remote account ' + selfLink.href) |
27 | 27 | ||
28 | return res.account | 28 | return res.account |
29 | } | 29 | } |