add wildcard route

This commit is contained in:
odysseusmax
2020-09-10 16:16:16 +05:30
parent 3284d83efb
commit fcf5b580c6
4 changed files with 62 additions and 51 deletions

View File

@ -58,7 +58,7 @@ async def setup_routes(app, handler):
if not alias_id:
continue
p = f"/{alias_id}"
p = r"/{chat:" + alias_id + "}"
p_api = '/api' + p
r = [
web.get(p, h.index),
@ -76,7 +76,7 @@ async def setup_routes(app, handler):
for chat_id in include_chats:
chat = await client.get_entity(chat_id)
alias_id = generate_alias_id(chat)
p = f"/{alias_id}"
p = r"/{chat:" + alias_id + "}"
p_api = '/api' + p
r = [
web.get(p, h.index),
@ -90,4 +90,5 @@ async def setup_routes(app, handler):
]
routes += r
log.debug(f"Index added for {chat.id} :: {chat.title} at /{alias_id}")
routes.append(web.view(r'/{wildcard:.*}', h.wildcard))
app.add_routes(routes)