-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.html
More file actions
59 lines (51 loc) · 2.02 KB
/
view.html
File metadata and controls
59 lines (51 loc) · 2.02 KB
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
<!DOCTYPE html>
<html>
<head>
<script>
var ajax = new XMLHttpRequest();
var ajaxResponse = "";
ajax.onreadystatechange = function () {
if (ajax.readyState === 4) {
ajaxResponse = ajax.responseText;
document.getElementById("output").innerText = ajaxResponse;
}
}
function listele () {
ajax.open("GET", "http://fr.nat.koc.pm:51342/l");
ajax.send();
}
function ops () {
var data = {};
data["client"] = document.getElementById("client").value;
var flags = document.getElementsByName("flag");
for (let i = 0; i < 2; i++) {
if (flags[i].checked) {data["flag"] = flags[i].value};
}
ajax.open("POST", "http://fr.nat.koc.pm:51342/o");
ajax.setRequestHeader("Content-type","application/json; charset=UTF-8");
ajax.send(JSON.stringify(data));
}
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
</script>
</head>
<body>
<input type="button" onclick="listele()" value=" Listele " />
<input type="button" id="indir" onclick="download('config.ovpn', ajaxResponse);" value="Dwnld .ovpn" />
<br />
<input type="text" id="client" />
<input type="radio" name="flag" id="add" value="a" />
<label for="add">Add</label>
<input type="radio" name="flag" id="revoke" value="r" />
<label for="revoke">Revoke</label>
<input type="button" onclick="ops()" value=" GO " />
<div id="output"></div>
</body>
</html>