summaryrefslogtreecommitdiffstats
path: root/templates/instances/create.html
blob: 45f70f4506c594596bd4d89dc24bff2e4b120bc7 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{% extends "base.html" %}
{% block content %}
<h1>Create Instance</h1>

{% if let Some(msg) = error %}
<div class="flash flash-err">{{ msg }}</div>
{% endif %}

<form action="/instances/new" method="post" class="form-col form-wide">
    <fieldset>
        <legend>Basic Info</legend>
        <label>
            Name
            <input type="text" name="name" required placeholder="My Server">
        </label>
        <label>
            Version
            <select name="version" required>
                {% for v in versions %}
                <option value="{{ v }}">{{ v }}</option>
                {% endfor %}
            </select>
        </label>
        <label>
            Type
            <select name="server_type" required>
                <option value="VANILLA">Vanilla</option>
                <option value="FORGE">Forge</option>
                <option value="FABRIC">Fabric</option>
            </select>
        </label>
        <label>
            Memory (MB)
            <input type="number" name="memory_mb" value="4096" min="512" max="{{ max_memory_mb }}" required>
            <small>512 MB – {{ max_memory_mb }} MB</small>
        </label>
    </fieldset>

    <fieldset>
        <legend>World</legend>
        <label>
            <input type="radio" name="world_source" value="generate" checked onchange="toggleWorldSource()">
            Generate new world
        </label>
        <div id="gen-options">
            <label>
                Seed (optional)
                <input type="text" name="seed" placeholder="Leave empty for random">
            </label>
            <label>
                Level Type
                <select name="level_type">
                    <option value="DEFAULT">Default</option>
                    <option value="FLAT">Flat</option>
                    <option value="LARGEBIOMES">Large Biomes</option>
                    <option value="AMPLIFIED">Amplified</option>
                </select>
            </label>
        </div>
        <label>
            <input type="radio" name="world_source" value="upload" onchange="toggleWorldSource()">
            Upload world (ZIP)
        </label>
        <div id="upload-options" style="display:none">
            <label>
                World ZIP
                <input type="file" name="world_zip" accept=".zip">
            </label>
        </div>
    </fieldset>

    <fieldset>
        <legend>Server Properties</legend>
        <label>
            Difficulty
            <select name="difficulty">
                <option value="0">Peaceful</option>
                <option value="1">Easy</option>
                <option value="2">Normal</option>
                <option value="3" selected>Hard</option>
            </select>
        </label>
        <label>
            Gamemode
            <select name="gamemode">
                <option value="0" selected>Survival</option>
                <option value="1">Creative</option>
                <option value="2">Adventure</option>
                <option value="3">Spectator</option>
            </select>
        </label>
        <label>
            Max Players
            <input type="number" name="max_players" value="20" min="1" max="100">
        </label>
        <label>
            <input type="checkbox" name="pvp" checked> PvP enabled
        </label>
        <label>
            MOTD
            <input type="text" name="motd" value="A Minecraft Server" maxlength="59">
        </label>
    </fieldset>

    <button type="submit" class="btn-ok">Create Instance</button>
</form>

<script>
function toggleWorldSource() {
    var genRadio = document.querySelector('input[value="generate"]');
    document.getElementById('gen-options').style.display = genRadio.checked ? '' : 'none';
    document.getElementById('upload-options').style.display = genRadio.checked ? 'none' : '';
}
</script>
{% endblock %}