diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-30 10:16:27 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-30 10:16:27 +0100 |
commit | 9567011bf01f36c7f796ac1e0f1fb12c71635e53 (patch) | |
tree | bec3ed173767cff031ed0a84231d6dd50e792569 /server/lib | |
parent | 757f0da370a992cf07afd20d3829b2748c76cc15 (diff) | |
download | PeerTube-9567011bf01f36c7f796ac1e0f1fb12c71635e53.tar.gz PeerTube-9567011bf01f36c7f796ac1e0f1fb12c71635e53.tar.zst PeerTube-9567011bf01f36c7f796ac1e0f1fb12c71635e53.zip |
Add lazy description on server
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/friends.ts | 19 |
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 | ||
352 | function 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 | |||
352 | async function removeFriend (pod: PodInstance) { | 370 | async 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 | } |