Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,18 +60,31 @@ auth_button_text = '''<a href="{}"><button class="w3-button w3-light-grey w3-pad
|
|
| 60 |
def client_log_in():
|
| 61 |
'''
|
| 62 |
Generates an authenticated Masterdon client for the admin user. Used for retireving the target website URL
|
| 63 |
-
:return: authenticated Masterdon client variable
|
| 64 |
'''
|
| 65 |
|
| 66 |
# Setup a 'secret' file used for persisting session between requests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
mastodon = Mastodon(
|
| 69 |
-
client_id="
|
| 70 |
api_base_url='https://infosec.exchange'
|
| 71 |
)
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
return mastodon
|
| 74 |
|
|
|
|
| 75 |
def get_auth_url(mastodon):
|
| 76 |
'''
|
| 77 |
Retrieves a URL for the user to visit to auth them with WatchTower.
|
|
|
|
| 60 |
def client_log_in():
|
| 61 |
'''
|
| 62 |
Generates an authenticated Masterdon client for the admin user. Used for retireving the target website URL
|
|
|
|
| 63 |
'''
|
| 64 |
|
| 65 |
# Setup a 'secret' file used for persisting session between requests.
|
| 66 |
+
secret_file = open("ivory-secret.txt", "w")
|
| 67 |
+
secret_file.write("{}\n".format(os.getenv('app_secret_1')))
|
| 68 |
+
secret_file.write("{}\n".format(os.getenv('app_secret_2')))
|
| 69 |
+
secret_file.write("https://infosec.exchange\n")
|
| 70 |
+
secret_file.write("WatchTower | Ivory")
|
| 71 |
+
secret_file.close()
|
| 72 |
|
| 73 |
mastodon = Mastodon(
|
| 74 |
+
client_id="ivory-secret.txt",
|
| 75 |
api_base_url='https://infosec.exchange'
|
| 76 |
)
|
| 77 |
|
| 78 |
+
mastodon.log_in(
|
| 79 |
+
os.getenv('username'),
|
| 80 |
+
os.getenv('password'),
|
| 81 |
+
scopes=["write:blocks", "write:mutes"],
|
| 82 |
+
redirect_uri="https://user1342-ivory.hf.space/",
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
return mastodon
|
| 86 |
|
| 87 |
+
|
| 88 |
def get_auth_url(mastodon):
|
| 89 |
'''
|
| 90 |
Retrieves a URL for the user to visit to auth them with WatchTower.
|