X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fwebtorrent.ts;h=3a99518c64127fc48d2b38cf7d28a4598ba9f810;hb=e92269053e3fd0e9b9c155ded86a1668444f3d70;hp=f3e41f8d6c93b7a059761603b10ec585c33cf35b;hpb=d7a25329f9e607894d29ab342b9cb66638b56dc0;p=github%2FChocobozzz%2FPeerTube.git 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 async function createTorrentAndSetInfoHash (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) { const video = extractVideo(videoOrPlaylist) + const { baseUrlHttp } = video.getBaseUrls() const options = { // 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 [ WEBSERVER.WS + '://' + WEBSERVER.HOSTNAME + ':' + WEBSERVER.PORT + '/tracker/socket' ], [ WEBSERVER.URL + '/tracker/announce' ] ], - urlList: [ WEBSERVER.URL + STATIC_PATHS.WEBSEED + getVideoFilename(videoOrPlaylist, videoFile) ] + urlList: [ videoOrPlaylist.getVideoFileUrl(videoFile, baseUrlHttp) ] } const torrent = await createTorrentPromise(getVideoFilePath(videoOrPlaylist, videoFile), options) @@ -126,6 +127,7 @@ function generateMagnetUri ( // --------------------------------------------------------------------------- export { + createTorrentPromise, createTorrentAndSetInfoHash, generateMagnetUri, downloadWebTorrentVideo