qbittorrent-webui-cjratliff.../private/addpeers.html
2023-03-13 21:31:54 -04:00

73 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>Add Peers</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/Core.css?v=${CACHEID}" />
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
<script>
'use strict';
new Keyboard({
defaultEventType: 'keydown',
events: {
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
}).activate();
window.addEvent('domready', function() {
const hash = new URI().getData('hash');
if (!hash)
return false;
$('peers').focus();
$('addPeersOk').addEvent('click', function(e) {
new Event(e).stop();
const peers = $('peers').get('value').trim().split(/[\r\n]+/);
if (peers.length === 0)
return;
new Request({
url: 'api/v2/torrents/addPeers',
method: 'post',
data: {
hashes: hash,
peers: peers.join('|')
},
onFailure: function() {
alert("Unable to add peers. Please ensure you are adhering to the IP:port format.");
},
onSuccess: function() {
window.parent.closeWindows();
}
}).send();
});
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<p>List of peers to add (one IP per line):</p>
<textarea id="peers" rows="10" style="width: 100%;" placeholder="Format: IPv4:port / [IPv6]:port"></textarea>
<div style="margin-top: 10px; text-align: center;">
<button onclick="parent.closeWindows();">Cancel</button>
<button id="addPeersOk">Ok</button>
</div>
</div>
</body>
</html>