57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
<%include partials/header.ejs %>
|
|
|
|
<div class="container">
|
|
<label for="mag_text">Provide a magnetic URL below:</label>
|
|
<textarea class="form-control" id="mag_text" rows="3"></textarea>
|
|
<p><button id="dwn-seed" class="btn btn-primary">View</button></p>
|
|
|
|
<p id="dwld"></p>
|
|
|
|
<div class="pd-10">
|
|
<div id="mag-res"></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<%include partials/footer.ejs %>
|
|
|
|
<script>
|
|
|
|
$(document).on('click', '#dwn-seed', function() {
|
|
|
|
var torrentId = document.getElementById('mag_text').value;
|
|
|
|
if (torrentId.trim() == '') {
|
|
alert("Please specify a magnetic url.");
|
|
return;
|
|
}
|
|
|
|
var job = 'download-magnetic-uri';
|
|
|
|
$.ajax({
|
|
url: '/download-magnetic-uri',
|
|
type: 'post',
|
|
data: {job:job, torrentId:torrentId},
|
|
success: function(response) {
|
|
console.log(response);
|
|
if (typeof response.file != undefined) {
|
|
let file = response.file;
|
|
// var a = document.createElement('a')
|
|
// a.download = `files/${response.file}`
|
|
// //a.href = response.location
|
|
// a.href = `/files/${response.file}`
|
|
// a.textContent = 'Download ' + response.file
|
|
// document.getElementById("dwld").appendChild(a)
|
|
console.log('ok');
|
|
window.open(response.location);
|
|
}
|
|
|
|
},
|
|
error: function(e) {
|
|
console.error(e);
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
</script> |