1
0
Fork 0

Fix webtorrent crash

See https://github.com/Chocobozzz/PeerTube/issues/6109
This commit is contained in:
Chocobozzz 2023-12-15 10:18:20 +01:00
parent ea685879bb
commit 675f219639
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 5 additions and 1 deletions

View file

@ -80,6 +80,7 @@ describe('Time to int', function () {
expect(timeToInt('5h10m')).to.equal(5 * 3600 + 60 * 10) expect(timeToInt('5h10m')).to.equal(5 * 3600 + 60 * 10)
expect(timeToInt('5h10m0s')).to.equal(5 * 3600 + 60 * 10) expect(timeToInt('5h10m0s')).to.equal(5 * 3600 + 60 * 10)
expect(timeToInt('5h10m0')).to.equal(5 * 3600 + 60 * 10)
expect(timeToInt(3500)).to.equal(3500) expect(timeToInt(3500)).to.equal(3500)
}) })

View file

@ -36,7 +36,10 @@ async function downloadWebTorrentVideo (target: { uri: string, torrentName?: str
await ensureDir(directoryPath) await ensureDir(directoryPath)
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
const webtorrent = new (await import('webtorrent')).default() const webtorrent = new (await import('webtorrent')).default({
natUpnp: false,
natPmp: false
} as any)
return new Promise<string>((res, rej) => { return new Promise<string>((res, rej) => {
let file: TorrentFile let file: TorrentFile