wastetape/templates/file.html
2024-09-10 09:50:57 +03:00

39 lines
1.8 KiB
HTML

{% extends 'layout.html' %}
{% block content %}
<div class="container">
{% include 'nav.html' %}
<h2 class="center">{{file[2]}}</h2>
<p class="center">Expires at: {{file[5]|expirein}}</p>
<div class="filebox">
<div class="box">
{% if file[2].split('.')[-1] in ['png', 'jpg', 'jpeg', 'gif', 'webp'] %}
<img src="/static/files/{{ file[1] }}.{{ file[2].split('.')[-1] }}">
{% elif file[2].split('.')[-1] in ['mp4', 'webm', 'ogg'] %}
<video controls>
<source src="/static/files/{{ file[1] }}.{{ file[2].split('.')[-1] }}" type="video/{{ file[2].split('.')[-1] }}">
</video>
{% elif file[2].split('.')[-1] in ['mp3', 'wav', 'ogg'] %}
<audio controls>
<source src="/static/files/{{ file[1] }}.{{ file[2].split('.')[-1] }}" type="audio/{{ file[2].split('.')[-1] }}">
</audio>
{% elif file[2].split('.')[-1] in ['txt', "py", "php", "htm", "html", "css", "js", "ts", "cr", "c", "cpp", "rs", "rst"] %}
{% set filed = file[1] + '.' + file[2].split('.')[-1] %}
<p class="text" readonly>{{ filed|gettxt|replace('&', '&amp;')|replace('<', '&lt;')|replace('>', '&gt;')|replace('\n', '<br>')|safe}}</p>
{% elif file[2].split('.')[-1] in ['md'] %}
{% set filed = file[1] + '.' + file[2].split('.')[-1] %}
<p class="text-md">{{ filed|gettxt|markdown|safe}}</p>
{% else %}
<p>This file cannot be previewed</p>
{% endif %}
</div>
<a href="/static/files/{{file[1]}}.{{file[2].split('.')[-1]}}" class="download-button"><button >Raw</button></a>
<br>
</div>
</div>
{% endblock %}