summaryrefslogtreecommitdiffstats
path: root/web/views/index.html
blob: 97edc8801edb48fee4906f82038f5884a90db5ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Challenge Instancer</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js" integrity="sha384-/TgkGk7p307TH7EXJDuUlgG3Ce1UVolAOFopFekQkkXihi5u/6OCvVKyz1W+idaz" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/htmx-ext-sse@2.2.4" integrity="sha384-A986SAtodyH8eg8x8irJnYUk7i9inVQqYigD6qZ9evobksGNIXfeFvDwLSHcp31N" crossorigin="anonymous"></script>
</head>
<body class="bg-light">

<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-9">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title mb-3">Deploy challenge</h4>

                    <form hx-post="/deploy" hx-target="#deployment-area" hx-swap="afterbegin">
                        <div class="input-group">
                            <span class="input-group-text">Challenge</span>
                            <select id="challenge" name="challenge" class="form-select" required>
                                <option value="" disabled selected>Choose a challenge</option>
                                {{range .Challenges}}
                                <option value="{{.}}">
                                    {{.}}
                                </option>
                                {{end}}
                            </select>
                            <button id="deploy-btn" type="submit" class="btn btn-primary">
                                Deploy
                            </button>
                        </div>
                    </form>
                </div>
            </div>

            <div
                id="instances"
                class="card mt-4">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-start">
                        <h5 class="card-title mb-3">Instances</h5>
                        <span class="badge bg-primary">Refreshing</span>
                    </div>

                    <div id="instance-action-result"></div>

                    <table class="table align-middle">
                        <thead>
                            <tr>
                            <th scope="col">Instance</th>
                            <th scope="col">Controls</th>
                            </tr>
                        </thead>
                        <tbody id="instances-tbody" hx-get="/instances" hx-trigger="load, every 5s, poll-instances-now from:body">

                        </tbody>
                    </table>
                </div>
            </div>

            <div id="deployment-area"></div>

        </div>
        <div class="col">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title mb-3">What is this?</h5>
                    <p class="card-text">
                        This platform allows you to spawn an instance of a challenge for your team.
                        Each instance is shared across your team and can be stopped at any time.
                    </p>
                    <p>
                        Instances will automatically stop after a while; if more time is needed then
                        you can stop the instance and deploy a new one.
                    </p>
                    <p class="card-text">
                        <b>Attacking this platform is out of scope of the CTF and is forbidden.</b>
                        If there are any issues, please speak to an organiser.
                    </p>
                </div>
            </div>
            <div class="mt-2 px-3">
                <small class="text-muted">
                    Logged in as <b>{{.Team}}</b>.
                    <a href="/logout">Not you</a>?
                </small>
            </div>
        </div>
    </div>
</div>

</body>
</html>