-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support managing web seeds from WebUI
- Loading branch information
1 parent
d69730b
commit 7cd1dc1
Showing
5 changed files
with
251 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html lang="${LANG}"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>QBT_TR(Add web seeds)QBT_TR[CONTEXT=HttpServer]</title> | ||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css"> | ||
<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"; | ||
|
||
window.addEventListener("DOMContentLoaded", () => { | ||
new Keyboard({ | ||
defaultEventType: "keydown", | ||
events: { | ||
"Escape": function(event) { | ||
window.parent.qBittorrent.Client.closeWindows(); | ||
event.preventDefault(); | ||
}, | ||
"Esc": function(event) { | ||
window.parent.qBittorrent.Client.closeWindows(); | ||
event.preventDefault(); | ||
} | ||
} | ||
}).activate(); | ||
|
||
$("urls").focus(); | ||
$("addWebseedsButton").addEvent("click", (e) => { | ||
e.stopPropagation(); | ||
const hash = new URI().getData("hash"); | ||
new Request({ | ||
url: "api/v2/torrents/addWebseeds", | ||
method: "post", | ||
data: { | ||
hash: hash, | ||
urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|") | ||
}, | ||
onComplete: function() { | ||
window.parent.qBittorrent.Client.closeWindows(); | ||
} | ||
}).send(); | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div style="text-align: center;"> | ||
<br> | ||
<label for="urls">QBT_TR(List of web seeds to add (one per line):)QBT_TR[CONTEXT=HttpServer]</label> | ||
<textarea name="list" id="urls" rows="10" cols="1"></textarea> | ||
<br> | ||
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addWebseedsButton"> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!DOCTYPE html> | ||
<html lang="${LANG}"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>QBT_TR(Edit web seed)QBT_TR[CONTEXT=HttpServer]</title> | ||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css"> | ||
<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"; | ||
|
||
window.addEventListener("DOMContentLoaded", () => { | ||
new Keyboard({ | ||
defaultEventType: "keydown", | ||
events: { | ||
"Enter": function(event) { | ||
$("editWebseedButton").click(); | ||
event.preventDefault(); | ||
}, | ||
"Escape": function(event) { | ||
window.parent.qBittorrent.Client.closeWindows(); | ||
event.preventDefault(); | ||
}, | ||
"Esc": function(event) { | ||
window.parent.qBittorrent.Client.closeWindows(); | ||
event.preventDefault(); | ||
} | ||
} | ||
}).activate(); | ||
|
||
const origUrl = new URI().getData("url"); | ||
$("url").value = decodeURIComponent(origUrl); | ||
$("url").focus(); | ||
|
||
$("editWebseedButton").addEvent("click", (e) => { | ||
e.stopPropagation(); | ||
const hash = new URI().getData("hash"); | ||
new Request({ | ||
url: "api/v2/torrents/editWebseed", | ||
method: "post", | ||
data: { | ||
hash: hash, | ||
origUrl: origUrl, | ||
newUrl: encodeURIComponent($("url").value.trim()), | ||
}, | ||
onComplete: function() { | ||
window.parent.qBittorrent.Client.closeWindows(); | ||
} | ||
}).send(); | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div style="text-align: center;"> | ||
<br> | ||
<label for="url">QBT_TR(Web seed URL:)QBT_TR[CONTEXT=PropertiesWidget]</label> | ||
<div style="text-align: center; padding-top: 10px;"> | ||
<input type="text" id="url" style="width: 90%;"> | ||
</div> | ||
<br> | ||
<input type="button" value="QBT_TR(Edit)QBT_TR[CONTEXT=HttpServer]" id="editWebseedButton"> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters