about summary refs log tree commit diff
path: root/hosted
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2018-09-04 11:09:04 +0200
committermaride <maride@darknebu.la>2018-09-04 11:09:04 +0200
commite7be7b3a847beddccc324067de6b0bfa24b3ef12 (patch)
treebfc40755646b473a4b3081dd5c6c46ac221a8a78 /hosted
parent82c922d557f6628043ab771cdf10e4da9546347d (diff)
parenta46cb83df474e5f9c9be35a0f4543f85bf9f03ee (diff)
Merge branch 'access'
Diffstat (limited to 'hosted')
-rw-r--r--hosted/access.html77
-rw-r--r--hosted/challenges.html3
-rw-r--r--hosted/index.html3
3 files changed, 83 insertions, 0 deletions
diff --git a/hosted/access.html b/hosted/access.html
new file mode 100644
index 0000000..5a25fd0
--- /dev/null
+++ b/hosted/access.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
+        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.11/handlebars.min.js"></script>
+        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
+        <style type="text/css">
+            body {
+                overflow-y: scroll;
+            }
+        </style>
+    </head>
+    <body>
+        <nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4">
+            <a class="navbar-brand" href="/">Companion</a>
+            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
+                <span class="navbar-toggler-icon"></span>
+            </button>
+            <div class="collapse navbar-collapse" id="navbarCollapse">
+                <ul class="navbar-nav mr-auto">
+                    <li class="nav-item">
+                        <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
+                    </li>
+                    <li class="nav-item active">
+                        <a class="nav-link" href="/access">Access</a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link" href="/challenges">Challenges</a>
+                    </li>
+                </ul>
+                <form class="form-inline mt-2 mt-md-0" action="/logout" method="post">
+                    <button class="btn btn-outline-danger my-2 my-sm-0" type="submit">Logout</button>
+                </form>
+            </div>
+        </nav>
+        <main class="container" role="main">
+            <div class="card">
+                <div class="card-header">
+                    Access
+                </div>
+                <div class="card-body">
+                    Access to the challenge containers is provided via OpenVPN.
+                    <hr>
+                    <button class="btn btn-secondary" onclick="loadConfig()">Reload</button>
+                    <button class="btn btn-primary" onclick="downloadConfig()">Download</button>
+                    <hr>
+                    <pre><code id="config">Loading...</code></pre>
+                </div>
+            </div>
+            <br>
+        </main>
+        <script>
+            function loadConfig() {
+                $("#config").html("Loading...");
+                $.get("/api/getAccess").done(function(data) {
+                    var result = jQuery.parseJSON(data);
+                    $("#config").text(result["credentials"]);
+                });
+            }
+
+            function downloadConfig() {
+                $.get("/api/getAccess").done(function(data) {
+                    var result = jQuery.parseJSON(data);
+                    var configBlob = new Blob([result["credentials"]], {'type':'application/x-openvpn-config'});
+                    window.location = URL.createObjectURL(configBlob);
+                });
+            }
+
+            $(document).ready(
+                function(){
+                    loadConfig()
+                }
+            );
+        </script>
+    </body>
+</html>
\ No newline at end of file
diff --git a/hosted/challenges.html b/hosted/challenges.html
index e42d7f0..165b9a9 100644
--- a/hosted/challenges.html
+++ b/hosted/challenges.html
@@ -79,6 +79,9 @@
                     <li class="nav-item">
                         <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
                     </li>
+                    <li class="nav-item">
+                        <a class="nav-link" href="/access">Access</a>
+                    </li>
                     <li class="nav-item active">
                         <a class="nav-link" href="/challenges">Challenges</a>
                     </li>
diff --git a/hosted/index.html b/hosted/index.html
index 0f40399..70244cc 100644
--- a/hosted/index.html
+++ b/hosted/index.html
@@ -16,6 +16,9 @@
                         <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
                     </li>
                     <li class="nav-item">
+                        <a class="nav-link" href="/access">Access</a>
+                    </li>
+                    <li class="nav-item">
                         <a class="nav-link" href="/challenges">Challenges</a>
                     </li>
                 </ul>