aboutsummaryrefslogtreecommitdiffstats
path: root/templates/main
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-04-04 16:09:05 +0100
committerGravatar Gareth Coles <[email protected]>2018-04-04 16:09:05 +0100
commit1d1e17f7f19203d449c8641794cd2c61705fdcd2 (patch)
tree63640306e93059a181b2af04952b0403c38ef8ee /templates/main
parentCSRF error route doesn't do shit, sadly (diff)
Early wiki work including a WS test route for RST parsing
Diffstat (limited to 'templates/main')
-rw-r--r--templates/main/ws_test_rst.html39
1 files changed, 39 insertions, 0 deletions
diff --git a/templates/main/ws_test_rst.html b/templates/main/ws_test_rst.html
new file mode 100644
index 00000000..a0bae79b
--- /dev/null
+++ b/templates/main/ws_test_rst.html
@@ -0,0 +1,39 @@
+{% extends "main/base.html" %}
+{% block title %}WS Test{% endblock %}
+{% block og_title %}WS Test{% endblock %}
+{% block og_description %}A test page for our Websockets implementation{% endblock %}
+{% block content %}
+ <div class="uk-container uk-section">
+ <h1>Enter some text to test.</h1>
+
+ <textarea title="RST Input" id="rst"></textarea>
+ <input type="button" value="Submit" id="submit-button" />
+
+ <br />
+
+ <div id="output"></div>
+
+ <script type="application/javascript">
+ let ws = new WebSocket("wss://api.{{ server_name }}/ws/rst");
+
+ ws.onopen = function(event) {
+ console.log("WS opened! Use send() to send a message.");
+ };
+
+ ws.onmessage = function (event) {
+ document.getElementById("output").innerHTML = event.data;
+ };
+
+ function send(text) {
+ console.log("-> " + text);
+ ws.send(text);
+ }
+
+ document.getElementById("submit-button").onclick = function() {
+ send(
+ document.getElementById("rst").value
+ );
+ }
+ </script>
+ </div>
+{% endblock %}