mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
refactor: Simplify profile selection process in OAuthHandler
- Removed the user data directory retrieval in main.py for cleaner profile selection. - Updated profile selection logic to include an exit option in oauth_auth.py. - Enhanced user prompts in multiple languages to improve user experience during profile selection.
This commit is contained in:
parent
bce205b252
commit
74be8a0a77
@ -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",
|
||||
|
@ -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": "英语",
|
||||
|
@ -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": "英文",
|
||||
|
4
main.py
4
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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user