wastetape/templates/file.html
2024-09-17 07:04:46 +03:00

45 lines
2.1 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}} GMT</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 %}
{% block head %}
<meta property="og:title" content="{{file[2]}}">
<meta property="og:description" content="Expires at: {{file[5]|expirein}} GMT">
{% if file[2].split('.')[-1] in ['png', 'jpg', 'jpeg', 'gif', 'webp'] %}
<meta property="og:image" content="https://files.fzorb.xyz/static/files/{{ file[1] }}.{{ file[2].split('.')[-1] }}">
{% endif %}
{% endblock %}