diff options
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(); }); |