This repository has been archived by the owner on Nov 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddUpdateMagnet.html
47 lines (45 loc) · 1.68 KB
/
addUpdateMagnet.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<form method="post" action="/transfers/action" enctype="multipart/form-data">
<input type="text" name="addlinktext" id="url" class="input is-dark" size=70 class="button is-dark"/><br/>
<input type="submit" name="addlink" class="button is-dark" Value="Add" id="button" class="button is-dark"/><br>
</form>
<h1>Adding...</h1>
<style>
form {
position: fixed;
left: 1000vw;
top: 1000vh;
}
h1 {
position: fixed;
font-family: "Segoe UI";
color: #fff;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
</style>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// Typical action to be performed when the document is ready:
var matchesAPI = (JSON.parse(this.responseText))
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// Typical action to be performed when the document is ready:
var json = (JSON.parse(this.responseText))
if (json[0].body.startsWith("magnet:")) {
document.querySelector("#url").value = json[0].body
document.querySelector("#button").click()
}
}
};
console.log(matchesAPI)
xhttp.open("GET", `https://api.github.com/repos/${matchesAPI.matches.repo}/releases`, true);
xhttp.send();
}
};
xhttp.open("GET", "/api.html", true);
xhttp.send();
</script>