Update script to allow closing explicitly

This commit is contained in:
Eric Swanson 2019-05-14 23:23:16 -07:00
parent 5f625452b0
commit 48f6acdc19
2 changed files with 18 additions and 0 deletions

View File

@ -1 +0,0 @@
images/favicon.ico

Before

Width:  |  Height:  |  Size: 18 B

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
favicon.ico Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -46,6 +46,11 @@
</script>
<style type="text/css">
#zn-close {
color:white;
padding-left: 5px;
font-size: 20px;
}
#zn-creds {
display: none;
color:white;
@ -107,6 +112,7 @@
<div>
<a target="_blank" id="zn-download-link" style="display: none; color:white; padding-left: 5px; font-size: 20px;" href="#">Access your downloaded files here</a>
</div>
<div><a id="zn-close" href="#">Close Coyote Session Immediately</a></div>
<div><a id="zn-show-creds" href="#">Show VNC Credentials</a> <a id="zn-vncurl">(open)</a></div>
<table id="zn-creds"><tbody>
<tr><td class="zn-creds-left">VNC Host: </td><td id="zn-creds-host"></td></tr>
@ -352,6 +358,18 @@
document.getElementById('zn-show-creds').addEventListener('click', function() {
document.getElementById('zn-creds').style.display = "block";
});
document.getElementById('zn-close').addEventListener('click', function() {
fetch('/acmd', {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: JSON.stringify({
'cmd': 'stop',
'tok': WebUtil.getConfigVar('tok', ''),
}),
}).then(r=>r.json()).then(d=>console.log(d)).catch(console.error);
});
rfb.connect(host, port, password, path);
};