diff --git a/locales/en.json b/locales/en.json index 652164a..fe13c2c 100644 --- a/locales/en.json +++ b/locales/en.json @@ -28,7 +28,8 @@ "config": "Show Config", "delete_google_account": "Delete Cursor Google Account", "continue_prompt": "Continue? (y/N): ", - "operation_cancelled_by_user": "Operation cancelled by user" + "operation_cancelled_by_user": "Operation cancelled by user", + "exiting": "Exiting ……" }, "languages": { "en": "English", diff --git a/locales/zh_cn.json b/locales/zh_cn.json index 5de30c1..ae51086 100644 --- a/locales/zh_cn.json +++ b/locales/zh_cn.json @@ -28,7 +28,8 @@ "config": "显示配置", "delete_google_account": "删除 Cursor Google 账号", "continue_prompt": "继续?(y/N): ", - "operation_cancelled_by_user": "操作被用户取消" + "operation_cancelled_by_user": "操作被用户取消", + "exiting": "退出中 ……" }, "languages": { "en": "英语", diff --git a/locales/zh_tw.json b/locales/zh_tw.json index e60d3ea..0c3207c 100644 --- a/locales/zh_tw.json +++ b/locales/zh_tw.json @@ -28,7 +28,8 @@ "config": "顯示配置", "delete_google_account": "刪除 Cursor Google 帳號", "continue_prompt": "繼續?(y/N): ", - "operation_cancelled_by_user": "操作被使用者取消" + "operation_cancelled_by_user": "操作被使用者取消", + "exiting": "退出中 ……" }, "languages": { "en": "英文", diff --git a/main.py b/main.py index 89d7c07..28ca30e 100644 --- a/main.py +++ b/main.py @@ -618,9 +618,7 @@ def main(): elif choice == "13": from oauth_auth import OAuthHandler oauth = OAuthHandler(translator) - user_data_dir = oauth._get_user_data_directory() - if user_data_dir: - oauth._select_profile(user_data_dir) + oauth._select_profile() print_menu() elif choice == "14": import delete_cursor_google diff --git a/oauth_auth.py b/oauth_auth.py index a0f3eeb..da97634 100644 --- a/oauth_auth.py +++ b/oauth_auth.py @@ -74,14 +74,18 @@ class OAuthHandler: # Display available profiles print(f"\n{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('chrome_profile.select_profile') if self.translator else 'Select a Chrome profile to use:'}{Style.RESET_ALL}") print(f"{Fore.CYAN}{self.translator.get('chrome_profile.profile_list') if self.translator else 'Available profiles:'}{Style.RESET_ALL}") + print(f"{Fore.CYAN}0. {self.translator.get('menu.exit') if self.translator else 'Exit'}{Style.RESET_ALL}") for i, (dir_name, display_name) in enumerate(profiles, 1): print(f"{Fore.CYAN}{i}. {display_name} ({dir_name}){Style.RESET_ALL}") # Get user selection while True: try: - choice = int(input(f"\n{Fore.CYAN}{self.translator.get('menu.input_choice', choices=f'1-{len(profiles)}') if self.translator else f'Please enter your choice (1-{len(profiles)}): '}{Style.RESET_ALL}")) - if 1 <= choice <= len(profiles): + choice = int(input(f"\n{Fore.CYAN}{self.translator.get('menu.input_choice', choices=f'0-{len(profiles)}') if self.translator else f'Please enter your choice (0-{len(profiles)}): '}{Style.RESET_ALL}")) + if choice == 0: # Add quit + print(f"{Fore.YELLOW}{EMOJI['INFO']} {self.translator.get('menu.exiting') if self.translator else 'Exiting profile selection...'}{Style.RESET_ALL}") + return False + elif 1 <= choice <= len(profiles): self.selected_profile = profiles[choice - 1][0] print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('chrome_profile.profile_selected', profile=self.selected_profile) if self.translator else f'Selected profile: {self.selected_profile}'}{Style.RESET_ALL}") return True