Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@

# Commands
def get_token():
"""Returns the token in `runtimeconfig.json`, if it exists.\nIf there is no token provided in the config, it will manually ask the user for input and it will autosave it."""
"""Returns the token in `runtimeconfig.json`, if it exists.\n\nIf there is no token provided in the config, it will try accessing the alternate token location.\n\nIf no alternate token exists, it will manually ask the user for input and it will autosave it to `runtimeconfig.json`."""
if config["token"] == "":
print("[!] Looks like you didn't input a token. Would you like to import one?")
arg1 = input("[Yes/No/y/n] > ")
if arg1.lower() == "y":
arg2 = input("Enter your custom token: ")
config["token"] = str(arg2)
with open(f'{wdir}/api/runtimeconfig.json', 'w+') as f: json.dump(config, f, indent=4)
print("[✅] Setup successful!")
elif arg1.lower() == "n": return
if config["alt_token_path"] != "":
tkn = str()
with open(config["alt_token_path"], 'r', encoding="utf-8") as f:
tkn = f.read()
f.close()
return str(tkn)
else:
print("[!] Looks like you didn't input a token. Would you like to import one?")
arg1 = input("[Yes/No/y/n] > ")
if arg1.lower() == "y" or arg1.lower() == "yes":
arg2 = input("Enter your custom token: ")
config["token"] = str(arg2)
with open(f'{wdir}/api/runtimeconfig.json', 'w+') as f: json.dump(config, f, indent=4)
print("[✅] Setup successful!")
elif arg1.lower() == "n" or arg1.lower() == "no": return
return str(config["token"])

def get_secret():
Expand Down
1 change: 1 addition & 0 deletions api/runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"token": "",
"alt_token_path": "",
"secret": "",
"public_key": "",
"runtime_options": {
Expand Down