aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-15 11:00:25 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit608624252466acf9f1d9ee1c1170bd4fe4d18d18 (patch)
tree47eab55bb5421b7fe88e0b2ac743a436fd9561cf /server/helpers
parent51548b31815c6f96f314ae96588a9adca150519d (diff)
downloadPeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.tar.gz
PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.tar.zst
PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.zip
Rename Pod -> Server
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/activitypub.ts16
-rw-r--r--server/helpers/custom-validators/accounts.ts2
-rw-r--r--server/helpers/custom-validators/index.ts4
-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.ts4
-rw-r--r--server/helpers/webfinger.ts6
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
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,
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'
8import { logger } from '../logger' 8import { logger } from '../logger'
9 9
10import { isUserUsernameValid } from './users' 10import { isUserUsernameValid } from './users'
11import { isHostValid } from './pods' 11import { isHostValid } from './servers'
12 12
13function isAccountNameValid (value: string) { 13function 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 @@
1export * from './activitypub' 1export * from './activitypub'
2export * from './misc' 2export * from './misc'
3export * from './pods' 3export * from './servers'
4export * from './pods' 4export * from './servers'
5export * from './users' 5export * from './users'
6export * from './accounts' 6export * from './accounts'
7export * from './video-channels' 7export * 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) {
171function checkVideoExists (id: string, res: express.Response, callback: () => void) { 171function 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'
3import { isTestInstance } from './core-utils' 3import { isTestInstance } from './core-utils'
4import { isActivityPubUrlValid } from './custom-validators' 4import { isActivityPubUrlValid } from './custom-validators'
5import { WebFingerData } from '../../shared' 5import { WebFingerData } from '../../shared'
6import { fetchRemoteAccountAndCreatePod } from './activitypub' 6import { fetchRemoteAccountAndCreateServer } from './activitypub'
7 7
8const webfinger = new WebFinger({ 8const 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}