From 82208aa6eef7dfef445265e845f67e63b6668d5f Mon Sep 17 00:00:00 2001 From: itouakirai Date: Thu, 28 Aug 2025 06:43:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E5=BD=95=E7=99=BB=E5=87=BA?= =?UTF-8?q?=E6=97=B6=E9=98=BB=E5=A1=9E=E4=B8=BB=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cmd.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cmd.py b/src/cmd.py index e8eba8c..c944dc1 100644 --- a/src/cmd.py +++ b/src/cmd.py @@ -50,6 +50,8 @@ class InteractiveShell: download_parser.add_argument("--include-participate-songs", default=False, dest="include", action="store_true") subparser.add_parser("status") + subparser.add_parser("login") + subparser.add_parser("logout") subparser.add_parser("exit") async def show_status(self): @@ -120,13 +122,15 @@ class InteractiveShell: return async def on_2fa(self, username: str, password: str): - two_step_code = input("2FA code: ") + session = PromptSession() + two_step_code = await session.prompt_async("2FA code: ") return two_step_code async def login_flow(self): await it(WrapperManager).init(it(Config).instance.url, it(Config).instance.secure) - username = input("Username: ") - password = input("Password: ") + session = PromptSession() + username = await session.prompt_async("Username: ") + password = await session.prompt_async("Password: ", is_password=True) try: await it(WrapperManager).login(username, password, self.on_2fa) except WrapperManagerException as e: @@ -136,7 +140,8 @@ class InteractiveShell: async def logout_flow(self): await it(WrapperManager).init(it(Config).instance.url, it(Config).instance.secure) - username = input("Username: ") + session = PromptSession() + username = await session.prompt_async("Username: ") try: await it(WrapperManager).logout(username) except WrapperManagerException as e: