allow to ask for remote host profiles and save token on first connection for later use
This commit is contained in:
@@ -31,6 +31,7 @@ from browser_cli.client import (
|
||||
REGISTRY_PATH,
|
||||
active_browser_targets,
|
||||
display_browser_name,
|
||||
save_remote_token,
|
||||
)
|
||||
from browser_cli.platform import install_base_dir, is_windows
|
||||
|
||||
@@ -185,6 +186,8 @@ def main(ctx, browser, remote, token):
|
||||
ctx.obj["token"] = token
|
||||
if remote:
|
||||
os.environ["BROWSER_CLI_REMOTE"] = remote
|
||||
if token:
|
||||
save_remote_token(remote, token)
|
||||
if token:
|
||||
os.environ["BROWSER_CLI_TOKEN"] = token
|
||||
|
||||
@@ -249,6 +252,17 @@ def clients_group(ctx):
|
||||
"extensionVersion": "disconnected",
|
||||
})
|
||||
|
||||
for target in active_browser_targets():
|
||||
if target.remote is None:
|
||||
continue
|
||||
try:
|
||||
result = send_command("clients.list", profile=target.profile, remote=target.remote, token=target.token)
|
||||
for c in (result or []):
|
||||
c["profile"] = target.display_name
|
||||
all_clients.append(c)
|
||||
except (BrowserNotConnected, RuntimeError):
|
||||
continue
|
||||
|
||||
if not all_clients:
|
||||
console.print("[yellow]No browser clients found. Start a browser with the extension enabled first.[/yellow]")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user