1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Fix infohash with object storage

This commit is contained in:
Chocobozzz 2021-09-07 15:16:26 +02:00
parent 6f9719b568
commit fb72d2e1c2
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 43 additions and 1 deletions

View file

@ -0,0 +1,27 @@
import { expect } from 'chai'
import { sha1 } from '@server/helpers/core-utils'
import { makeGetRequest } from '../requests'
async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) {
const path = '/tracker/announce'
const infohash = sha1(`2${masterPlaylistUrl}+V${fileNumber}`)
// From bittorrent-tracker
const infohashBinary = escape(Buffer.from(infohash, 'hex').toString('binary')).replace(/[@*/+]/g, function (char) {
return '%' + char.charCodeAt(0).toString(16).toUpperCase()
})
const res = await makeGetRequest({
url: serverUrl,
path,
rawQuery: `peer_id=-WW0105-NkvYO/egUAr4&info_hash=${infohashBinary}&port=42100`,
expectedStatus: 200
})
expect(res.text).to.not.contain('failure')
}
export {
hlsInfohashExist
}