Fix open browser on servers
This commit is contained in:
parent
af66b9728b
commit
8f529ea0fa
2 changed files with 9 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
import configparser
|
||||
import os
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
import click
|
||||
|
||||
|
@ -19,18 +20,22 @@ def _config_has_sections(config):
|
|||
|
||||
|
||||
def _open_url(url, echo):
|
||||
opened = False
|
||||
|
||||
if _is_tty():
|
||||
if echo:
|
||||
click.echo(
|
||||
"We will now open a browser for each account set in the config file."
|
||||
"We will now try to open a browser for each account set in the config file."
|
||||
)
|
||||
click.echo(
|
||||
"You'll need to authenticate and then copy the code provided in the web "
|
||||
"page back into this terminal, upon prompt."
|
||||
)
|
||||
click.pause()
|
||||
click.launch(url)
|
||||
else:
|
||||
result = webbrowser.open(url)
|
||||
opened = result
|
||||
|
||||
if not opened:
|
||||
click.echo("Go to {}, authenticate and enter the code below.".format(url))
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "cleantoots"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
description = "Cleanup your toot history."
|
||||
license = "GPL-3.0-or-later"
|
||||
authors = ["Gabriel Augendre <gabriel@augendre.info>"]
|
||||
|
|
Loading…
Reference in a new issue