Refactor: Remove GitHub trial reset feature and add development version check. Update translations for lifetime access and development version messages.

This commit is contained in:
yeongpin 2025-03-16 10:54:43 +08:00
parent 6f2ec1b373
commit ad98bed98d
6 changed files with 47 additions and 68 deletions

View File

@ -1,62 +1,9 @@
# Change Log
## v1.7.09
## Changes
- Added new GitHub-based trial reset functionality 新增基於 GitHub 的試用重置功能
- Improved code organization by separating GitHub reset logic into its own module 改進代碼組織,將 GitHub 重置邏輯獨立為模組
- Enhanced authentication data extraction and handling 增強身份驗證數據提取與處理
- Added secure credential storage using keyring 使用 keyring 進行安全憑據存儲
- Improved error handling and user feedback 改進錯誤處理與用戶回饋
- Added automatic re-login after trial reset 新增試用重置後的自動重新登入功能
- Integrated JavaScript trial reset code for automatic account deletion 整合 JavaScript 試用重置代碼以自動刪除帳戶
## New Features
- GitHub authentication integration GitHub 身份驗證集成
- Secure credential management 安全憑據管理
- Automated trial reset process 自動化試用重置流程
- Session persistence 會話持久化
- Improved user experience with clear status messages 提升用戶體驗,提供清晰的狀態消息
- Automatic account deletion when usage limit is reached 使用超過限制時自動刪除帳戶
## Technical Details
- Uses DrissionPage for browser automation 使用 DrissionPage 進行瀏覽器自動化
- Implements secure credential storage with keyring 使用 keyring 實現安全憑據存儲
- Handles both cookie and localStorage token formats 支援處理 cookie 和 localStorage 令牌格式
- Supports automatic re-login after reset 支援重置後的自動重新登入
- Maintains session persistence across resets 保持重置後的會話持久性
- JavaScript trial reset code:
```
function deleteAccount() {
return new Promise((resolve, reject) => {
fetch('https://www.cursor.com/api/dashboard/delete-account', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
})
.then(response => {
if (response.status === 200) {
resolve('Account deleted successfully');
} else {
reject('Failed to delete account: ' + response.status);
}
})
.catch(error => {
reject('Error: ' + error);
});
});
}
```
## Testing
- Tested on Windows 10, macOS, and Linux 測試在 Windows 10、macOS 和 Linux 上
- Verified with multiple GitHub accounts 已使用多個 GitHub 帳戶驗證
- Confirmed successful trial reset and re-login 確認試用重置及重新登入成功
- Validated credential storage and retrieval 驗證憑據存儲與提取
- Tested automatic account deletion when usage limit is reached 測試使用達到限制時的自動帳戶刪除功能
- Verified successful re-authentication after account deletion 驗證帳戶刪除後的成功重新身份驗證
1. Add: Development Version Check | 增加開發版本檢查
2. Remove: Github Trial Reset | 移除 Github 試用重置
3. Fixed: Some Issues | 修復一些問題
## v1.7.08
1. Add: Google OAuth Authentication | 增加 Google OAuth 認證

View File

@ -14,7 +14,8 @@
"program_terminated": "Program was terminated by user",
"error_occurred": "An error occurred: {error}. Please try again",
"press_enter": "Press Enter to Exit",
"disable_auto_update": "Disable Cursor Auto-Update"
"disable_auto_update": "Disable Cursor Auto-Update",
"lifetime_access_enabled": "LIFETIME ACCESS ENABLED"
},
"languages": {
"en": "English",
@ -278,6 +279,7 @@
"continue_anyway": "Continuing with current version...",
"update_confirm": "Do you want to update to the latest version? (Y/n)",
"update_skipped": "Skipping update.",
"invalid_choice": "Invalid choice. Please enter 'Y' or 'n'."
"invalid_choice": "Invalid choice. Please enter 'Y' or 'n'.",
"development_version": "Development Version {current} > {latest}"
}
}

View File

@ -12,7 +12,8 @@
"program_terminated": "Chương trình đã bị người dùng chấm dứt",
"error_occurred": "Đã xảy ra lỗi: {error}. Vui lòng thử lại",
"press_enter": "Nhấn Enter để Thoát",
"disable_auto_update": "Tắt Tự Động Cập Nhật Cursor"
"disable_auto_update": "Tắt Tự Động Cập Nhật Cursor",
"lifetime_access_enabled": "LIFETIME ACCESS ENABLED"
},
"languages": {
"en": "English",
@ -276,6 +277,7 @@
"continue_anyway": "Tiếp Tục Với Phiên Bản Hiện Tại...",
"update_confirm": "Bạn Có Muốn Cập Nhật Lên Phiên Bản Mới Nhất Không? (Y/n)",
"update_skipped": "Bỏ Qua Cập Nhật.",
"invalid_choice": "Lựa Chọn Không Hợp Lệ. Vui Lòng Nhập 'Y' Hoặc 'n'."
"invalid_choice": "Lựa Chọn Không Hợp Lệ. Vui Lòng Nhập 'Y' Hoặc 'n'.",
"development_version": "Phiên Bản Phát Triển {current} > {latest}"
}
}

View File

@ -14,7 +14,8 @@
"program_terminated": "程序已被用户终止",
"error_occurred": "发生错误:{error},请重试",
"press_enter": "按回车键退出",
"disable_auto_update": "禁用 Cursor 自动更新"
"disable_auto_update": "禁用 Cursor 自动更新",
"lifetime_access_enabled": "永久订阅"
},
"languages": {
"en": "English",
@ -274,6 +275,7 @@
"continue_anyway": "继续使用当前版本...",
"update_confirm": "是否要更新到最新版本? (Y/n)",
"update_skipped": "跳过更新。",
"invalid_choice": "选择无效。请输入 'Y' 或 'n'."
"invalid_choice": "选择无效。请输入 'Y' 或 'n'.",
"development_version": "开发版本 {current} > {latest}"
}
}

View File

@ -12,7 +12,8 @@
"program_terminated": "程式已被使用者終止",
"error_occurred": "發生錯誤:{error},請重試",
"press_enter": "按返回鍵退出",
"disable_auto_update": "停用 Cursor 自動更新"
"disable_auto_update": "停用 Cursor 自動更新",
"lifetime_access_enabled": "永久訂閱"
},
"languages": {
"en": "English",
@ -254,6 +255,7 @@
"continue_anyway": "繼續使用當前版本...",
"update_confirm": "是否要更新到最新版本? (Y/n)",
"update_skipped": "跳過更新。",
"invalid_choice": "選擇無效。請輸入 'Y' 或 'n'."
"invalid_choice": "選擇無效。請輸入 'Y' 或 'n'.",
"development_version": "開發版本 {current} > {latest}"
}
}

30
main.py
View File

@ -220,9 +220,9 @@ def print_menu():
print(f"{Fore.GREEN}1{Style.RESET_ALL}. {EMOJI['RESET']} {translator.get('menu.reset')}")
print(f"{Fore.GREEN}2{Style.RESET_ALL}. {EMOJI['SUCCESS']} {translator.get('menu.register')}")
print(f"{Fore.GREEN}3{Style.RESET_ALL}. 🌟 {translator.get('menu.register_google')}")
print(f"{Fore.YELLOW} ┗━━ 🔥 LIFETIME ACCESS ENABLED 🔥{Style.RESET_ALL}")
print(f"{Fore.YELLOW} ┗━━ 🔥 {translator.get('menu.lifetime_access_enabled')} 🔥{Style.RESET_ALL}")
print(f"{Fore.GREEN}4{Style.RESET_ALL}. ⭐ {translator.get('menu.register_github')}")
print(f"{Fore.YELLOW} ┗━━ 🚀 LIFETIME ACCESS ENABLED 🚀{Style.RESET_ALL}")
print(f"{Fore.YELLOW} ┗━━ 🚀 {translator.get('menu.lifetime_access_enabled')} 🚀{Style.RESET_ALL}")
print(f"{Fore.GREEN}5{Style.RESET_ALL}. {EMOJI['SUCCESS']} {translator.get('menu.register_manual')}")
print(f"{Fore.GREEN}6{Style.RESET_ALL}. {EMOJI['ERROR']} {translator.get('menu.quit')}")
print(f"{Fore.GREEN}7{Style.RESET_ALL}. {EMOJI['LANG']} {translator.get('menu.select_language')}")
@ -281,7 +281,27 @@ def check_latest_version():
if not latest_version:
raise Exception("Invalid version format received")
if latest_version != version:
# Parse versions for proper comparison
def parse_version(version_str):
"""Parse version string into tuple for proper comparison"""
try:
return tuple(map(int, version_str.split('.')))
except ValueError:
# Fallback to string comparison if parsing fails
return version_str
current_version_tuple = parse_version(version)
latest_version_tuple = parse_version(latest_version)
# Compare versions properly
is_newer_version_available = False
if isinstance(current_version_tuple, tuple) and isinstance(latest_version_tuple, tuple):
is_newer_version_available = current_version_tuple < latest_version_tuple
else:
# Fallback to string comparison
is_newer_version_available = version != latest_version
if is_newer_version_available:
print(f"\n{Fore.YELLOW}{EMOJI['INFO']} {translator.get('updater.new_version_available', current=version, latest=latest_version)}{Style.RESET_ALL}")
# Ask user if they want to update
@ -327,6 +347,10 @@ def check_latest_version():
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('updater.update_failed', error=str(update_error))}{Style.RESET_ALL}")
print(f"{Fore.YELLOW}{EMOJI['INFO']} {translator.get('updater.manual_update_required')}{Style.RESET_ALL}")
return
else:
# If current version is newer or equal to latest version
if current_version_tuple > latest_version_tuple:
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('updater.development_version', current=version, latest=latest_version)}{Style.RESET_ALL}")
else:
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('updater.up_to_date')}{Style.RESET_ALL}")