feat(l4d2-web): add hostname edit form to server detail page

This commit is contained in:
mwiegand 2026-05-13 15:42:46 +02:00
parent 963851c0e1
commit 6cc1736f17
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View file

@ -12,6 +12,16 @@
<div><dt>Port</dt><dd><a href="steam://run/550//+connect%20{{ connect_host }}:{{ server.port }}">{{ server.port }}</a></dd></div>
<div><dt>Blueprint</dt><dd>{% if blueprint %}<a href="/blueprints/{{ blueprint.id }}">{{ blueprint.name }}</a>{% endif %}</dd></div>
<div><dt>RCON Password</dt><dd><span class="password-mask" data-password-field="{{ server.id }}">••••••••••••</span><span class="password-value" data-password-field="{{ server.id }}" hidden>{{ server.rcon_password }}</span> <button class="link-button" data-password-toggle="{{ server.id }}" aria-label="Show RCON password">show</button></dd></div>
<div><dt>Hostname</dt>
<dd>
<form method="post" action="/servers/{{ server.id }}" class="inline-save">
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
<input name="hostname" value="{{ server.hostname }}" placeholder="{{ g.user.username }} {{ server.name }}" maxlength="128">
<button type="submit">Save</button>
<span class="field-hint">Leave empty for auto: "{{ g.user.username }} {{ server.name }}"</span>
</form>
</dd>
</div>
</dl>
<h2 class="section-title">Actions</h2>

View file

@ -431,8 +431,7 @@ def test_initialize_server_resolves_fallback_hostname(
initialize_server(server_id)
assert len(spec_contents) == 1
assert "hostname" in spec_contents[0]
# The fixture creates user "alice" and server named "alpha"
assert '"alice alpha"' in spec_contents[0]
assert 'hostname "alice alpha"' in spec_contents[0]