2022-10-18 22:39:32 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="${LANG}">
|
|
|
|
|
|
|
|
<head>
|
2024-10-03 08:37:11 -04:00
|
|
|
<meta charset="UTF-8">
|
2022-11-30 13:49:48 -05:00
|
|
|
<title>Add Peers</title>
|
2024-10-03 08:37:11 -04:00
|
|
|
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
|
2022-10-18 22:39:32 -04:00
|
|
|
<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>
|
2024-10-03 08:37:11 -04:00
|
|
|
"use strict";
|
2022-10-18 22:39:32 -04:00
|
|
|
|
|
|
|
new Keyboard({
|
2024-10-03 08:37:11 -04:00
|
|
|
defaultEventType: "keydown",
|
2022-10-18 22:39:32 -04:00
|
|
|
events: {
|
2024-10-03 08:37:11 -04:00
|
|
|
"Escape": function(event) {
|
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
2022-10-18 22:39:32 -04:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
2024-10-03 08:37:11 -04:00
|
|
|
"Esc": function(event) {
|
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
2022-10-18 22:39:32 -04:00
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).activate();
|
|
|
|
|
2024-10-03 08:37:11 -04:00
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
|
|
const hash = new URI().getData("hash");
|
2022-10-18 22:39:32 -04:00
|
|
|
if (!hash)
|
2024-10-03 08:37:11 -04:00
|
|
|
return;
|
2022-10-18 22:39:32 -04:00
|
|
|
|
2024-10-03 08:37:11 -04:00
|
|
|
$("peers").focus();
|
2022-10-18 22:39:32 -04:00
|
|
|
|
2024-10-03 08:37:11 -04:00
|
|
|
$("addPeersOk").addEventListener("click", (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
2022-10-18 22:39:32 -04:00
|
|
|
|
2024-10-03 08:37:11 -04:00
|
|
|
const peers = $("peers").value.trim().split(/[\r\n]+/);
|
2022-10-18 22:39:32 -04:00
|
|
|
if (peers.length === 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new Request({
|
2024-10-03 08:37:11 -04:00
|
|
|
url: "api/v2/torrents/addPeers",
|
|
|
|
method: "post",
|
2022-10-18 22:39:32 -04:00
|
|
|
data: {
|
|
|
|
hashes: hash,
|
2024-10-03 08:37:11 -04:00
|
|
|
peers: peers.join("|")
|
2022-10-18 22:39:32 -04:00
|
|
|
},
|
|
|
|
onFailure: function() {
|
2022-11-30 13:49:48 -05:00
|
|
|
alert("Unable to add peers. Please ensure you are adhering to the IP:port format.");
|
2022-10-18 22:39:32 -04:00
|
|
|
},
|
|
|
|
onSuccess: function() {
|
2024-10-03 08:37:11 -04:00
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
2022-10-18 22:39:32 -04:00
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div style="padding: 10px 10px 0px 10px;">
|
2024-10-03 08:37:11 -04:00
|
|
|
<label for="peers">List of peers to add (one IP per line):</label>
|
2022-11-30 13:49:48 -05:00
|
|
|
<textarea id="peers" rows="10" style="width: 100%;" placeholder="Format: IPv4:port / [IPv6]:port"></textarea>
|
2022-10-18 22:39:32 -04:00
|
|
|
<div style="margin-top: 10px; text-align: center;">
|
2024-10-03 08:37:11 -04:00
|
|
|
<button type="button" onclick="parent.qBittorrent.Client.closeWindows();">Cancel</button>
|
|
|
|
<button type="button" id="addPeersOk">Ok</button>
|
2022-10-18 22:39:32 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|