Adds a Files section at the bottom of the server detail page that lists the kernel-overlayfs merged view at runtime/<server_id>/merged/. Reuses the overlay file-tree partial via two new template variables: - files_base_url: parent passes "/overlays/<id>" or "/servers/<id>" - download_supported: false for servers (runtime holds large game binaries; no download endpoint), true for overlays (existing behavior) New service helper safe_resolve_for_server_listing() rejects path traversal beyond the merged root and returns None when the overlayfs mount doesn't exist (server never started or just reset). New route GET /servers/<id>/files?path=<rel> returns the lazy-load file-tree fragment, gated to the server owner. No download counterpart. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
122 lines
4.9 KiB
HTML
122 lines
4.9 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Overlay {{ overlay.name }} | left4me{% endblock %}
|
|
|
|
{% block content %}
|
|
{% set can_edit = g.user.admin or (overlay.type in ['workshop', 'script'] and overlay.user_id == g.user.id) %}
|
|
<section class="panel">
|
|
<div class="page-heading">
|
|
<h1>Overlay: {{ overlay.name }}</h1>
|
|
</div>
|
|
|
|
<dl class="server-info">
|
|
<div><dt>Type</dt><dd>{{ overlay.type }}</dd></div>
|
|
<div><dt>Scope</dt><dd>{% if overlay.user_id %}private{% else %}system{% endif %}</dd></div>
|
|
</dl>
|
|
|
|
{% if overlay.type == 'script' %}
|
|
<h2 class="section-title">Script</h2>
|
|
{% if can_edit %}
|
|
<form method="post" action="/overlays/{{ overlay.id }}/script" class="stack">
|
|
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
|
|
<label>Bash script
|
|
<textarea name="script" rows="20" spellcheck="false">{{ overlay.script or "" }}</textarea>
|
|
</label>
|
|
<p class="muted">Runs sandboxed against the overlay directory mounted at <code>/overlay</code>.</p>
|
|
{% if not latest_build_is_running %}
|
|
<div class="form-actions-inline">
|
|
<button type="submit" name="action" value="save_build">Save and build</button>
|
|
<button type="submit" name="action" value="save_reset_build">Save, reset and rebuild</button>
|
|
</div>
|
|
{% endif %}
|
|
</form>
|
|
{% else %}
|
|
<pre class="script-preview">{{ overlay.script or "" }}</pre>
|
|
{% endif %}
|
|
{% include "_overlay_build_status.html" %}
|
|
{% endif %}
|
|
|
|
{% if overlay.type == 'workshop' %}
|
|
<h2 class="section-title">Workshop items</h2>
|
|
{% if can_edit and not latest_build_is_running %}
|
|
<form method="post" action="/overlays/{{ overlay.id }}/items" class="stack">
|
|
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
|
|
<fieldset class="workshop-input-mode">
|
|
<legend>Input mode</legend>
|
|
<label><input type="radio" name="input_mode" value="items" checked> Items (paste IDs or URLs; one or many)</label>
|
|
<label><input type="radio" name="input_mode" value="collection"> Collection (one ID or URL)</label>
|
|
</fieldset>
|
|
<label>Workshop input <textarea name="input" rows="3" placeholder="123456789 https://steamcommunity.com/sharedfiles/filedetails/?id=987654321"></textarea></label>
|
|
<button type="submit">Add</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
<div id="overlay-item-table">
|
|
{% include "_overlay_item_table.html" with context %}
|
|
</div>
|
|
|
|
{% include "_overlay_build_status.html" %}
|
|
{% endif %}
|
|
|
|
<h2 class="section-title">Files</h2>
|
|
{% if not file_tree_root_entries %}
|
|
<p class="muted">No files yet — build this overlay to populate it.</p>
|
|
{% else %}
|
|
{% set entries = file_tree_root_entries %}
|
|
{% set truncated = file_tree_truncated %}
|
|
{% set truncated_count = file_tree_truncated_count %}
|
|
{% set files_base_url = "/overlays/" ~ overlay.id %}
|
|
{% set download_supported = True %}
|
|
{% include "_overlay_file_tree.html" %}
|
|
{% endif %}
|
|
|
|
<h2 class="section-title">Used by</h2>
|
|
{% if using_blueprints %}
|
|
<ul class="used-by-list">
|
|
{% for blueprint in using_blueprints %}
|
|
<li><a href="/blueprints/{{ blueprint.id }}">{{ blueprint.name }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
<p class="muted">Not used by any blueprint.</p>
|
|
{% endif %}
|
|
</section>
|
|
|
|
{% if can_edit %}
|
|
<div class="page-footer-actions">
|
|
<button type="button" class="danger-outline" data-modal-open="delete-overlay-modal">Delete overlay</button>
|
|
<a href="#" class="link-button" data-modal-open="rename-overlay-modal">Rename</a>
|
|
</div>
|
|
|
|
<dialog id="rename-overlay-modal" class="modal" aria-labelledby="rename-overlay-title">
|
|
<div class="modal-header">
|
|
<h2 id="rename-overlay-title">Rename overlay</h2>
|
|
<button type="button" class="modal-close" data-modal-close aria-label="Close">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form method="post" action="/overlays/{{ overlay.id }}" class="inline-save">
|
|
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
|
|
<input name="name" value="{{ overlay.name }}" required autofocus>
|
|
<button type="submit">Save</button>
|
|
</form>
|
|
</div>
|
|
</dialog>
|
|
|
|
<dialog id="delete-overlay-modal" class="modal" aria-labelledby="delete-overlay-title">
|
|
<div class="modal-header">
|
|
<h2 id="delete-overlay-title">Delete overlay "{{ overlay.name }}"?</h2>
|
|
<button type="button" class="modal-close" data-modal-close aria-label="Close">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>This cannot be undone. Overlays in use by a blueprint cannot be deleted.</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="button-secondary" data-modal-close>Cancel</button>
|
|
<form method="post" action="/overlays/{{ overlay.id }}/delete" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
|
|
<button class="danger" type="submit">Delete</button>
|
|
</form>
|
|
</div>
|
|
</dialog>
|
|
{% endif %}
|
|
{% endblock %}
|