From 3edd41c3287073f1d49fffec8487f6c009258495 Mon Sep 17 00:00:00 2001 From: Denis Karpelevich Date: Tue, 3 Sep 2024 15:49:16 +0200 Subject: [PATCH] High level app architecture. Signed-off-by: Denis Karpelevich --- README.md | 2 +- architecture/auth.puml | 20 ++++++++++++++++++++ bot_app/src/handlers/auth_handlers.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 architecture/auth.puml diff --git a/README.md b/README.md index 7a5180f..ec4b1a3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ 4. Start website (nginx) on port 80 (HTTP) 1. In `./nginx/nginx.conf` change last line from `include conf.d/prod.conf;` to `include conf.d/test.conf;` 2. `sudo docker compose up --build` -5. Retrieve SSL certificates from let's encrypt using certbot +5. Retrieve SSL certificates from let's encrypt using certbot or update the certificate 1. `sudo docker compose -f docker-compose-certbot.yml run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d socialaiprofile.top` 6. Change nginx config to use configuration for port 443 (HTTPS) 1. In `./nginx/nginx.conf` change last line from `include conf.d/test.conf;` to `include conf.d/prod.conf;` diff --git a/architecture/auth.puml b/architecture/auth.puml new file mode 100644 index 0000000..c288095 --- /dev/null +++ b/architecture/auth.puml @@ -0,0 +1,20 @@ +@startuml +skinparam componentStyle uml2 + +actor BotUser +component AuthApi +component AuthApp +component BotApp +component GoogleAPI +database Cache + + + +BotUser -right-> BotApp: /auth +BotApp -right-> AuthApp: auth_user +AuthApp -down-> Cache: get_from_cache_by_id(f'creds.{chat_id}') +Cache -left-> BotApp: UserAlreadyLoggedIn +AuthApp -right-> GoogleAPI: Oauth2Manager().authorization_url + + +@enduml \ No newline at end of file diff --git a/bot_app/src/handlers/auth_handlers.py b/bot_app/src/handlers/auth_handlers.py index 80a6434..ee0ad2d 100644 --- a/bot_app/src/handlers/auth_handlers.py +++ b/bot_app/src/handlers/auth_handlers.py @@ -117,6 +117,6 @@ async def bot_exc_func(exc_level: str, exc_type: str, update: Update, 'valid.') await generate_youtube_login_message( context, - update.effective_chat.id, + str(update.effective_chat.id), await auth_connector.get_authorization_url(chat_id) )