mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-11 23:32:31 +00:00
feat: improve magnet link reliability with webseeds
- Update `UploadModal.js` to pre-calculate R2 keys and public URLs before upload. - Update `torrentHash.js` to embed the calculated video URL as a webseed (`url-list`) in the `.torrent` file. - Update `r2Service.js` to accept forced keys/URLs and append `&xs=` (pointing to the .torrent file) to the magnet link. - Ensures magnet links work for peerless downloads via WebSeed (BEP19) and HTTP Seeding (BEP17).
This commit is contained in:
1 parent
f748f663c8
commit
4e840c6159
3 files changed
+68
-9
No files matched your search
@@ -6,7 +6,7 @@ const TORRENT_SEED_OPTIONS = {
|
||||
destroyStoreOnDestroy: true,
|
||||
};
|
||||
|
||||
function seedTorrentForFile(file) {
|
||||
function seedTorrentForFile(file, urlList = []) {
|
||||
if (!file) {
|
||||
return Promise.reject(new Error("No file provided for hashing."));
|
||||
}
|
||||
@@ -25,6 +25,7 @@ function seedTorrentForFile(file) {
|
||||
{
|
||||
...TORRENT_SEED_OPTIONS,
|
||||
name: file.name,
|
||||
urlList: urlList,
|
||||
},
|
||||
(torrent) => {
|
||||
const infoHash = torrent.infoHash;
|
||||
@@ -66,6 +67,6 @@ export async function calculateTorrentInfoHash(file) {
|
||||
return infoHash;
|
||||
}
|
||||
|
||||
export async function createTorrentMetadata(file) {
|
||||
return seedTorrentForFile(file);
|
||||
export async function createTorrentMetadata(file, urlList = []) {
|
||||
return seedTorrentForFile(file, urlList);
|
||||
}
|
||||
Reference in new issue
Block a user