[F] Fix colors

This commit is contained in:
Hykilpikonna
2022-08-31 14:40:20 -04:00
parent eaf13f6672
commit ae733c4b3f
+5 -5
View File
@@ -14,7 +14,7 @@ from fastapi import FastAPI
from hypy_utils import ensure_dir, write, json_stringify, printc, color from hypy_utils import ensure_dir, write, json_stringify, printc, color
from ruamel import yaml from ruamel import yaml
__version__ = "1.0.2" __version__ = "1.0.3"
config_path = ensure_dir(Path.home() / '.config' / 'mc-auth') config_path = ensure_dir(Path.home() / '.config' / 'mc-auth')
access_token_path = config_path / 'data' / 'access_token.json' access_token_path = config_path / 'data' / 'access_token.json'
@@ -43,7 +43,7 @@ def get_login_code() -> str:
@app.get('/') @app.get('/')
def callback(code: str): def callback(code: str):
print('Login code received!') printc('&a> Login code received!')
result['code'] = code result['code'] = code
return 'Login success! You can close this window now.' return 'Login success! You can close this window now.'
@@ -63,11 +63,11 @@ def get_login_code() -> str:
'scope': 'XboxLive.signin offline_access', 'scope': 'XboxLive.signin offline_access',
'state': 'NOT_NEEDED' 'state': 'NOT_NEEDED'
}) })
print(f'&6Opening {url} in the browser...') printc(f'&6Opening {url} in the browser...')
if webbrowser.open(url): if webbrowser.open(url):
print(f'&6If the link does not open, please open it manually.') printc(f'&6If the link does not open, please open it manually.')
else: else:
print(f'&cFailed to open the link automatically, please open it manually.') printc(f'&cFailed to open the link automatically, please open it manually.')
while 'code' not in result: while 'code' not in result:
time.sleep(0.01) time.sleep(0.01)