change home page layout and add api endpoints

This commit is contained in:
odysseusmax
2020-09-07 18:29:48 +05:30
parent 41ea351adc
commit d3ddbd14c7
4 changed files with 76 additions and 30 deletions

View File

@ -30,7 +30,8 @@ async def setup_routes(app, handler):
h = handler
client = h.client
routes = [
web.get('/', h.home, name='home')
web.get('/', h.home),
web.get('/api', h.api_home),
]
index_all = index_settings['index_all']
index_private = index_settings['index_private']
@ -58,10 +59,13 @@ async def setup_routes(app, handler):
continue
p = f"/{alias_id}"
p_api = '/api' + p
r = [
web.get(p, h.index),
web.get(p_api, h.api_index),
web.get(p + r"/logo", h.logo),
web.get(p + r"/{id:\d+}/view", h.info),
web.get(p_api + r"/{id:\d+}/view", h.api_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),
@ -73,10 +77,13 @@ async def setup_routes(app, handler):
chat = await client.get_entity(chat_id)
alias_id = generate_alias_id(chat)
p = f"/{alias_id}"
p_api = '/api' + p
r = [
web.get(p, h.index),
web.get(p_api, h.api_index),
web.get(p + r"/logo", h.logo),
web.get(p + r"/{id:\d+}/view", h.info),
web.get(p_api + r"/{id:\d+}/view", h.api_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),