wastetape/templates/file.html

39 lines
1.8 KiB
HTML
Raw Normal View History

2024-09-09 08:14:11 +03:00
{% extends 'layout.html' %}
{% block content %}
2024-09-10 09:50:57 +03:00
<div class="container">
2024-09-09 08:14:11 +03:00
{% 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] %}
2024-09-10 09:42:33 +03:00
<p class="text" readonly>{{ filed|gettxt|replace('&', '&amp;')|replace('<', '&lt;')|replace('>', '&gt;')|replace('\n', '<br>')|safe}}</p>
2024-09-09 08:14:11 +03:00
{% 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 %}