aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webtorrent.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/webtorrent.ts')
-rw-r--r--server/helpers/webtorrent.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts
index f3e41f8d6..3a99518c6 100644
--- a/server/helpers/webtorrent.ts
+++ b/server/helpers/webtorrent.ts
@@ -72,6 +72,7 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName
72 72
73async function createTorrentAndSetInfoHash (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) { 73async function createTorrentAndSetInfoHash (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) {
74 const video = extractVideo(videoOrPlaylist) 74 const video = extractVideo(videoOrPlaylist)
75 const { baseUrlHttp } = video.getBaseUrls()
75 76
76 const options = { 77 const options = {
77 // Keep the extname, it's used by the client to stream the file inside a web browser 78 // Keep the extname, it's used by the client to stream the file inside a web browser
@@ -81,7 +82,7 @@ async function createTorrentAndSetInfoHash (videoOrPlaylist: MVideo | MStreaming
81 [ WEBSERVER.WS + '://' + WEBSERVER.HOSTNAME + ':' + WEBSERVER.PORT + '/tracker/socket' ], 82 [ WEBSERVER.WS + '://' + WEBSERVER.HOSTNAME + ':' + WEBSERVER.PORT + '/tracker/socket' ],
82 [ WEBSERVER.URL + '/tracker/announce' ] 83 [ WEBSERVER.URL + '/tracker/announce' ]
83 ], 84 ],
84 urlList: [ WEBSERVER.URL + STATIC_PATHS.WEBSEED + getVideoFilename(videoOrPlaylist, videoFile) ] 85 urlList: [ videoOrPlaylist.getVideoFileUrl(videoFile, baseUrlHttp) ]
85 } 86 }
86 87
87 const torrent = await createTorrentPromise(getVideoFilePath(videoOrPlaylist, videoFile), options) 88 const torrent = await createTorrentPromise(getVideoFilePath(videoOrPlaylist, videoFile), options)
@@ -126,6 +127,7 @@ function generateMagnetUri (
126// --------------------------------------------------------------------------- 127// ---------------------------------------------------------------------------
127 128
128export { 129export {
130 createTorrentPromise,
129 createTorrentAndSetInfoHash, 131 createTorrentAndSetInfoHash,
130 generateMagnetUri, 132 generateMagnetUri,
131 downloadWebTorrentVideo 133 downloadWebTorrentVideo