Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit 17fcbbe

Browse files
authored
Update server.py
1 parent ce54033 commit 17fcbbe

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

FileToLink/server.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def __anext__(self) -> bytes:
2727
if current >= self.end:
2828
raise StopAsyncIteration()
2929
read_size = min(self.buffer_size, self.end - current)
30-
if (not self.worker.done and current >= self.current_part * Config.Part_size) or current < self.last_read_byte:
30+
if current >= self.current_part * Config.Part_size:
3131
self.current_part = await self.check_dl(current) + 1
3232
self.last_read_byte = current
3333
chunk = await self.file.read(read_size)
@@ -59,7 +59,7 @@ async def check_dl(self, current_byte):
5959

6060
@app.route('/')
6161
async def root():
62-
return redirect(f"https://t.me/{Config.Bot_UserName}")
62+
return redirect(f"https://t.me/shadow_bots")
6363

6464

6565
@app.route('/dl/<int:archive_id>/<name>')
@@ -80,10 +80,7 @@ async def download(archive_id: int, name: str):
8080
response = await send_file(worker.path, mimetype=worker.mime_type,
8181
as_attachment=not bool(request.args.get('st')),
8282
attachment_filename=worker.name)
83-
try:
84-
if request.range is not None and len(request.range.ranges) > 0:
85-
await response.make_conditional(request.range, Config.Part_size if not worker.done else None)
86-
except AssertionError:
87-
pass # Bad Range Provided
88-
response.timeout = None
83+
if request.range is not None and len(request.range.ranges) > 0:
84+
await response.make_conditional(request.range, Config.Part_size)
85+
8986
return response

0 commit comments

Comments
 (0)