mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-10-29 03:04:13 -07:00
Standardize Quotes
This commit is contained in:
3 files changed
+195
-195
No files matched your search
+97
-97
@@ -62688,10 +62688,10 @@ function start() {
|
|||||||
// magnet input
|
// magnet input
|
||||||
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (event.key === "Enter") {
|
if (event.key === 'Enter') {
|
||||||
source = "magnet";
|
source = 'magnet';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Magnet URL");
|
sourceTooltip.setContent('Currently loaded information sourced from Magnet URL');
|
||||||
parse(magnet.value);
|
parse(magnet.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -62700,9 +62700,9 @@ function start() {
|
|||||||
document.getElementById('torrent').addEventListener('change', function(event) {
|
document.getElementById('torrent').addEventListener('change', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
||||||
source = "torrent-file";
|
source = 'torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from Torrent file');
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -62715,9 +62715,9 @@ function start() {
|
|||||||
document.addEventListener('drop', function(event) {
|
document.addEventListener('drop', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.dataTransfer.items[0].getAsFile().arrayBuffer().then(function(arrayBuffer) {
|
event.dataTransfer.items[0].getAsFile().arrayBuffer().then(function(arrayBuffer) {
|
||||||
source = "torrent-file";
|
source = 'torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from Torrent file');
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -62725,30 +62725,30 @@ function start() {
|
|||||||
// example buttons
|
// example buttons
|
||||||
example1.addEventListener('click', function(event) {
|
example1.addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
notyf.success('Parsing Ubuntu 20.04 Magnet URL');
|
||||||
source = "magnet";
|
source = 'magnet';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Magnet URL");
|
sourceTooltip.setContent('Currently loaded information sourced from Magnet URL');
|
||||||
parse("magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce");
|
parse('magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce');
|
||||||
});
|
});
|
||||||
|
|
||||||
example2.addEventListener('click', async function(event) {
|
example2.addEventListener('click', async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Fetching and Parsing “The WIRED CD” Torrent File...");
|
notyf.success('Fetching and Parsing “The WIRED CD” Torrent File...');
|
||||||
source = "remote-torrent-file";
|
source = 'remote-torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from remotely fetched Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from remotely fetched Torrent file');
|
||||||
parseRemote("https://webtorrent.io/torrents/wired-cd.torrent");
|
parseRemote('https://webtorrent.io/torrents/wired-cd.torrent');
|
||||||
});
|
});
|
||||||
|
|
||||||
example3.addEventListener('click', async function(event) {
|
example3.addEventListener('click', async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
notyf.success('Parsing Jack Johnson Archive.org Torrent File');
|
||||||
let response = await fetch("/ext/jj2008-06-14.mk4_archive.torrent");
|
let response = await fetch('/ext/jj2008-06-14.mk4_archive.torrent');
|
||||||
let arrayBuffer = await response.arrayBuffer();
|
let arrayBuffer = await response.arrayBuffer();
|
||||||
source = "torrent-file";
|
source = 'torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from Torrent file');
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -62801,9 +62801,9 @@ function start() {
|
|||||||
sourceTooltip.disable();
|
sourceTooltip.disable();
|
||||||
|
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
source = "shared-url";
|
source = 'shared-url';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-link fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-link fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from shared torrent.parts link");
|
sourceTooltip.setContent('Currently loaded information sourced from shared torrent.parts link');
|
||||||
parse(window.location.hash.split('#')[1]);
|
parse(window.location.hash.split('#')[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62812,18 +62812,18 @@ function start() {
|
|||||||
function parse(toLoad) {
|
function parse(toLoad) {
|
||||||
resetProperties();
|
resetProperties();
|
||||||
try {
|
try {
|
||||||
console.info("Attempting parse");
|
console.info('Attempting parse');
|
||||||
parsed = parser(toLoad);
|
parsed = parser(toLoad);
|
||||||
display();
|
display();
|
||||||
if (parsed.xs) {
|
if (parsed.xs) {
|
||||||
console.info("Magnet includes xs, attempting remote parse");
|
console.info('Magnet includes xs, attempting remote parse');
|
||||||
parseRemote(parsed.xs);
|
parseRemote(parsed.xs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(e) { // maybe they put a URL to a torrent file in the magnet box?
|
catch(e) { // maybe they put a URL to a torrent file in the magnet box?
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
if (source == "magnet") {
|
if (source == 'magnet') {
|
||||||
console.info("Attempting remote parse");
|
console.info('Attempting remote parse');
|
||||||
parseRemote(toLoad);
|
parseRemote(toLoad);
|
||||||
} else { // probably not. Just a bad file.
|
} else { // probably not. Just a bad file.
|
||||||
notyf.error('Problem parsing input. Is this a .torrent file?');
|
notyf.error('Problem parsing input. Is this a .torrent file?');
|
||||||
@@ -62840,9 +62840,9 @@ function parseRemote(toLoad) {
|
|||||||
resetProperties();
|
resetProperties();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
source = "remote-torrent-file";
|
source = 'remote-torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from remotely fetched Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from remotely fetched Torrent file');
|
||||||
parsed = result;
|
parsed = result;
|
||||||
display();
|
display();
|
||||||
});
|
});
|
||||||
@@ -62853,17 +62853,17 @@ function display() {
|
|||||||
console.log(parsed);
|
console.log(parsed);
|
||||||
|
|
||||||
hash.value = parsed.infoHash;
|
hash.value = parsed.infoHash;
|
||||||
name.value = parsed.name ? parsed.name : "";
|
name.value = parsed.name ? parsed.name : '';
|
||||||
if (parsed.created) {
|
if (parsed.created) {
|
||||||
created.value = parsed.created.toISOString().slice(0, 19);
|
created.value = parsed.created.toISOString().slice(0, 19);
|
||||||
created.type = "datetime-local";
|
created.type = 'datetime-local';
|
||||||
} else {
|
} else {
|
||||||
created.type = "text";
|
created.type = 'text';
|
||||||
}
|
}
|
||||||
createdBy.value = parsed.createdBy ? "by " + parsed.createdBy : "";
|
createdBy.value = parsed.createdBy ? ' by ' + parsed.createdBy : '';
|
||||||
comment.value = parsed.comment ? parsed.comment : "";
|
comment.value = parsed.comment ? parsed.comment : '';
|
||||||
|
|
||||||
announce.innerHTML = "";
|
announce.innerHTML = '';
|
||||||
if (parsed.announce && parsed.announce.length) {
|
if (parsed.announce && parsed.announce.length) {
|
||||||
for (let i = 0; i < parsed.announce.length; i++) {
|
for (let i = 0; i < parsed.announce.length; i++) {
|
||||||
let row = document.createElement('div');
|
let row = document.createElement('div');
|
||||||
@@ -62886,10 +62886,10 @@ function display() {
|
|||||||
announce.appendChild(row);
|
announce.appendChild(row);
|
||||||
}
|
}
|
||||||
// } else {
|
// } else {
|
||||||
// announce.innerHTML = "<em>No trackers specified in the URL/File provided</em>";
|
// announce.innerHTML = '<em>No trackers specified in the URL/File provided</em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
urlList.innerHTML = "";
|
urlList.innerHTML = '';
|
||||||
if (parsed.urlList && parsed.urlList.length) {
|
if (parsed.urlList && parsed.urlList.length) {
|
||||||
for (let i = 0; i < parsed.urlList.length; i++) {
|
for (let i = 0; i < parsed.urlList.length; i++) {
|
||||||
let row = document.createElement('div');
|
let row = document.createElement('div');
|
||||||
@@ -62912,12 +62912,12 @@ function display() {
|
|||||||
urlList.appendChild(row);
|
urlList.appendChild(row);
|
||||||
}
|
}
|
||||||
// } else {
|
// } else {
|
||||||
// urlList.innerHTML = "<em>No webseed URLs in the URL/File provided</em>";
|
// urlList.innerHTML = '<em>No webseed URLs in the URL/File provided</em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
files.innerHTML = "";
|
files.innerHTML = '';
|
||||||
if (parsed.files && parsed.files.length) {
|
if (parsed.files && parsed.files.length) {
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = 'none';
|
||||||
if (parsed.files.length < 100) {
|
if (parsed.files.length < 100) {
|
||||||
for (let file of parsed.files) {
|
for (let file of parsed.files) {
|
||||||
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
||||||
@@ -62936,10 +62936,10 @@ function display() {
|
|||||||
downloadTorrent.disabled = false;
|
downloadTorrent.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
if (client.torrents.length > 0) {
|
if (client.torrents.length > 0) {
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = 'none';
|
||||||
files.innerHTML = '<input type="text" placeholder="Attempting fetching of files from Webtorrent..." aria-label="Attempting fetching of files from Webtorrent..." disabled>';
|
files.innerHTML = '<input type="text" placeholder="Attempting fetching of files from Webtorrent..." aria-label="Attempting fetching of files from Webtorrent..." disabled>';
|
||||||
} else {
|
} else {
|
||||||
getFiles.style.display = "block";
|
getFiles.style.display = 'block';
|
||||||
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
||||||
}
|
}
|
||||||
downloadTorrentTooltip.setContent('Files metadata is required to generate a Torrent file. Try fetching files list from WebTorrent.');
|
downloadTorrentTooltip.setContent('Files metadata is required to generate a Torrent file. Try fetching files list from WebTorrent.');
|
||||||
@@ -62947,7 +62947,7 @@ function display() {
|
|||||||
downloadTorrent.disabled = true;
|
downloadTorrent.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyURL.setAttribute('data-clipboard-text', window.location.origin + "#" + parser.toMagnetURI(parsed));
|
copyURL.setAttribute('data-clipboard-text', window.location.origin + '#' + parser.toMagnetURI(parsed));
|
||||||
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
||||||
|
|
||||||
examples.style.display = 'none';
|
examples.style.display = 'none';
|
||||||
@@ -62956,9 +62956,9 @@ function display() {
|
|||||||
window.location.hash = parser.toMagnetURI(parsed);
|
window.location.hash = parser.toMagnetURI(parsed);
|
||||||
|
|
||||||
if (parsed.name) {
|
if (parsed.name) {
|
||||||
document.title = "Torrent Parts | " + parsed.name;
|
document.title = 'Torrent Parts | ' + parsed.name;
|
||||||
} else {
|
} else {
|
||||||
document.title = "Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link";
|
document.title = 'Torrent Parts | Inspect and edit what\'s in your Torrent file or Magnet link';
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceTooltip.enable();
|
sourceTooltip.enable();
|
||||||
@@ -62990,37 +62990,37 @@ function createFileRow(icon, name, size) {
|
|||||||
function getFontAwesomeIconForMimetype(mimetype) {
|
function getFontAwesomeIconForMimetype(mimetype) {
|
||||||
if (!mimetype) return 'file';
|
if (!mimetype) return 'file';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case mimetype.includes("msword"):
|
case mimetype.includes('msword'):
|
||||||
case mimetype.includes("wordprocessingml"):
|
case mimetype.includes('wordprocessingml'):
|
||||||
case mimetype.includes("opendocument.text"):
|
case mimetype.includes('opendocument.text'):
|
||||||
case mimetype.includes("abiword"):
|
case mimetype.includes('abiword'):
|
||||||
return 'file-word';
|
return 'file-word';
|
||||||
case mimetype.includes("ms-excel"):
|
case mimetype.includes('ms-excel'):
|
||||||
case mimetype.includes("spreadsheet"):
|
case mimetype.includes('spreadsheet'):
|
||||||
return 'file-powerpoint';
|
return 'file-powerpoint';
|
||||||
case mimetype.includes("powerpoint"):
|
case mimetype.includes('powerpoint'):
|
||||||
case mimetype.includes("presentation"):
|
case mimetype.includes('presentation'):
|
||||||
return 'file-powerpoint';
|
return 'file-powerpoint';
|
||||||
case mimetype.includes("7z-"):
|
case mimetype.includes('7z-'):
|
||||||
case mimetype.includes("iso9660"):
|
case mimetype.includes('iso9660'):
|
||||||
case mimetype.includes("zip"):
|
case mimetype.includes('zip'):
|
||||||
case mimetype.includes("octet-stream"):
|
case mimetype.includes('octet-stream'):
|
||||||
return 'file-archive';
|
return 'file-archive';
|
||||||
case mimetype.includes("csv"):
|
case mimetype.includes('csv'):
|
||||||
return 'file-csv';
|
return 'file-csv';
|
||||||
case mimetype.includes("pdf"):
|
case mimetype.includes('pdf'):
|
||||||
return 'file-pdf';
|
return 'file-pdf';
|
||||||
case mimetype.includes("font"):
|
case mimetype.includes('font'):
|
||||||
return 'file-contract';
|
return 'file-contract';
|
||||||
case mimetype.includes("text"):
|
case mimetype.includes('text'):
|
||||||
case mimetype.includes("subrip"):
|
case mimetype.includes('subrip'):
|
||||||
case mimetype.includes("vtt"):
|
case mimetype.includes('vtt'):
|
||||||
return 'file-alt';
|
return 'file-alt';
|
||||||
case mimetype.includes("audio"):
|
case mimetype.includes('audio'):
|
||||||
return 'file-audio';
|
return 'file-audio';
|
||||||
case mimetype.includes("image"):
|
case mimetype.includes('image'):
|
||||||
return 'file-image';
|
return 'file-image';
|
||||||
case mimetype.includes("video"):
|
case mimetype.includes('video'):
|
||||||
return 'file-video';
|
return 'file-video';
|
||||||
default:
|
default:
|
||||||
return 'file';
|
return 'file';
|
||||||
@@ -63029,33 +63029,33 @@ function getFontAwesomeIconForMimetype(mimetype) {
|
|||||||
|
|
||||||
function propertyChange(e) {
|
function propertyChange(e) {
|
||||||
if (this.dataset.group) {
|
if (this.dataset.group) {
|
||||||
parsed[this.dataset.group][this.dataset.index] = this.value ? this.value : "";
|
parsed[this.dataset.group][this.dataset.index] = this.value ? this.value : '';
|
||||||
} else {
|
} else {
|
||||||
parsed[this.id] = this.value ? this.value : "";
|
parsed[this.id] = this.value ? this.value : '';
|
||||||
}
|
}
|
||||||
window.location.hash = parser.toMagnetURI(parsed);
|
window.location.hash = parser.toMagnetURI(parsed);
|
||||||
updateModified();
|
updateModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetProperties() {
|
function resetProperties() {
|
||||||
document.getElementById('magnet').value = "";
|
document.getElementById('magnet').value = '';
|
||||||
document.getElementById('torrent').value = "";
|
document.getElementById('torrent').value = '';
|
||||||
examples.style.display = 'flex';
|
examples.style.display = 'flex';
|
||||||
properties.style.display = 'none';
|
properties.style.display = 'none';
|
||||||
name.value = "";
|
name.value = '';
|
||||||
created.value = "";
|
created.value = '';
|
||||||
createdBy.value = "";
|
createdBy.value = '';
|
||||||
comment.value = "";
|
comment.value = '';
|
||||||
hash.value = "";
|
hash.value = '';
|
||||||
announce.innerHTML = "";
|
announce.innerHTML = '';
|
||||||
urlList.innerHTML = "";
|
urlList.innerHTML = '';
|
||||||
client.torrents.forEach(torrent => torrent.destroy());
|
client.torrents.forEach(torrent => torrent.destroy());
|
||||||
getFiles.style.display = "block";
|
getFiles.style.display = 'block';
|
||||||
files.innerHTML = "";
|
files.innerHTML = '';
|
||||||
window.location.hash = "";
|
window.location.hash = '';
|
||||||
copyURL.setAttribute('data-clipboard-text', "");
|
copyURL.setAttribute('data-clipboard-text', '');
|
||||||
copyMagnet.setAttribute('data-clipboard-text', "");
|
copyMagnet.setAttribute('data-clipboard-text', '');
|
||||||
document.title = "Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link";
|
document.title = 'Torrent Parts | Inspect and edit what\'s in your Torrent file or Magnet link';
|
||||||
sourceTooltip.disable();
|
sourceTooltip.disable();
|
||||||
gtag('event', 'reset');
|
gtag('event', 'reset');
|
||||||
}
|
}
|
||||||
@@ -63064,11 +63064,11 @@ async function addCurrentTrackers() {
|
|||||||
addTrackers.className = 'disabled';
|
addTrackers.className = 'disabled';
|
||||||
addTrackers.innerHTML = 'Adding...';
|
addTrackers.innerHTML = 'Adding...';
|
||||||
try {
|
try {
|
||||||
let response = await fetch("https://newtrackon.com/api/stable"); // get trackers with 95% uptime
|
let response = await fetch('https://newtrackon.com/api/stable'); // get trackers with 95% uptime
|
||||||
let trackers = await response.text();
|
let trackers = await response.text();
|
||||||
parsed.announce = parsed.announce.concat(trackers.split('\n\n'));
|
parsed.announce = parsed.announce.concat(trackers.split('\n\n'));
|
||||||
parsed.announce.push("http://bt1.archive.org:6969/announce");
|
parsed.announce.push('http://bt1.archive.org:6969/announce');
|
||||||
parsed.announce.push("http://bt2.archive.org:6969/announce");
|
parsed.announce.push('http://bt2.archive.org:6969/announce');
|
||||||
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
||||||
notyf.success('Added known working trackers from newTrackon');
|
notyf.success('Added known working trackers from newTrackon');
|
||||||
updateModified();
|
updateModified();
|
||||||
@@ -63084,7 +63084,7 @@ async function addCurrentTrackers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addRow() {
|
function addRow() {
|
||||||
parsed[this.dataset.type].unshift("");
|
parsed[this.dataset.type].unshift('');
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63101,23 +63101,23 @@ function removeAllRows(type) {
|
|||||||
|
|
||||||
function updateModified() {
|
function updateModified() {
|
||||||
parsed.created = new Date();
|
parsed.created = new Date();
|
||||||
parsed.createdBy = "Torrent Parts <https://torrent.parts/>";
|
parsed.createdBy = 'Torrent Parts <https://torrent.parts/>';
|
||||||
if (parsed.created) {
|
if (parsed.created) {
|
||||||
created.value = parsed.created.toISOString().slice(0, 19);
|
created.value = parsed.created.toISOString().slice(0, 19);
|
||||||
created.type = "datetime-local";
|
created.type = 'datetime-local';
|
||||||
} else {
|
} else {
|
||||||
created.type = "text";
|
created.type = 'text';
|
||||||
}
|
}
|
||||||
createdBy.value = parsed.createdBy ? "by " + parsed.createdBy : "";
|
createdBy.value = parsed.createdBy ? ' by ' + parsed.createdBy : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFilesFromPeers() {
|
function getFilesFromPeers() {
|
||||||
console.info("Attempting fetching files from Webtorrent...");
|
console.info('Attempting fetching files from Webtorrent...');
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = 'none';
|
||||||
parsed.announce.push("wss://tracker.webtorrent.io");
|
parsed.announce.push('wss://tracker.webtorrent.io');
|
||||||
parsed.announce.push("wss://tracker.openwebtorrent.com");
|
parsed.announce.push('wss://tracker.openwebtorrent.com');
|
||||||
parsed.announce.push("wss://tracker.btorrent.xyz");
|
parsed.announce.push('wss://tracker.btorrent.xyz');
|
||||||
parsed.announce.push("wss://tracker.fastcast.nz");
|
parsed.announce.push('wss://tracker.fastcast.nz');
|
||||||
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
||||||
client.add(parser.toMagnetURI(parsed), (torrent) => {
|
client.add(parser.toMagnetURI(parsed), (torrent) => {
|
||||||
parsed.info = Object.assign({}, torrent.info); // clone object
|
parsed.info = Object.assign({}, torrent.info); // clone object
|
||||||
@@ -63142,8 +63142,8 @@ function saveTorrent() {
|
|||||||
let a = document.createElement('a');
|
let a = document.createElement('a');
|
||||||
a.style.display = 'none';
|
a.style.display = 'none';
|
||||||
let url = window.URL.createObjectURL(new Blob([data], { "type": "application/x-bittorrent" }));
|
let url = window.URL.createObjectURL(new Blob([data], { "type": "application/x-bittorrent" }));
|
||||||
a.setAttribute("href", url);
|
a.setAttribute('href', url);
|
||||||
a.setAttribute("download", parsed.name + '.torrent');
|
a.setAttribute('download', parsed.name + '.torrent');
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
|
|||||||
Vendored
+1
-1
@@ -106,4 +106,4 @@ const i=16384;class n{constructor(e){this.length=e,this.missing=e,this.sources=n
|
|||||||
/*! ut_metadata. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
/*! ut_metadata. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||||
const{EventEmitter:n}=e("events"),r=e("bencode"),s=e("bitfield").default,a=e("debug")("ut_metadata"),o=e("simple-sha1"),c=16384;t.exports=e=>{class t extends n{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new s(0,{grow:1e3}),i.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,i){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7<e.metadata_size||e.metadata_size<=0?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/c),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,i;try{const n=e.toString(),s=n.indexOf("ee")+2;t=r.decode(n.substring(0,s)),i=e.slice(s)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,i,t.total_size);break;case 2:this._onReject(t.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;a("set metadata");try{const t=r.decode(e).info;t&&(e=r.encode(t))}catch(e){}return(!this._infoHash||this._infoHash===o.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",r.encode({info:r.decode(this.metadata)})),!0)}_send(e,t){let n=r.encode(e);i.isBuffer(t)&&(n=i.concat([n,t])),this._wire.extended("ut_metadata",n)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,i){const n={msg_type:1,piece:e};"number"==typeof i&&(n.total_size=i),this._send(n,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let i=t+c;i>this._metadataSize&&(i=this._metadataSize);const n=this.metadata.slice(t,i);this._data(e,n,this._metadataSize)}_onData(e,t,i){t.length>c||!this._fetching||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=i.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(!e)return;this.setMetadata(this.metadata)||this._failedMetadata()}_failedMetadata(){this._bitfield=new s(0,{grow:1e3}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this)}).call(this,e("buffer").Buffer)},{bencode:23,bitfield:27,buffer:110,debug:161,events:193,"simple-sha1":411}],485:[function(e,t,i){(function(e){(function(){function i(t){try{if(!e.localStorage)return!1}catch(e){return!1}var i=e.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=function(e,t){if(i("noDeprecation"))return e;var n=!1;return function(){if(!n){if(i("throwDeprecation"))throw new Error(t);i("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],486:[function(e,t,i){(function(i){(function(){const n=e("binary-search"),r=e("events"),s=e("mp4-stream"),a=e("mp4-box-encoding"),o=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}const l=1;t.exports=class extends r{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const i=this._file.createReadStream({start:e});i.pipe(this._decoder);const n=r=>{"moov"===r.type?(this._decoder.removeListener("box",n),this._decoder.decode((e=>{i.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}))):r.length<4096?(t+=r.length,this._decoder.ignore()):(this._decoder.removeListener("box",n),t+=r.length,i.destroy(),this._decoder.destroy(),this._findMoov(e+t))};this._decoder.on("box",n)}_processMoov(e){const t=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let i=0;i<t.length;i++){const r=t[i],s=r.mdia.minf.stbl,a=s.stsd.entries[0],o=r.mdia.hdlr.handlerType;let l,u;if("vide"===o&&"avc1"===a.type){if(this._hasVideo)contiLine truncated
|
const{EventEmitter:n}=e("events"),r=e("bencode"),s=e("bitfield").default,a=e("debug")("ut_metadata"),o=e("simple-sha1"),c=16384;t.exports=e=>{class t extends n{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new s(0,{grow:1e3}),i.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,i){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7<e.metadata_size||e.metadata_size<=0?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/c),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,i;try{const n=e.toString(),s=n.indexOf("ee")+2;t=r.decode(n.substring(0,s)),i=e.slice(s)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,i,t.total_size);break;case 2:this._onReject(t.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;a("set metadata");try{const t=r.decode(e).info;t&&(e=r.encode(t))}catch(e){}return(!this._infoHash||this._infoHash===o.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",r.encode({info:r.decode(this.metadata)})),!0)}_send(e,t){let n=r.encode(e);i.isBuffer(t)&&(n=i.concat([n,t])),this._wire.extended("ut_metadata",n)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,i){const n={msg_type:1,piece:e};"number"==typeof i&&(n.total_size=i),this._send(n,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let i=t+c;i>this._metadataSize&&(i=this._metadataSize);const n=this.metadata.slice(t,i);this._data(e,n,this._metadataSize)}_onData(e,t,i){t.length>c||!this._fetching||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=i.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(!e)return;this.setMetadata(this.metadata)||this._failedMetadata()}_failedMetadata(){this._bitfield=new s(0,{grow:1e3}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this)}).call(this,e("buffer").Buffer)},{bencode:23,bitfield:27,buffer:110,debug:161,events:193,"simple-sha1":411}],485:[function(e,t,i){(function(e){(function(){function i(t){try{if(!e.localStorage)return!1}catch(e){return!1}var i=e.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=function(e,t){if(i("noDeprecation"))return e;var n=!1;return function(){if(!n){if(i("throwDeprecation"))throw new Error(t);i("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],486:[function(e,t,i){(function(i){(function(){const n=e("binary-search"),r=e("events"),s=e("mp4-stream"),a=e("mp4-box-encoding"),o=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}const l=1;t.exports=class extends r{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const i=this._file.createReadStream({start:e});i.pipe(this._decoder);const n=r=>{"moov"===r.type?(this._decoder.removeListener("box",n),this._decoder.decode((e=>{i.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}))):r.length<4096?(t+=r.length,this._decoder.ignore()):(this._decoder.removeListener("box",n),t+=r.length,i.destroy(),this._decoder.destroy(),this._findMoov(e+t))};this._decoder.on("box",n)}_processMoov(e){const t=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let i=0;i<t.length;i++){const r=t[i],s=r.mdia.minf.stbl,a=s.stsd.entries[0],o=r.mdia.hdlr.handlerType;let l,u;if("vide"===o&&"avc1"===a.type){if(this._hasVideo)contiLine truncated
|
||||||
/*! webtorrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
/*! webtorrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||||
const n=e("events"),r=e("path"),s=e("simple-concat"),a=e("create-torrent"),o=e("debug"),c=e("bittorrent-dht/client"),l=e("load-ip-set"),u=e("run-parallel"),p=e("parse-torrent"),d=e("simple-peer"),f=e("queue-microtask"),h=e("randombytes"),m=e("simple-sha1"),b=e("speedometer"),{ThrottleGroup:v}=e("speed-limiter"),g=e("./lib/conn-pool.js"),y=e("./lib/torrent.js"),{version:_}=e("./package.json"),x=o("webtorrent"),w=_.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),k=`-WW${w}-`;class E extends n{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:i.isBuffer(t.peerId)?this.peerId=t.peerId.toString("hex"):this.peerId=i.from(k+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),"string"==typeof t.nodeId?this.nodeId=t.nodeId:i.isBuffer(t.nodeId)?this.nodeId=t.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=E.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max("number"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof t.uploadLimit?t.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===t.secure&&e("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new v({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new v({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof g?this._connPool=new g(this):f((()=>{this._onListening()})),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==t.dht&&"function"==typeof c?(this.dht=new c(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const n=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof l&&null!=t.blocklist?l(t.blocklist,{headers:{"user-agent":`WebTorrent/${_} (https://webtorrent.io)`}},((e,t)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=t,n()})):f(n)}loadWorker(e,t=(()=>{})){if(!(e instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==e.state)throw new Error("Worker isn't activated");this.serviceWorker=e,navigator.serviceWorker.addEventListener("message",(e=>{const{data:t}=e;if(!t.type||"webtorrent"===!t.type||!t.url)return null;let[i,...n]=t.url.slice(t.url.indexOf(t.scope+"webtorrent/")+11+t.scope.length).split("/");if(n=decodeURI(n.join("/")),!i||!n)return null;const[r]=e.ports,s=this.get(i)&&this.get(i).files.find((e=>e.path===n));if(!s)return null;const[a,o,c]=s._serve(t),l=o&&o[Symbol.asyncIterator](),u=()=>{r.onmessage=null,o&&o.destroy(),c&&c.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async e=>{if(e.data){let e;try{e=(await l.next()).value}catch(e){}r.postMessage(e),e||u(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.serviceWorker.scriptURL.substr(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/keepalive/`)),2e4))}else u()},this.workerPortCount++,r.postMessage(a)})),t(this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof y){if(this.torrents.includes(e))return e}else{let t;try{t=p(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},i=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,i]=[{},t]);const n=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===s.infoHash&&e!==s)return void s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`))},r=()=>{this.destroyed||(i(s),this.emit("torrent",s))};this._debug("add"),t=t?Object.assign({},t):{};const s=new y(e,this,t);return this.torrents.push(s),s.once("_infoHash",n),s.once("ready",r),s.onceLine truncated
|
const n=e("events"),r=e("path"),s=e("simple-concat"),a=e("create-torrent"),o=e("debug"),c=e("bittorrent-dht/client"),l=e("load-ip-set"),u=e("run-parallel"),p=e("parse-torrent"),d=e("simple-peer"),f=e("queue-microtask"),h=e("randombytes"),m=e("simple-sha1"),b=e("speedometer"),{ThrottleGroup:v}=e("speed-limiter"),g=e("./lib/conn-pool.js"),y=e("./lib/torrent.js"),{version:_}=e("./package.json"),x=o("webtorrent"),w=_.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),k=`-WW${w}-`;class E extends n{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:i.isBuffer(t.peerId)?this.peerId=t.peerId.toString("hex"):this.peerId=i.from(k+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),"string"==typeof t.nodeId?this.nodeId=t.nodeId:i.isBuffer(t.nodeId)?this.nodeId=t.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=E.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max("number"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof t.uploadLimit?t.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===t.secure&&e("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new v({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new v({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof g?this._connPool=new g(this):f((()=>{this._onListening()})),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==t.dht&&"function"==typeof c?(this.dht=new c(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const n=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof l&&null!=t.blocklist?l(t.blocklist,{headers:{"user-agent":`WebTorrent/${_} (https://webtorrent.io)`}},((e,t)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=t,n()})):f(n)}loadWorker(e,t=(()=>{})){if(!(e instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==e.state)throw new Error("Worker isn't activated");this.serviceWorker=e,navigator.serviceWorker.addEventListener("message",(e=>{const{data:t}=e;if(!t.type||"webtorrent"===!t.type||!t.url)return null;let[i,...n]=t.url.slice(t.url.indexOf(t.scope+"webtorrent/")+11+t.scope.length).split("/");if(n=decodeURI(n.join("/")),!i||!n)return null;const[r]=e.ports,s=this.get(i)&&this.get(i).files.find((e=>e.path===n));if(!s)return null;const[a,o,c]=s._serve(t),l=o&&o[Symbol.asyncIterator](),u=()=>{r.onmessage=null,o&&o.destroy(),c&&c.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async e=>{if(e.data){let e;try{e=(await l.next()).value}catch(e){}r.postMessage(e),e||u(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.serviceWorker.scriptURL.substr(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/keepalive/`)),2e4))}else u()},this.workerPortCount++,r.postMessage(a)})),t(this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof y){if(this.torrents.includes(e))return e}else{let t;try{t=p(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},i=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,i]=[{},t]);const n=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===s.infoHash&&e!==s)return void s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`))},r=()=>{this.destroyed||(i(s),this.emit("torrent",s))};this._debug("add"),t=t?Object.assign({},t):{};const s=new y(e,this,t);return this.torrents.push(s),s.once("_infoHash",n),s.once("ready",r),s.onceLine truncated
|
||||||
+97
-97
@@ -82,10 +82,10 @@ function start() {
|
|||||||
// magnet input
|
// magnet input
|
||||||
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
document.getElementById('magnet').addEventListener('keyup', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (event.key === "Enter") {
|
if (event.key === 'Enter') {
|
||||||
source = "magnet";
|
source = 'magnet';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Magnet URL");
|
sourceTooltip.setContent('Currently loaded information sourced from Magnet URL');
|
||||||
parse(magnet.value);
|
parse(magnet.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -94,9 +94,9 @@ function start() {
|
|||||||
document.getElementById('torrent').addEventListener('change', function(event) {
|
document.getElementById('torrent').addEventListener('change', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
event.target.files[0].arrayBuffer().then(function(arrayBuffer) {
|
||||||
source = "torrent-file";
|
source = 'torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from Torrent file');
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -109,9 +109,9 @@ function start() {
|
|||||||
document.addEventListener('drop', function(event) {
|
document.addEventListener('drop', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.dataTransfer.items[0].getAsFile().arrayBuffer().then(function(arrayBuffer) {
|
event.dataTransfer.items[0].getAsFile().arrayBuffer().then(function(arrayBuffer) {
|
||||||
source = "torrent-file";
|
source = 'torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from Torrent file');
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -119,30 +119,30 @@ function start() {
|
|||||||
// example buttons
|
// example buttons
|
||||||
example1.addEventListener('click', function(event) {
|
example1.addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
notyf.success('Parsing Ubuntu 20.04 Magnet URL');
|
||||||
source = "magnet";
|
source = 'magnet';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-magnet fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Magnet URL");
|
sourceTooltip.setContent('Currently loaded information sourced from Magnet URL');
|
||||||
parse("magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce");
|
parse('magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce');
|
||||||
});
|
});
|
||||||
|
|
||||||
example2.addEventListener('click', async function(event) {
|
example2.addEventListener('click', async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Fetching and Parsing “The WIRED CD” Torrent File...");
|
notyf.success('Fetching and Parsing “The WIRED CD” Torrent File...');
|
||||||
source = "remote-torrent-file";
|
source = 'remote-torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from remotely fetched Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from remotely fetched Torrent file');
|
||||||
parseRemote("https://webtorrent.io/torrents/wired-cd.torrent");
|
parseRemote('https://webtorrent.io/torrents/wired-cd.torrent');
|
||||||
});
|
});
|
||||||
|
|
||||||
example3.addEventListener('click', async function(event) {
|
example3.addEventListener('click', async function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
notyf.success('Parsing Jack Johnson Archive.org Torrent File');
|
||||||
let response = await fetch("/ext/jj2008-06-14.mk4_archive.torrent");
|
let response = await fetch('/ext/jj2008-06-14.mk4_archive.torrent');
|
||||||
let arrayBuffer = await response.arrayBuffer();
|
let arrayBuffer = await response.arrayBuffer();
|
||||||
source = "torrent-file";
|
source = 'torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from Torrent file');
|
||||||
parse(Buffer.from(arrayBuffer));
|
parse(Buffer.from(arrayBuffer));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -195,9 +195,9 @@ function start() {
|
|||||||
sourceTooltip.disable();
|
sourceTooltip.disable();
|
||||||
|
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
source = "shared-url";
|
source = 'shared-url';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-link fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-link fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from shared torrent.parts link");
|
sourceTooltip.setContent('Currently loaded information sourced from shared torrent.parts link');
|
||||||
parse(window.location.hash.split('#')[1]);
|
parse(window.location.hash.split('#')[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,18 +206,18 @@ function start() {
|
|||||||
function parse(toLoad) {
|
function parse(toLoad) {
|
||||||
resetProperties();
|
resetProperties();
|
||||||
try {
|
try {
|
||||||
console.info("Attempting parse");
|
console.info('Attempting parse');
|
||||||
parsed = parser(toLoad);
|
parsed = parser(toLoad);
|
||||||
display();
|
display();
|
||||||
if (parsed.xs) {
|
if (parsed.xs) {
|
||||||
console.info("Magnet includes xs, attempting remote parse");
|
console.info('Magnet includes xs, attempting remote parse');
|
||||||
parseRemote(parsed.xs);
|
parseRemote(parsed.xs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(e) { // maybe they put a URL to a torrent file in the magnet box?
|
catch(e) { // maybe they put a URL to a torrent file in the magnet box?
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
if (source == "magnet") {
|
if (source == 'magnet') {
|
||||||
console.info("Attempting remote parse");
|
console.info('Attempting remote parse');
|
||||||
parseRemote(toLoad);
|
parseRemote(toLoad);
|
||||||
} else { // probably not. Just a bad file.
|
} else { // probably not. Just a bad file.
|
||||||
notyf.error('Problem parsing input. Is this a .torrent file?');
|
notyf.error('Problem parsing input. Is this a .torrent file?');
|
||||||
@@ -234,9 +234,9 @@ function parseRemote(toLoad) {
|
|||||||
resetProperties();
|
resetProperties();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
source = "remote-torrent-file";
|
source = 'remote-torrent-file';
|
||||||
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
originalSourceIcon.innerHTML = '<span class="fad fa-file-alt fa-fw"></span>';
|
||||||
sourceTooltip.setContent("Currently loaded information sourced from remotely fetched Torrent file");
|
sourceTooltip.setContent('Currently loaded information sourced from remotely fetched Torrent file');
|
||||||
parsed = result;
|
parsed = result;
|
||||||
display();
|
display();
|
||||||
});
|
});
|
||||||
@@ -247,17 +247,17 @@ function display() {
|
|||||||
console.log(parsed);
|
console.log(parsed);
|
||||||
|
|
||||||
hash.value = parsed.infoHash;
|
hash.value = parsed.infoHash;
|
||||||
name.value = parsed.name ? parsed.name : "";
|
name.value = parsed.name ? parsed.name : '';
|
||||||
if (parsed.created) {
|
if (parsed.created) {
|
||||||
created.value = parsed.created.toISOString().slice(0, 19);
|
created.value = parsed.created.toISOString().slice(0, 19);
|
||||||
created.type = "datetime-local";
|
created.type = 'datetime-local';
|
||||||
} else {
|
} else {
|
||||||
created.type = "text";
|
created.type = 'text';
|
||||||
}
|
}
|
||||||
createdBy.value = parsed.createdBy ? "by " + parsed.createdBy : "";
|
createdBy.value = parsed.createdBy ? ' by ' + parsed.createdBy : '';
|
||||||
comment.value = parsed.comment ? parsed.comment : "";
|
comment.value = parsed.comment ? parsed.comment : '';
|
||||||
|
|
||||||
announce.innerHTML = "";
|
announce.innerHTML = '';
|
||||||
if (parsed.announce && parsed.announce.length) {
|
if (parsed.announce && parsed.announce.length) {
|
||||||
for (let i = 0; i < parsed.announce.length; i++) {
|
for (let i = 0; i < parsed.announce.length; i++) {
|
||||||
let row = document.createElement('div');
|
let row = document.createElement('div');
|
||||||
@@ -280,10 +280,10 @@ function display() {
|
|||||||
announce.appendChild(row);
|
announce.appendChild(row);
|
||||||
}
|
}
|
||||||
// } else {
|
// } else {
|
||||||
// announce.innerHTML = "<em>No trackers specified in the URL/File provided</em>";
|
// announce.innerHTML = '<em>No trackers specified in the URL/File provided</em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
urlList.innerHTML = "";
|
urlList.innerHTML = '';
|
||||||
if (parsed.urlList && parsed.urlList.length) {
|
if (parsed.urlList && parsed.urlList.length) {
|
||||||
for (let i = 0; i < parsed.urlList.length; i++) {
|
for (let i = 0; i < parsed.urlList.length; i++) {
|
||||||
let row = document.createElement('div');
|
let row = document.createElement('div');
|
||||||
@@ -306,12 +306,12 @@ function display() {
|
|||||||
urlList.appendChild(row);
|
urlList.appendChild(row);
|
||||||
}
|
}
|
||||||
// } else {
|
// } else {
|
||||||
// urlList.innerHTML = "<em>No webseed URLs in the URL/File provided</em>";
|
// urlList.innerHTML = '<em>No webseed URLs in the URL/File provided</em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
files.innerHTML = "";
|
files.innerHTML = '';
|
||||||
if (parsed.files && parsed.files.length) {
|
if (parsed.files && parsed.files.length) {
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = 'none';
|
||||||
if (parsed.files.length < 100) {
|
if (parsed.files.length < 100) {
|
||||||
for (let file of parsed.files) {
|
for (let file of parsed.files) {
|
||||||
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
let icon = getFontAwesomeIconForMimetype(mime.lookup(file.name));
|
||||||
@@ -330,10 +330,10 @@ function display() {
|
|||||||
downloadTorrent.disabled = false;
|
downloadTorrent.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
if (client.torrents.length > 0) {
|
if (client.torrents.length > 0) {
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = 'none';
|
||||||
files.innerHTML = '<input type="text" placeholder="Attempting fetching of files from Webtorrent..." aria-label="Attempting fetching of files from Webtorrent..." disabled>';
|
files.innerHTML = '<input type="text" placeholder="Attempting fetching of files from Webtorrent..." aria-label="Attempting fetching of files from Webtorrent..." disabled>';
|
||||||
} else {
|
} else {
|
||||||
getFiles.style.display = "block";
|
getFiles.style.display = 'block';
|
||||||
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
||||||
}
|
}
|
||||||
downloadTorrentTooltip.setContent('Files metadata is required to generate a Torrent file. Try fetching files list from WebTorrent.');
|
downloadTorrentTooltip.setContent('Files metadata is required to generate a Torrent file. Try fetching files list from WebTorrent.');
|
||||||
@@ -341,7 +341,7 @@ function display() {
|
|||||||
downloadTorrent.disabled = true;
|
downloadTorrent.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyURL.setAttribute('data-clipboard-text', window.location.origin + "#" + parser.toMagnetURI(parsed));
|
copyURL.setAttribute('data-clipboard-text', window.location.origin + '#' + parser.toMagnetURI(parsed));
|
||||||
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
||||||
|
|
||||||
examples.style.display = 'none';
|
examples.style.display = 'none';
|
||||||
@@ -350,9 +350,9 @@ function display() {
|
|||||||
window.location.hash = parser.toMagnetURI(parsed);
|
window.location.hash = parser.toMagnetURI(parsed);
|
||||||
|
|
||||||
if (parsed.name) {
|
if (parsed.name) {
|
||||||
document.title = "Torrent Parts | " + parsed.name;
|
document.title = 'Torrent Parts | ' + parsed.name;
|
||||||
} else {
|
} else {
|
||||||
document.title = "Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link";
|
document.title = 'Torrent Parts | Inspect and edit what\'s in your Torrent file or Magnet link';
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceTooltip.enable();
|
sourceTooltip.enable();
|
||||||
@@ -384,37 +384,37 @@ function createFileRow(icon, name, size) {
|
|||||||
function getFontAwesomeIconForMimetype(mimetype) {
|
function getFontAwesomeIconForMimetype(mimetype) {
|
||||||
if (!mimetype) return 'file';
|
if (!mimetype) return 'file';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case mimetype.includes("msword"):
|
case mimetype.includes('msword'):
|
||||||
case mimetype.includes("wordprocessingml"):
|
case mimetype.includes('wordprocessingml'):
|
||||||
case mimetype.includes("opendocument.text"):
|
case mimetype.includes('opendocument.text'):
|
||||||
case mimetype.includes("abiword"):
|
case mimetype.includes('abiword'):
|
||||||
return 'file-word';
|
return 'file-word';
|
||||||
case mimetype.includes("ms-excel"):
|
case mimetype.includes('ms-excel'):
|
||||||
case mimetype.includes("spreadsheet"):
|
case mimetype.includes('spreadsheet'):
|
||||||
return 'file-powerpoint';
|
return 'file-powerpoint';
|
||||||
case mimetype.includes("powerpoint"):
|
case mimetype.includes('powerpoint'):
|
||||||
case mimetype.includes("presentation"):
|
case mimetype.includes('presentation'):
|
||||||
return 'file-powerpoint';
|
return 'file-powerpoint';
|
||||||
case mimetype.includes("7z-"):
|
case mimetype.includes('7z-'):
|
||||||
case mimetype.includes("iso9660"):
|
case mimetype.includes('iso9660'):
|
||||||
case mimetype.includes("zip"):
|
case mimetype.includes('zip'):
|
||||||
case mimetype.includes("octet-stream"):
|
case mimetype.includes('octet-stream'):
|
||||||
return 'file-archive';
|
return 'file-archive';
|
||||||
case mimetype.includes("csv"):
|
case mimetype.includes('csv'):
|
||||||
return 'file-csv';
|
return 'file-csv';
|
||||||
case mimetype.includes("pdf"):
|
case mimetype.includes('pdf'):
|
||||||
return 'file-pdf';
|
return 'file-pdf';
|
||||||
case mimetype.includes("font"):
|
case mimetype.includes('font'):
|
||||||
return 'file-contract';
|
return 'file-contract';
|
||||||
case mimetype.includes("text"):
|
case mimetype.includes('text'):
|
||||||
case mimetype.includes("subrip"):
|
case mimetype.includes('subrip'):
|
||||||
case mimetype.includes("vtt"):
|
case mimetype.includes('vtt'):
|
||||||
return 'file-alt';
|
return 'file-alt';
|
||||||
case mimetype.includes("audio"):
|
case mimetype.includes('audio'):
|
||||||
return 'file-audio';
|
return 'file-audio';
|
||||||
case mimetype.includes("image"):
|
case mimetype.includes('image'):
|
||||||
return 'file-image';
|
return 'file-image';
|
||||||
case mimetype.includes("video"):
|
case mimetype.includes('video'):
|
||||||
return 'file-video';
|
return 'file-video';
|
||||||
default:
|
default:
|
||||||
return 'file';
|
return 'file';
|
||||||
@@ -423,33 +423,33 @@ function getFontAwesomeIconForMimetype(mimetype) {
|
|||||||
|
|
||||||
function propertyChange(e) {
|
function propertyChange(e) {
|
||||||
if (this.dataset.group) {
|
if (this.dataset.group) {
|
||||||
parsed[this.dataset.group][this.dataset.index] = this.value ? this.value : "";
|
parsed[this.dataset.group][this.dataset.index] = this.value ? this.value : '';
|
||||||
} else {
|
} else {
|
||||||
parsed[this.id] = this.value ? this.value : "";
|
parsed[this.id] = this.value ? this.value : '';
|
||||||
}
|
}
|
||||||
window.location.hash = parser.toMagnetURI(parsed);
|
window.location.hash = parser.toMagnetURI(parsed);
|
||||||
updateModified();
|
updateModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetProperties() {
|
function resetProperties() {
|
||||||
document.getElementById('magnet').value = "";
|
document.getElementById('magnet').value = '';
|
||||||
document.getElementById('torrent').value = "";
|
document.getElementById('torrent').value = '';
|
||||||
examples.style.display = 'flex';
|
examples.style.display = 'flex';
|
||||||
properties.style.display = 'none';
|
properties.style.display = 'none';
|
||||||
name.value = "";
|
name.value = '';
|
||||||
created.value = "";
|
created.value = '';
|
||||||
createdBy.value = "";
|
createdBy.value = '';
|
||||||
comment.value = "";
|
comment.value = '';
|
||||||
hash.value = "";
|
hash.value = '';
|
||||||
announce.innerHTML = "";
|
announce.innerHTML = '';
|
||||||
urlList.innerHTML = "";
|
urlList.innerHTML = '';
|
||||||
client.torrents.forEach(torrent => torrent.destroy());
|
client.torrents.forEach(torrent => torrent.destroy());
|
||||||
getFiles.style.display = "block";
|
getFiles.style.display = 'block';
|
||||||
files.innerHTML = "";
|
files.innerHTML = '';
|
||||||
window.location.hash = "";
|
window.location.hash = '';
|
||||||
copyURL.setAttribute('data-clipboard-text', "");
|
copyURL.setAttribute('data-clipboard-text', '');
|
||||||
copyMagnet.setAttribute('data-clipboard-text', "");
|
copyMagnet.setAttribute('data-clipboard-text', '');
|
||||||
document.title = "Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link";
|
document.title = 'Torrent Parts | Inspect and edit what\'s in your Torrent file or Magnet link';
|
||||||
sourceTooltip.disable();
|
sourceTooltip.disable();
|
||||||
gtag('event', 'reset');
|
gtag('event', 'reset');
|
||||||
}
|
}
|
||||||
@@ -458,11 +458,11 @@ async function addCurrentTrackers() {
|
|||||||
addTrackers.className = 'disabled';
|
addTrackers.className = 'disabled';
|
||||||
addTrackers.innerHTML = 'Adding...';
|
addTrackers.innerHTML = 'Adding...';
|
||||||
try {
|
try {
|
||||||
let response = await fetch("https://newtrackon.com/api/stable"); // get trackers with 95% uptime
|
let response = await fetch('https://newtrackon.com/api/stable'); // get trackers with 95% uptime
|
||||||
let trackers = await response.text();
|
let trackers = await response.text();
|
||||||
parsed.announce = parsed.announce.concat(trackers.split('\n\n'));
|
parsed.announce = parsed.announce.concat(trackers.split('\n\n'));
|
||||||
parsed.announce.push("http://bt1.archive.org:6969/announce");
|
parsed.announce.push('http://bt1.archive.org:6969/announce');
|
||||||
parsed.announce.push("http://bt2.archive.org:6969/announce");
|
parsed.announce.push('http://bt2.archive.org:6969/announce');
|
||||||
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
||||||
notyf.success('Added known working trackers from newTrackon');
|
notyf.success('Added known working trackers from newTrackon');
|
||||||
updateModified();
|
updateModified();
|
||||||
@@ -478,7 +478,7 @@ async function addCurrentTrackers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addRow() {
|
function addRow() {
|
||||||
parsed[this.dataset.type].unshift("");
|
parsed[this.dataset.type].unshift('');
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,23 +495,23 @@ function removeAllRows(type) {
|
|||||||
|
|
||||||
function updateModified() {
|
function updateModified() {
|
||||||
parsed.created = new Date();
|
parsed.created = new Date();
|
||||||
parsed.createdBy = "Torrent Parts <https://torrent.parts/>";
|
parsed.createdBy = 'Torrent Parts <https://torrent.parts/>';
|
||||||
if (parsed.created) {
|
if (parsed.created) {
|
||||||
created.value = parsed.created.toISOString().slice(0, 19);
|
created.value = parsed.created.toISOString().slice(0, 19);
|
||||||
created.type = "datetime-local";
|
created.type = 'datetime-local';
|
||||||
} else {
|
} else {
|
||||||
created.type = "text";
|
created.type = 'text';
|
||||||
}
|
}
|
||||||
createdBy.value = parsed.createdBy ? "by " + parsed.createdBy : "";
|
createdBy.value = parsed.createdBy ? ' by ' + parsed.createdBy : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFilesFromPeers() {
|
function getFilesFromPeers() {
|
||||||
console.info("Attempting fetching files from Webtorrent...");
|
console.info('Attempting fetching files from Webtorrent...');
|
||||||
getFiles.style.display = "none";
|
getFiles.style.display = 'none';
|
||||||
parsed.announce.push("wss://tracker.webtorrent.io");
|
parsed.announce.push('wss://tracker.webtorrent.io');
|
||||||
parsed.announce.push("wss://tracker.openwebtorrent.com");
|
parsed.announce.push('wss://tracker.openwebtorrent.com');
|
||||||
parsed.announce.push("wss://tracker.btorrent.xyz");
|
parsed.announce.push('wss://tracker.btorrent.xyz');
|
||||||
parsed.announce.push("wss://tracker.fastcast.nz");
|
parsed.announce.push('wss://tracker.fastcast.nz');
|
||||||
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
parsed.announce = parsed.announce.filter((v,i) => v && parsed.announce.indexOf(v) === i); // remove duplicates and empties
|
||||||
client.add(parser.toMagnetURI(parsed), (torrent) => {
|
client.add(parser.toMagnetURI(parsed), (torrent) => {
|
||||||
parsed.info = Object.assign({}, torrent.info); // clone object
|
parsed.info = Object.assign({}, torrent.info); // clone object
|
||||||
@@ -536,8 +536,8 @@ function saveTorrent() {
|
|||||||
let a = document.createElement('a');
|
let a = document.createElement('a');
|
||||||
a.style.display = 'none';
|
a.style.display = 'none';
|
||||||
let url = window.URL.createObjectURL(new Blob([data], { "type": "application/x-bittorrent" }));
|
let url = window.URL.createObjectURL(new Blob([data], { "type": "application/x-bittorrent" }));
|
||||||
a.setAttribute("href", url);
|
a.setAttribute('href', url);
|
||||||
a.setAttribute("download", parsed.name + '.torrent');
|
a.setAttribute('download', parsed.name + '.torrent');
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
|
|||||||
Reference in new issue
Block a user