Browse Source

Backend is registering app on new instances

tags/1.3.3
Leonie 5 months ago
parent
commit
ddf1c3cc67
2 changed files with 9 additions and 3 deletions
  1. +2
    -2
      .gitignore
  2. +7
    -1
      backend.py

+ 2
- 2
.gitignore View File

@@ -1,6 +1,6 @@
# Secrets

clientcred.secret
*.secret
authtokens/*.secret

# Mac
@@ -18,4 +18,4 @@ npm-debug.log
resources/signing
jsconfig.json
.vscode/
typings/
typings/

+ 7
- 1
backend.py View File

@@ -39,8 +39,14 @@ def login():
username = request.forms.get("username") # pylint: disable=no-member
password = request.forms.get("password") # pylint: disable=no-member
instance = request.forms.get("instance") # pylint: disable=no-member
if not os.path.exists('clientcred.'+instance+'.secret'):
Mastodon.create_app(
'Nordcast',
api_base_url = 'https://'+instance,
to_file = 'clientcred.'+instance+'.secret'
)
mastodon = Mastodon(
client_id = 'clientcred.secret',
client_id = 'clientcred.'+instance+'.secret',
api_base_url = 'https://'+instance
)
mastodon.log_in(

Loading…
Cancel
Save