diff options
Diffstat (limited to 'hosted')
-rw-r--r-- | hosted/challenges.html | 73 | ||||
-rw-r--r-- | hosted/index.html | 29 | ||||
-rw-r--r-- | hosted/login.html | 42 |
3 files changed, 138 insertions, 6 deletions
diff --git a/hosted/challenges.html b/hosted/challenges.html new file mode 100644 index 0000000..067a110 --- /dev/null +++ b/hosted/challenges.html @@ -0,0 +1,73 @@ +<!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> + </head> + <script id="body-template" type="text/x-handlebars-template"> + <div class="container"> + {{#each challenges}} + <div class="card {{#if foundFlag}}border-success{{/if}}" style="margin-bottom: 20px"> + <div class="card-header"> + {{ name }} + <span class="badge badge-light"> + {{ category }} + </span> + </div> + <div class="card-body"> + <p> + {{{ description }}} + </p> + {{#if foundFlag}} + <p class="text-success">Flag found!</p> + {{else}} + <form class="input-group mb-3" method="POST" action="/api/submitFlag"> + <input type="hidden" name="challengeName" value="{{ name }}"> + <input type="text" class="form-control" placeholder="Case-sensitive flag, like: CIRCUS{this-is-an-3x4mpl3!}" aria-label="Flag" aria-describedby="button-submit" name="flag"> + <div class="input-group-append"> + <button class="btn btn-outline-primary" type="submit" id="button-submit">Submit flag</button> + </div> + </form> + {{/if}} + </div> + </div> + {{/each}} + </div> + </script> + <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="/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" id="challenge-list"> + </main> + </body> + <script type="text/javascript"> + var template = Handlebars.compile($("#body-template").html()); + $.ajax({ + url: "/api/getChallenges", + success: function(result) { + $("#challenge-list").html( + template(jQuery.parseJSON(result)) + ); + } + }); + </script> +</html> \ No newline at end of file diff --git a/hosted/index.html b/hosted/index.html index 0b2af7c..57320ac 100644 --- a/hosted/index.html +++ b/hosted/index.html @@ -2,8 +2,35 @@ <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"> </head> <body> - Welcome to your companion. + <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 active"> + <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></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="jumbotron"> + <h1 class="display-4">Hello, {{username}}.</h1> + <h3>I'm your companion.</h3> + <p>I was spawned just for you. Here, you can start, stop and reset challenges, as well as enter found flags.</p> + <p>Please note that I'm not in scope. Please don't hack me. However, if you accidentally find bugs in my code, ... report them!</p> + </div> + </main> </body> </html> \ No newline at end of file diff --git a/hosted/login.html b/hosted/login.html index 468b064..259278d 100644 --- a/hosted/login.html +++ b/hosted/login.html @@ -2,12 +2,44 @@ <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"> + <style type="text/css"> + .vertical-center { + min-height: 100%; /* Fallback for browsers do NOT support vh unit */ + min-height: 100vh; /* These two lines are counted as one :-) */ + + display: flex; + align-items: center; + } + </style> </head> <body> - <form method="POST"> - <input name="username"> - <input name="accesscode" type="password"> - <input type="submit"> - </form> + <div class="container"> + <div class="row"> + <div class="col"></div> + <div class="col"> + <div class="vertical-center"> + <div class="card card-body"> + <h1> + Companion + </h1> + + <form method="POST"> + <div class="form-group"> + <label for="nameInput">Name</label> + <input type="text" class="form-control" id="nameInput" placeholder="Name" name="username"> + </div> + <div class="form-group"> + <label for="accesscodeInput">Access Code</label> + <input type="password" class="form-control" id="accesscodeInput" placeholder="Access Code" name="accesscode"> + </div> + <button type="submit" class="btn btn-primary">Login</button> + </form> + </div> + </div> + </div> + <div class="col"></div> + </div> + </div> </body> </html> \ No newline at end of file |