User1342 commited on
Commit
e5308f6
·
1 Parent(s): ac28582

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -33,14 +33,16 @@ auth_button_text = '''<a href="{}"><button class="w3-button w3-light-grey w3-pad
33
 
34
 
35
 
36
- def client_log_in():
37
  '''
38
  Generates an authenticated Masterdon client for the admin user. Used for retireving the target website URL
39
  '''
40
 
41
-
42
- global slider_choice
43
- server = slider_choice
 
 
44
 
45
  if server != None:
46
  id = "WatchTower Ivory | Mastodon"
@@ -348,7 +350,7 @@ def update_target_website():
348
  value=auth_button_text.format(
349
  get_target_website()))
350
 
351
- return auth_button_text.format(list_of_servers[0])
352
 
353
 
354
  # The below is a JS blob used to retrieve the URL params.
@@ -375,13 +377,13 @@ def get_chatbot_text():
375
  return [('Welcome to Watchtower.', 'Log in via Mastodon and configure your blocking options above.')]
376
 
377
 
378
- def get_target_website():
379
  '''
380
  A wrapper function used for retrieving the URL a user will use to authenticate WatchTower with Mastodon.
381
  :return: auth url
382
  '''
383
 
384
- mastodon = client_log_in()
385
  return get_auth_url(mastodon)
386
 
387
 
 
33
 
34
 
35
 
36
+ def client_log_in(provided_server = None):
37
  '''
38
  Generates an authenticated Masterdon client for the admin user. Used for retireving the target website URL
39
  '''
40
 
41
+ if provided_server == None:
42
+ global slider_choice
43
+ server = slider_choice
44
+ else:
45
+ server = provided_server
46
 
47
  if server != None:
48
  id = "WatchTower Ivory | Mastodon"
 
350
  value=auth_button_text.format(
351
  get_target_website()))
352
 
353
+ return auth_button_text.format(get_target_website(list_of_servers[0]))
354
 
355
 
356
  # The below is a JS blob used to retrieve the URL params.
 
377
  return [('Welcome to Watchtower.', 'Log in via Mastodon and configure your blocking options above.')]
378
 
379
 
380
+ def get_target_website(provided_server = None):
381
  '''
382
  A wrapper function used for retrieving the URL a user will use to authenticate WatchTower with Mastodon.
383
  :return: auth url
384
  '''
385
 
386
+ mastodon = client_log_in(provided_server)
387
  return get_auth_url(mastodon)
388
 
389