aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/friends.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/server/lib/friends.ts b/server/lib/friends.ts
index 55cbb55b9..5c9baef47 100644
--- a/server/lib/friends.ts
+++ b/server/lib/friends.ts
@@ -349,6 +349,24 @@ function fetchRemotePreview (video: VideoInstance) {
349 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path) 349 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path)
350} 350}
351 351
352function fetchRemoteDescription (video: VideoInstance) {
353 const host = video.VideoChannel.Author.Pod.host
354 const path = video.getDescriptionPath()
355
356 const requestOptions = {
357 url: REMOTE_SCHEME.HTTP + '://' + host + path,
358 json: true
359 }
360
361 return new Promise<string>((res, rej) => {
362 request.get(requestOptions, (err, response, body) => {
363 if (err) return rej(err)
364
365 return res(body.description ? body.description : '')
366 })
367 })
368}
369
352async function removeFriend (pod: PodInstance) { 370async function removeFriend (pod: PodInstance) {
353 const requestParams = { 371 const requestParams = {
354 method: 'POST' as 'POST', 372 method: 'POST' as 'POST',
@@ -407,6 +425,7 @@ export {
407 getRequestVideoEventScheduler, 425 getRequestVideoEventScheduler,
408 fetchRemotePreview, 426 fetchRemotePreview,
409 addVideoChannelToFriends, 427 addVideoChannelToFriends,
428 fetchRemoteDescription,
410 updateVideoChannelToFriends, 429 updateVideoChannelToFriends,
411 removeVideoChannelToFriends 430 removeVideoChannelToFriends
412} 431}