mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 04:05:08 +03:00
✨ Added no browser opening option for authenticating command (#317)
* feat(auth): add no browser mode * chore: merge print statements
This commit is contained in:
@@ -17,7 +17,14 @@ auth_command = typer.Typer(
|
|||||||
|
|
||||||
# TODO add context and load auth data from ctx
|
# TODO add context and load auth data from ctx
|
||||||
@auth_command.command(help="Login with your Tidal account.")
|
@auth_command.command(help="Login with your Tidal account.")
|
||||||
def login():
|
def login(
|
||||||
|
NO_BROWSER: Annotated[
|
||||||
|
bool,
|
||||||
|
typer.Option(
|
||||||
|
"--no-browser", "-n", help="Do not open browser."
|
||||||
|
),
|
||||||
|
] = False,
|
||||||
|
):
|
||||||
loaded_auth_data = load_auth_data()
|
loaded_auth_data = load_auth_data()
|
||||||
|
|
||||||
if loaded_auth_data.token:
|
if loaded_auth_data.token:
|
||||||
@@ -28,8 +35,10 @@ def login():
|
|||||||
device_auth = auth_api.get_device_auth()
|
device_auth = auth_api.get_device_auth()
|
||||||
|
|
||||||
uri = f"https://{device_auth.verificationUriComplete}"
|
uri = f"https://{device_auth.verificationUriComplete}"
|
||||||
typer.launch(uri)
|
|
||||||
|
|
||||||
|
if not NO_BROWSER:
|
||||||
|
typer.launch(uri)
|
||||||
|
|
||||||
console.print(f"Go to '{uri}' and complete authentication!")
|
console.print(f"Go to '{uri}' and complete authentication!")
|
||||||
|
|
||||||
auth_end_at = time() + device_auth.expiresIn
|
auth_end_at = time() + device_auth.expiresIn
|
||||||
|
|||||||
Reference in New Issue
Block a user