diff options
author | maride <maride@darknebu.la> | 2018-08-21 18:49:59 +0200 |
---|---|---|
committer | maride <maride@darknebu.la> | 2018-08-21 18:49:59 +0200 |
commit | 07294af77f4b088f67efafbeee79e7ddd0eeac84 (patch) | |
tree | 161c510ef65f1051deda57679ba9d3ca404d046e /hosted | |
parent | f35350d2691007a1b52c3b1e16794ec74702cd0d (diff) |
Feature: Start and stop challenge containers
Diffstat (limited to 'hosted')
-rw-r--r-- | hosted/challenges.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/hosted/challenges.html b/hosted/challenges.html index 3c18f2d..34c1ab5 100644 --- a/hosted/challenges.html +++ b/hosted/challenges.html @@ -23,6 +23,17 @@ <p> {{{ description }}} </p> + {{#if ContainsLaunchable}} + {{#if IPAddress}} + <p class="text-primary"> + Container running IPv4: <kbd>{{IPAddress}}</kbd> + </p> + <button class="btn btn-primary" onclick="stopContainer('{{ name }}');$(this).prop('disabled', true)">Stop Container</button> + {{else}} + <button class="btn btn-primary" onclick="startContainer('{{ name }}');$(this).prop('disabled', true)">Launch Container</button> + {{/if}} + {{/if}} + <hr> {{#if foundFlag}} <p class="text-success">Flag found!</p> {{else}} @@ -99,6 +110,22 @@ }); } + function startContainer(name) { + $.post("/api/startContainer", { + "challengeName": name + }).done(function() { + loadChallengesAndRender(); + }); + } + + function stopContainer(name) { + $.post("/api/stopContainer", { + "challengeName": name + }).done(function() { + loadChallengesAndRender(); + }); + } + $(document).ready(function() { loadChallengesAndRender(); }); |