diff options
author | Kali Kaneko <kali@leap.se> | 2016-03-04 12:02:26 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2016-04-19 09:59:25 -0400 |
commit | f4503842fdc288fb6336211099ad0a8d01165df3 (patch) | |
tree | 05bb4d2a2a2be4fb02d8048df5c426f2b0e20243 /src/leap/bitmask/core/web | |
parent | 6fd1c73db49c5e1e08cf7963017470511fef0059 (diff) |
[feature] landing of bitmask.core
Diffstat (limited to 'src/leap/bitmask/core/web')
-rw-r--r-- | src/leap/bitmask/core/web/__init__.py | 0 | ||||
-rw-r--r-- | src/leap/bitmask/core/web/index.html | 70 | ||||
-rw-r--r-- | src/leap/bitmask/core/web/root.py | 0 |
3 files changed, 70 insertions, 0 deletions
diff --git a/src/leap/bitmask/core/web/__init__.py b/src/leap/bitmask/core/web/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/leap/bitmask/core/web/__init__.py diff --git a/src/leap/bitmask/core/web/index.html b/src/leap/bitmask/core/web/index.html new file mode 100644 index 00000000..9490eca8 --- /dev/null +++ b/src/leap/bitmask/core/web/index.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<html> + <head> + <title>Bitmask WebSockets Endpoint</title> + <script type="text/javascript"> + var sock = null; + var ellog = null; + + window.onload = function() { + + ellog = document.getElementById('log'); + + var wsuri; + if (window.location.protocol === "file:") { + wsuri = "ws://127.0.0.1:8080/ws"; + } else { + wsuri = "ws://" + window.location.hostname + ":8080/bitmask"; + } + + if ("WebSocket" in window) { + sock = new WebSocket(wsuri); + } else if ("MozWebSocket" in window) { + sock = new MozWebSocket(wsuri); + } else { + log("Browser does not support WebSocket!"); + window.location = "http://autobahn.ws/unsupportedbrowser"; + } + + if (sock) { + sock.onopen = function() { + log("Connected to " + wsuri); + } + + sock.onclose = function(e) { + log("Connection closed (wasClean = " + e.wasClean + ", code = " + e.code + ", reason = '" + e.reason + "')"); + sock = null; + } + + sock.onmessage = function(e) { + log("[res] " + e.data + '\n'); + } + } + }; + + function send() { + var msg = document.getElementById('message').value; + if (sock) { + sock.send(msg); + log("[cmd] " + msg); + } else { + log("Not connected."); + } + }; + + function log(m) { + ellog.innerHTML += m + '\n'; + ellog.scrollTop = ellog.scrollHeight; + }; + </script> + </head> + <body> + <h1>Bitmask Control Panel</h1> + <noscript>You must enable JavaScript</noscript> + <form> + <p>Command: <input id="message" type="text" size="50" maxlength="50" value="status"></p> + </form> + <button onclick='send();'>Send Command</button> + <pre id="log" style="height: 20em; overflow-y: scroll; background-color: #faa;"></pre> + </body> +</html> diff --git a/src/leap/bitmask/core/web/root.py b/src/leap/bitmask/core/web/root.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/leap/bitmask/core/web/root.py |