add name to wildcard route

This commit is contained in:
odysseusmax 2021-06-14 21:31:50 +05:30
parent 888984694b
commit d35646b5b1
2 changed files with 5 additions and 6 deletions

View File

@ -77,7 +77,9 @@ async def setup_routes(app, handler):
for chat_id in include_chats:
chat = await client.get_entity(chat_id)
alias_id = h.generate_alias_id(chat)
routes.extend(get_common_routes(alias_id)) # returns list() of common routes
routes.extend(
get_common_routes(alias_id)
) # returns list() of common routes
log.debug(f"Index added for {chat.id} at /{alias_id}")
routes.append(web.view(r"/{wildcard:.*}", h.wildcard))
routes.append(web.view(r"/{wildcard:.*}", h.wildcard, name="wildcard"))
app.add_routes(routes)

View File

@ -12,10 +12,7 @@ log = logging.getLogger(__name__)
def _do_basic_auth_check(request):
auth_header = request.headers.get(hdrs.AUTHORIZATION)
if not auth_header:
if (
request.match_info is not None
and "download_" in request.match_info.route.name
):
if "download_" in request.match_info.route.name:
return Response(
body=b"",
status=401,