]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/webtorrent.ts
Add ability to disable p2p in embed with URL
[github/Chocobozzz/PeerTube.git] / server / helpers / webtorrent.ts
index b350c9718784f12c20cb2b282e118c2382d392b0..67cb3971d4a685e3d910f584daa30dac71643f5e 100644 (file)
@@ -15,6 +15,7 @@ import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/vide
 import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
 import { CONFIG } from '../initializers/config'
 import { promisify2 } from './core-utils'
+import { sha1 } from '@shared/core-utils/crypto'
 import { logger } from './logger'
 import { generateVideoImportTmpPath } from './utils'
 import { extractVideo } from './video'
@@ -145,6 +146,7 @@ async function updateTorrentMetadata (videoOrPlaylist: MVideo | MStreamingPlayli
   await remove(join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename))
 
   videoFile.torrentFilename = newTorrentFilename
+  videoFile.infoHash = sha1(encode(decoded.info))
 }
 
 function generateMagnetUri (