<!--
SPDX-FileCopyrightText: 2025 Max Mehl <https://mehl.mx>

SPDX-License-Identifier: GPL-3.0-only
-->

{% extends "base.html" %}

{% block content %}
{% if folders %}
<h2>Folders</h2>
<ul>
  {% for name, rel in folders %}
  <li><a href="{{ url_for('browse', subpath=rel) }}">{{ name }}</a></li>
  {% endfor %}
</ul>
{% endif %}
{% if files %}
<h2>Media Files</h2>
<ul class="files">
  {% for name, rel in files %}
  <li>
    {{ name }} —
    <a href="{{ url_for('download', filepath=rel) }}" target="_blank"><button>💾 Download</button></a>
    <a href="{{ url_for('play', filepath=rel) }}"><button>🎬 Play in browser</button></a>
    <button onclick="copyToClipboard('{{ request.url_root }}dl-token/{{ username }}/{{ stream_token }}/{{ rel }}', this)">
      ▶️ Copy Stream URL
    </button>
  </li>
  {% endfor %}
</ul>
{% endif %}
{% endblock %}
