aboutsummaryrefslogtreecommitdiff
path: root/bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot.py')
-rw-r--r--bot.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bot.py b/bot.py
index 7d10ddd..6479460 100644
--- a/bot.py
+++ b/bot.py
@@ -99,12 +99,16 @@ async def process_oauth_login_callback(update: FediLoginCallbackUpdate, context:
99 home_instance = user.home_instance 99 home_instance = user.home_instance
100 100
101 if len(user.access_key) == 0: 101 if len(user.access_key) == 0:
102 mastodon_client = Mastodon(client_id=client_id, client_secret=client_secret, api_base_url=home_instance) 102 mastodon_client = Mastodon(client_id=client_id, client_secret=client_secret,
103 api_base_url=home_instance, version_check_mode="none")
103 access_token = mastodon_client.log_in( 104 access_token = mastodon_client.log_in(
104 code=update.code, 105 code=update.code,
105 redirect_uri="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL), 106 redirect_uri="{}{}".format(BOT_DOMAIN, FEDI_LOGIN_CALLBACK_URL),
106 scopes=BOT_SCOPE 107 scopes=BOT_SCOPE
107 ) 108 )
109 instance_info = mastodon_client.instance_nodeinfo()
110 if instance_info["software"]["name"] == "pleroma":
111 user.home_instance_type = "pleroma"
108 user.access_key = encrypt(access_token, ENCRYPT_KEY) 112 user.access_key = encrypt(access_token, ENCRYPT_KEY)
109 user.save() 113 user.save()
110 114
@@ -207,7 +211,7 @@ async def main() -> None:
207 app=starlette_app, 211 app=starlette_app,
208 port=BOT_PORT, 212 port=BOT_PORT,
209 use_colors=False, 213 use_colors=False,
210 host="127.0.0.1", 214 host="100.93.242.2",
211 ) 215 )
212 ) 216 )
213 217
Powered by cgit v1.2.3 (git 2.41.0)