mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-01-24 04:08:04 -08:00
Add Support for xs Parameter in Magnet Links
This commit is contained in:
25
bundle.js
25
bundle.js
@@ -11947,21 +11947,30 @@ function parse(toLoad) {
|
|||||||
console.info("Attempting parse");
|
console.info("Attempting parse");
|
||||||
parsed = parser(toLoad);
|
parsed = parser(toLoad);
|
||||||
display();
|
display();
|
||||||
|
if (parsed.xs) {
|
||||||
|
console.log("Magnet includes xs, attempting remote parse");
|
||||||
|
parseRemote(parsed.xs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
console.info("Attempting remote parse");
|
console.info("Attempting remote parse");
|
||||||
parser.remote(toLoad, function(err, result) {
|
parseRemote(toLoad);
|
||||||
if (err) { // TODO: Display error to user
|
|
||||||
console.error(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parsed = result;
|
|
||||||
display();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseRemote(toLoad) {
|
||||||
|
parser.remote(toLoad, function(err, result) {
|
||||||
|
if (err) { // TODO: Display error to user
|
||||||
|
console.error(err);
|
||||||
|
display();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parsed = result;
|
||||||
|
display();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function display() {
|
function display() {
|
||||||
|
|
||||||
document.getElementById('magnet').value = "";
|
document.getElementById('magnet').value = "";
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
<div id="copyMagnet">
|
<div id="copyMagnet">
|
||||||
<span class="fa-stack fa-2x">
|
<span class="fa-stack fa-2x">
|
||||||
<span class="fas fa-circle fa-stack-2x"></span>
|
<span class="fas fa-circle fa-stack-2x"></span>
|
||||||
<span class="fad fa-magnet fa-stack-1x fa-inverse" data-fa-transform="down-1"></span>
|
<span class="fas fa-magnet fa-stack-1x fa-inverse" data-fa-transform="down-1"></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="downloadTorrent">
|
<div id="downloadTorrent">
|
||||||
|
|||||||
25
parse.js
25
parse.js
@@ -61,21 +61,30 @@ function parse(toLoad) {
|
|||||||
console.info("Attempting parse");
|
console.info("Attempting parse");
|
||||||
parsed = parser(toLoad);
|
parsed = parser(toLoad);
|
||||||
display();
|
display();
|
||||||
|
if (parsed.xs) {
|
||||||
|
console.log("Magnet includes xs, attempting remote parse");
|
||||||
|
parseRemote(parsed.xs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
console.info("Attempting remote parse");
|
console.info("Attempting remote parse");
|
||||||
parser.remote(toLoad, function(err, result) {
|
parseRemote(toLoad);
|
||||||
if (err) { // TODO: Display error to user
|
|
||||||
console.error(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parsed = result;
|
|
||||||
display();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseRemote(toLoad) {
|
||||||
|
parser.remote(toLoad, function(err, result) {
|
||||||
|
if (err) { // TODO: Display error to user
|
||||||
|
console.error(err);
|
||||||
|
display();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parsed = result;
|
||||||
|
display();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function display() {
|
function display() {
|
||||||
|
|
||||||
document.getElementById('magnet').value = "";
|
document.getElementById('magnet').value = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user