re touch
This commit is contained in:
parent
2c0160b21e
commit
873c5ff361
|
@ -17,7 +17,4 @@
|
||||||
|
|
||||||
<header class="flex justify-between bg-red-600 text-white mb-2 p-4 w-full sticky top-0 shadow">
|
<header class="flex justify-between bg-red-600 text-white mb-2 p-4 w-full sticky top-0 shadow">
|
||||||
<a href="/" class="text-left text-xl lg:text-2xl xl:text-3xl"> Telegram Index </a>
|
<a href="/" class="text-left text-xl lg:text-2xl xl:text-3xl"> Telegram Index </a>
|
||||||
{% if otg %}
|
|
||||||
<a title="On-The-Go Indexing" href="/otg" class="text-xl lg:text-2xl xl:text-3xl"> OTG Indexing </a>
|
|
||||||
{% endif %}
|
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -7,20 +7,17 @@
|
||||||
Download {{name}}
|
Download {{name}}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="mx-auto w-full p-2 md:flex ">
|
<div class="mx-auto w-full p-2 md:w-3/4 lg:w-2/5 p-2">
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% if media.image %}
|
{% if media.image %}
|
||||||
<img class="mx-auto rounded" src="../{{file_id}}/thumbnail" alt="{{name}}">
|
<img class="mx-auto rounded" src="{{thumbnail}}" alt="{{name}}">
|
||||||
{% elif media.video %}
|
{% elif media.video %}
|
||||||
<div id="video-warning" class="mx-auto p-4 bg-gray-600 text-gray-300 rounded border text-center hidden break-words">
|
<div id="video-warning" class="mx-auto p-4 bg-gray-600 text-gray-300 rounded border text-center hidden break-words">
|
||||||
<p> Video {{name}} could not be played!</p>
|
<p> Video {{name}} could not be played!</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="my-video-wrapper">
|
<div id="my-video-wrapper">
|
||||||
<video id="my-video-player" class="mx-auto rounded" controls poster="../{{file_id}}/thumbnail">
|
<video id="my-video-player" class="mx-auto rounded" controls poster="{{thumbnail}}">
|
||||||
<source src="../{{file_id}}/download" type="video/mp4" />
|
<source src="{{download_url}}" type="video/mp4" />
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -55,9 +52,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="my-audio-wrapper">
|
<div id="my-audio-wrapper">
|
||||||
<img class="mx-auto rounded w-full" src="../{{file_id}}/thumbnail" alt="{{name}}">
|
<img class="mx-auto rounded w-full" src="{{thumbnail}}" alt="{{name}}">
|
||||||
<audio class="mx-auto" controls muted>
|
<audio class="mx-auto" controls muted>
|
||||||
<source src="../{{file_id}}/download" type="audio/mpeg" />
|
<source src="{{download_url}}" type="audio/mpeg" />
|
||||||
</audio>
|
</audio>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
@ -97,7 +94,7 @@
|
||||||
|
|
||||||
<div class="text-center text-white">
|
<div class="text-center text-white">
|
||||||
|
|
||||||
<a class="rounded p-3 bg-indigo-500 hover:bg-indigo-700 shadow-lg" href="../{{file_id}}/download">Download Now! ({{ human_size }})</a>
|
<a class="rounded p-3 bg-indigo-500 hover:bg-indigo-700 shadow-lg{% if block_downloads %} cursor-not-allowed disabled{% endif %}" download="{{name}}" href="{{download_url}}">Download Now! ({{ human_size }})</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Download:
|
||||||
|
|
||||||
async def handle_request(self, req, head=False):
|
async def handle_request(self, req, head=False):
|
||||||
if block_downloads:
|
if block_downloads:
|
||||||
return web.Response(status=403, text="403: Forbiden")
|
return web.Response(status=403, text="403: Forbiden" if not head else None)
|
||||||
|
|
||||||
file_id = int(req.match_info["id"])
|
file_id = int(req.match_info["id"])
|
||||||
alias_id = req.match_info['chat']
|
alias_id = req.match_info['chat']
|
||||||
|
@ -36,7 +36,7 @@ class Download:
|
||||||
|
|
||||||
if not message or not message.file:
|
if not message or not message.file:
|
||||||
log.debug(f"no result for {file_id} in {chat_id}")
|
log.debug(f"no result for {file_id} in {chat_id}")
|
||||||
return web.Response(status=410, text="410: Gone. Access to the target resource is no longer available!")
|
return web.Response(status=410, text="410: Gone. Access to the target resource is no longer available!" if not head else None)
|
||||||
|
|
||||||
media = message.media
|
media = message.media
|
||||||
size = message.file.size
|
size = message.file.size
|
||||||
|
@ -51,7 +51,7 @@ class Download:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return web.Response(
|
return web.Response(
|
||||||
status=416,
|
status=416,
|
||||||
text="416: Range Not Satisfiable",
|
text="416: Range Not Satisfiable" if not head else None,
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Range": f"bytes */{size}"
|
"Content-Range": f"bytes */{size}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ from telethon.tl.custom import Message
|
||||||
from jinja2 import Markup
|
from jinja2 import Markup
|
||||||
|
|
||||||
from app.util import get_file_name, get_human_size
|
from app.util import get_file_name, get_human_size
|
||||||
|
from app.config import block_downloads
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -47,7 +48,7 @@ class InfoView:
|
||||||
'type':message.file.mime_type
|
'type':message.file.mime_type
|
||||||
}
|
}
|
||||||
if 'video/' in message.file.mime_type:
|
if 'video/' in message.file.mime_type:
|
||||||
media['video'] : True
|
media['video'] = True
|
||||||
elif 'audio/' in message.file.mime_type:
|
elif 'audio/' in message.file.mime_type:
|
||||||
media['audio'] = True
|
media['audio'] = True
|
||||||
elif 'image/' in message.file.mime_type:
|
elif 'image/' in message.file.mime_type:
|
||||||
|
@ -68,8 +69,9 @@ class InfoView:
|
||||||
'title': f"Download | {file_name} | {human_file_size}",
|
'title': f"Download | {file_name} | {human_file_size}",
|
||||||
'reply_btns': reply_btns,
|
'reply_btns': reply_btns,
|
||||||
'thumbnail': f"/{alias_id}/{file_id}/thumbnail",
|
'thumbnail': f"/{alias_id}/{file_id}/thumbnail",
|
||||||
'download_url': f"/{alias_id}/{file_id}/download",
|
'download_url': '#' if block_downloads else f"/{alias_id}/{file_id}/download",
|
||||||
'page_id': alias_id
|
'page_id': alias_id,
|
||||||
|
'block_downloads': block_downloads
|
||||||
}
|
}
|
||||||
elif message.message:
|
elif message.message:
|
||||||
text = message.raw_text
|
text = message.raw_text
|
||||||
|
|
Loading…
Reference in New Issue