teleapi / FileStream /server /__init__.py
privateone's picture
Slight Edit
63bf853
raw
history blame
884 Bytes
import asyncio
import logging
from aiohttp import web
#-----------------------Local Imports-------------------------#
from .API import api
from .APP import app
from .Authentication import auth
from .routes_main import routes
from FileStream.bot import MULTI_CLIENTS, WORK_LOADS, ACTIVE_CLIENTS
async def root_route_handler(request):
return web.json_response({"status": "alive", "message": "Server is running","active_clients":[{"client_name": tg_connect.client.name} for client_id, tg_connect in ACTIVE_CLIENTS.items()],"public_ip":request.remote})
def web_server():
web_app = web.Application(client_max_size=50)
web_app.router.add_get('/', root_route_handler)
web_app.add_routes(routes)
web_app.add_subapp('/app', app)
web_app.add_subapp('/api', api)
web_app.add_subapp('/auth', auth)
# Return the app to be used with AppRunner
return web_app