2020-08-10 09:27:52 +02:00
|
|
|
from aiohttp import web
|
|
|
|
|
2020-08-12 12:43:45 +02:00
|
|
|
from .config import chat_ids
|
2020-08-12 12:39:29 +02:00
|
|
|
|
2020-08-10 09:27:52 +02:00
|
|
|
|
|
|
|
def setup_routes(app, handler):
|
|
|
|
h = handler
|
2020-08-12 12:39:29 +02:00
|
|
|
routes = [
|
|
|
|
web.get('/', h.home, name='home')
|
|
|
|
]
|
|
|
|
for chat_id in chat_ids:
|
|
|
|
p = f"/{chat_id}"
|
|
|
|
r = [
|
|
|
|
web.get(p, h.index),
|
|
|
|
web.get(p + r"/{id:\d+}/view", h.info),
|
|
|
|
web.get(p + r"/{id:\d+}/download", h.download_get),
|
|
|
|
web.head(p + r"/{id:\d+}/download", h.download_head),
|
|
|
|
web.get(p + r"/{id:\d+}/thumbnail", h.thumbnail_get),
|
|
|
|
web.head(p + r"/{id:\d+}/thumbnail", h.thumbnail_head),
|
2020-08-10 09:27:52 +02:00
|
|
|
]
|
2020-08-12 12:39:29 +02:00
|
|
|
routes += r
|
|
|
|
app.add_routes(routes)
|