You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.6 KiB
106 lines
2.6 KiB
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
/* justify-content: center; */
|
|
}
|
|
|
|
#display {
|
|
height: 100vh;
|
|
width: 100vw;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- Guacamole -->
|
|
<script type="text/javascript" src="/js/rdp.all.min.js"></script>
|
|
|
|
<!-- Display -->
|
|
<div id="display"></div>
|
|
|
|
<!-- Init -->
|
|
<script type="text/javascript"> /* <![CDATA[ */
|
|
|
|
var pattern = /(\w+)=([^\#&]*)/ig;
|
|
var parames = {};
|
|
location.href.replace(pattern, function (attr, key, value) {
|
|
parames[key] = decodeURI(value);
|
|
});
|
|
|
|
// Get display div from document
|
|
var display = document.getElementById("display");
|
|
let urls = "wss://webssh.educoder.net/tunnel";
|
|
if (window.top.location.href.indexOf("test.") > -1 || window.top.location.href.indexOf("localhost") > -1) {
|
|
urls = "wss://pre-webssh.educoder.net/tunnel";
|
|
}
|
|
|
|
// Instantiate client, using an HTTP tunnel for communications.
|
|
var guac = new Guacamole.Client(
|
|
//new Guacamole.HTTPTunnel("tunnel")
|
|
//new Guacamole.HTTPTunnel("http://192.168.2.90:8081/tunnel")
|
|
|
|
new Guacamole.WebSocketTunnel(urls)
|
|
);
|
|
|
|
// Add client to display div
|
|
display.appendChild(guac.getDisplay().getElement());
|
|
|
|
// Error handler
|
|
guac.onerror = function (error) {
|
|
console.log(JSON.stringify(error))
|
|
};
|
|
|
|
|
|
// Connect
|
|
guac.connect("tpiID=" + parames.tpiId + "&width=1920&height=1080");
|
|
|
|
// Disconnect on close
|
|
window.onunload = function () {
|
|
guac.disconnect();
|
|
}
|
|
|
|
// console.log("guac:",guac)
|
|
// setTimeout(() => {
|
|
// console.log("guac:",guac)
|
|
//
|
|
// },4000)
|
|
|
|
// Mouse
|
|
var mouse = new Guacamole.Mouse(guac.getDisplay().getElement());
|
|
|
|
mouse.onmousedown =
|
|
mouse.onmouseup =
|
|
mouse.onmousemove = function (mouseState) {
|
|
guac.sendMouseState(mouseState);
|
|
};
|
|
|
|
// Keyboard
|
|
var keyboard = new Guacamole.Keyboard(document);
|
|
|
|
keyboard.onkeydown = function (keysym) {
|
|
guac.sendKeyEvent(1, keysym);
|
|
};
|
|
|
|
keyboard.onkeyup = function (keysym) {
|
|
guac.sendKeyEvent(0, keysym);
|
|
};
|
|
|
|
|
|
/* ]]> */</script>
|
|
|
|
</body>
|
|
|
|
</html> |