summaryrefslogtreecommitdiffstats
path: root/templates/mods/list.html
blob: b8aff1f53dbe22d547646aa363aa355522c3f000 (plain) (blame)
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
{% extends "base.html" %}
{% block content %}
<div class="page-header">
    <h1>Mods: {{ instance_name }}</h1>
    <a href="/instances/{{ instance_id }}/edit" class="btn">&larr; Back to Instance</a>
</div>

{% if let Some(msg) = flash %}
<div class="flash flash-{{ msg.kind }}">{{ msg.text }}</div>
{% endif %}

<div class="card" style="margin-bottom:1rem">
    <form action="/instances/{{ instance_id }}/mods" method="post" enctype="multipart/form-data" class="form-row">
        <input type="file" name="mod_file" accept=".jar,.zip" required style="font-size:0.85rem">
        <button type="submit" class="btn-ok">Upload & Validate</button>
    </form>
    <p style="margin-top:0.5rem;font-size:0.8rem;color:var(--fg-muted)">
        Upload <code>.jar</code> files directly or a <code>.zip</code> containing multiple <code>.jar</code> files.
        Mods containing <strong>only</strong> client-side classes will be rejected.
    </p>
</div>

{% if mods.is_empty() %}
<div class="card card-muted">
    <p>No mods installed. Upload a mod to get started.</p>
</div>
{% else %}
<table class="table">
    <thead>
        <tr>
            <th>Name</th>
            <th>Filename</th>
            <th>Side</th>
            <th>Status</th>
            <th>Added</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
    {% for m in mods %}
        <tr>
            <td>
                {% if let Some(name) = m.display_name %}
                    {{ name }}
                {% else %}
                    <em>{{ m.filename }}</em>
                {% endif %}
            </td>
            <td><code>{{ m.filename }}</code></td>
            <td>
                <span class="tag
                    {% if m.side == "BOTH" %}tag-ok{% endif %}
                    {% if m.side == "SERVER" %}tag-ok{% endif %}
                    {% if m.side == "CLIENT" %}tag-err{% endif %}
                    {% if m.side == "UNKNOWN" %}tag{% endif %}
                ">{{ m.side }}</span>
            </td>
            <td>
                {% if !m.accepted %}
                    <span class="status-badge status-error">Rejected</span>
                {% else if m.side == "CLIENT" %}
                    <span class="status-badge status-warning">Warning</span>
                {% else %}
                    <span class="status-badge status-running">Accepted</span>
                {% endif %}
                {% if let Some(reason) = m.rejection_reason %}
                <div style="font-size:0.8rem;color:var(--err);margin-top:0.25rem">{{ reason }}</div>
                {% endif %}
            </td>
            <td>{{ m.created_at }}</td>
            <td>
                <form action="/instances/{{ instance_id }}/mods/{{ m.id }}/delete" method="post" style="display:inline"
                      onsubmit="return confirm('Remove this mod?')">
                    <button type="submit" class="btn-danger btn-sm">Remove</button>
                </form>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>
{% endif %}

<div style="margin-top:1rem">
    <form action="/instances/{{ instance_id }}/mods/rescan" method="post" style="display:inline">
        <button type="submit" class="btn">Rescan All Mods</button>
    </form>
</div>
{% endblock %}