22 lines
596 B
Python
Raw Normal View History

2020-12-12 19:46:44 +05:30
from aiohttp import web
import aiohttp_jinja2
class HomeView:
2021-05-22 19:30:08 +05:30
@aiohttp_jinja2.template("home.html")
2020-12-12 19:46:44 +05:30
async def home(self, req):
if len(self.chat_ids) == 1:
raise web.HTTPFound(f"{self.chat_ids[0]['alias_id']}")
2021-05-22 19:30:08 +05:30
return {
"chats": [
{
"page_id": chat["alias_id"],
"name": chat["title"],
"url": f"/{chat['alias_id']}",
}
for _, chat in self.chat_ids.items()
],
"authenticated": req.app["is_authenticated"],
}