mirror of
https://gitlab.com/octospacc/TelegramIndex-Fork.git
synced 2025-02-22 06:17:41 +01:00
24 lines
659 B
Python
24 lines
659 B
Python
from aiohttp import web
|
|
import aiohttp_jinja2
|
|
|
|
|
|
class HomeView:
|
|
@aiohttp_jinja2.template("home.html")
|
|
async def home(self, req):
|
|
print(self.chat_ids)
|
|
if len(self.chat_ids) == 1:
|
|
(chat,) = self.chat_ids.values()
|
|
return web.HTTPFound(f"{chat['alias_id']}")
|
|
|
|
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"],
|
|
}
|