From 2340c34d022f4ed82f9eecca08c42c800dad8677 Mon Sep 17 00:00:00 2001 From: Type-Delta <121682210+Type-Delta@users.noreply.github.com> Date: Fri, 8 Aug 2025 12:28:23 +0700 Subject: [PATCH] fix: anilist auth failed to open link on Windows Switches to using the standard web browser module for opening the authentication URL, providing clearer feedback to the user about browser launch success or failure. --- fastanime/cli/commands/anilist/commands/auth.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fastanime/cli/commands/anilist/commands/auth.py b/fastanime/cli/commands/anilist/commands/auth.py index c830ea9..9bde692 100644 --- a/fastanime/cli/commands/anilist/commands/auth.py +++ b/fastanime/cli/commands/anilist/commands/auth.py @@ -1,4 +1,5 @@ import click +import webbrowser from .....core.config.model import AppConfig @@ -41,9 +42,14 @@ def auth(config: AppConfig, status: bool, logout: bool): return api_client = create_api_client("anilist", config) - # TODO: stop the printing of opening browser session to stderr - click.launch(ANILIST_AUTH) - feedback.info("Your browser has been opened to obtain an AniList token.") + open_success = webbrowser.open(ANILIST_AUTH, new=2) + if open_success: + feedback.info("Your browser has been opened to obtain an AniList token.") + feedback.info(f"or you can visit the site manually [magenta][link={ANILIST_AUTH}]here[/link][/magenta].") + else: + feedback.warning( + f"Failed to open the browser. Please visit the site manually [magenta][link={ANILIST_AUTH}]here[/link][/magenta]." + ) feedback.info( "After authorizing, copy the token from the address bar and paste it below." )