mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Remove unnecessary websocket.html
This commit is contained in:
parent
7be57ecfc9
commit
a965af5491
@ -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)
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user