-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
76 lines (61 loc) · 1.94 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<title>Ordinal API</title>
</head>
<body>
<h4>1) Create the following tunnels via SSH:</h4>
<code style="padding: 10px; background-color: #222; color: #fff;">ssh -N -T -L 18332:localhost:18332 ubuntu@13.236.232.45 -i </path/to/identity_file></code>
<br>
<br>
<code style="padding: 10px; background-color: #222; color: #fff;">ssh -N -T -L 3000:localhost:3000 ubuntu@13.236.232.45 -i </path/to/identity_file></code>
<br>
<br>
<br>
<h4>2) Command execution:</h4>
<code>$ ord </code><input type="text" id="commands" value="help wallet" style="display: inline-block; width: 600px;">
<button onclick="execute()">Execute</button>
<p>Read the script in this file.<br>Check console what's going on..</p>
<br>
<h4>3) File upload</h4>
<form onsubmit="upload(this); return false;" enctype="multipart/form-data">
<input id="ordinaluploadinput" type="file" name="ordinalupload">
<button>Upload</button>
</form>
<script>
function execute() {
let command = document.getElementById('commands').value.trim();
if (!command) return false;
send(JSON.stringify(command.split(' ')));
}
function upload(form) {
let data = new FormData(form);
send(data, 'fileupload');
return false;
}
function send(data, url = '') {
let options = {
method: 'POST',
body: data
};
if (!url.includes('upload')) {
options.headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
}
fetch('http://localhost:3000/' + url, options)
.then(response => response.json())
.then(response => {
try {
response.rdata = JSON.parse(response.rdata);
} catch (err) {}
console.log(response.message);
if (response.rdata) {
console.log(response.rdata);
}
})
}
</script>
</body>
</html>