Remove unnecessary websocket.html

This commit is contained in:
luukas 2021-02-27 14:17:37 +02:00
parent 7be57ecfc9
commit a965af5491
2 changed files with 0 additions and 66 deletions

View File

@ -65,9 +65,6 @@ class PanelHandler(BaseHandler):
elif page == 'files_menu':
template = "panel/files_menu.html"
elif page == 'websocket':
template = "panel/websocket.html"
elif page == "remove_server":
server_id = self.get_argument('id', None)
server_data = controller.get_server_data(server_id)

View File

@ -1,63 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Default</title>
</head>
<body class="dark-theme">
<script>
{% if request.protocol == 'https'%}
let usingWebSockets = true;
try {
function WebSocketManager (url) {
this.ws = new WebSocket(url);
this.ws.eventListeners = [];
this.ws.onopen = function() {
console.log('opened WebSocket connection:', this.ws)
};
this.ws.onmessage = function (event) {
var message = JSON.parse(event.data);
console.log('got message: ', message)
console.log(this)
this.eventListeners
.filter(event => event.type == message.type)
.forEach(event => event.callback(message.data))
}
this.on = function (type, callback) {
this.ws.eventListeners.push({ type: type, callback: callback })
}
this.emit = function (type, data) {
var message = {
type: type,
data: data
}
this.ws.send(JSON.stringify(message));
}
}
webSocket = new WebSocketManager('wss://' + location.host + '/ws');
} catch (error) {
console.error('Error while making websocket helpers', error);
usingWebSockets = false;
}
{% else %}
let usingWebSockets = false;
console.warn('WebSockets are not supported in Crafty if not using the https protocol')
{% end%}
</script>
</body>
</html>