chore: Bump version to 1.5.04 and improve system compatibility

- Update version in .env file to 1.5.04
- Add Mac-specific run_venv script to .gitignore
- Enhance Cursor Auth platform detection with more precise sys.platform checks
- Add maximum retry mechanism for email creation
- Improve error handling and platform support in cursor_auth.py
This commit is contained in:
Pin Studios 2025-03-06 12:18:55 +08:00
parent 005aa2cd95
commit 4aabe2e403
5 changed files with 162 additions and 141 deletions

4
.env
View File

@ -1,2 +1,2 @@
version=1.5.03 version=1.5.04
VERSION=1.5.03 VERSION=1.5.04

3
.gitignore vendored
View File

@ -45,3 +45,6 @@ Thumbs.db
*.log *.log
*.db *.db
*.sqlite3 *.sqlite3
# Mac
run_venv.mac.command

View File

@ -1,5 +1,11 @@
# Change Log # Change Log
## v1.6.01
1. Fix: Cursor Auth | 修復Cursor Auth
2. Add: Create Account Maximum Retry | 增加創建賬號最大重試次數
3. Fix: Cursor Auth Error | 修復Cursor Auth錯誤
4. Fix: Update Curl Faild | 修復更新Curl失敗
## v1.5.03 ## v1.5.03
1. HOTFIX: Stuck on starting browser | 修復啟動瀏覽器卡住問題 1. HOTFIX: Stuck on starting browser | 修復啟動瀏覽器卡住問題
2. Small Fix: Error Handling | 小修錯誤處理 2. Small Fix: Error Handling | 小修錯誤處理

View File

@ -22,18 +22,21 @@ class CursorAuth:
def __init__(self, translator=None): def __init__(self, translator=None):
self.translator = translator self.translator = translator
# 判断操作系统 # 判断操作系统
if os.name == "nt": # Windows if sys.platform == "win32": # Windows
self.db_path = os.path.join( self.db_path = os.path.join(
os.getenv("APPDATA"), "Cursor", "User", "globalStorage", "state.vscdb" os.getenv("APPDATA"), "Cursor", "User", "globalStorage", "state.vscdb"
) )
elif os.name =='posix': elif sys.platform == 'linux':
self.db_path = os.path.expanduser( self.db_path = os.path.expanduser(
"~/.config/Cursor/User/globalStorage/state.vscdb" "~/.config/Cursor/User/globalStorage/state.vscdb"
) )
else: # macOS elif sys.platform == 'darwin': # macOS
self.db_path = os.path.expanduser( self.db_path = os.path.expanduser(
"~/Library/Application Support/Cursor/User/globalStorage/state.vscdb" "~/Library/Application Support/Cursor/User/globalStorage/state.vscdb"
) )
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('auth.unsupported_platform')}{Style.RESET_ALL}")
sys.exit(1)
# 检查数据库文件是否存在 # 检查数据库文件是否存在
if not os.path.exists(self.db_path): if not os.path.exists(self.db_path):
@ -87,13 +90,16 @@ class CursorAuth:
# 设置要更新的键值对 # 设置要更新的键值对
updates = [] updates = []
updates.append(("cursorAuth/cachedSignUpType", "Auth_0"))
if email is not None: if email is not None:
updates.append(("cursorAuth/cachedEmail", email)) updates.append(("cursorAuth/cachedEmail", email))
if access_token is not None: if access_token is not None:
updates.append(("cursorAuth/accessToken", access_token)) updates.append(("cursorAuth/accessToken", access_token))
if refresh_token is not None: if refresh_token is not None:
updates.append(("cursorAuth/refreshToken", refresh_token)) updates.append(("cursorAuth/refreshToken", refresh_token))
updates.append(("cursorAuth/cachedSignUpType", "Auth_0"))
# 使用事务来确保数据完整性 # 使用事务来确保数据完整性
cursor.execute("BEGIN TRANSACTION") cursor.execute("BEGIN TRANSACTION")
@ -131,5 +137,3 @@ class CursorAuth:
if conn: if conn:
conn.close() conn.close()
print(f"{EMOJI['DB']} {Fore.CYAN} {self.translator.get('auth.database_connection_closed')}{Style.RESET_ALL}") print(f"{EMOJI['DB']} {Fore.CYAN} {self.translator.get('auth.database_connection_closed')}{Style.RESET_ALL}")

View File

@ -73,6 +73,11 @@ class NewTempEmail:
def create_email(self): def create_email(self):
"""create temporary email""" """create temporary email"""
max_retries = 3 # Maximum number of retries
attempt = 0 # Current attempt count
while attempt < max_retries:
attempt += 1
try: try:
if self.translator: if self.translator:
print(f"{Fore.CYAN} {self.translator.get('email.visiting_site').replace('mail.tm', self.selected_service['name'])}{Style.RESET_ALL}") print(f"{Fore.CYAN} {self.translator.get('email.visiting_site').replace('mail.tm', self.selected_service['name'])}{Style.RESET_ALL}")
@ -211,6 +216,9 @@ class NewTempEmail:
return email return email
except Exception as e: except Exception as e:
if attempt < max_retries:
print(f"{Fore.YELLOW}⚠️ 尝试重新创建邮箱... (尝试 {attempt}/{max_retries}){Style.RESET_ALL}")
else:
if self.translator: if self.translator:
print(f"{Fore.RED}{self.translator.get('email.create_error')}: {str(e)}{Style.RESET_ALL}") print(f"{Fore.RED}{self.translator.get('email.create_error')}: {str(e)}{Style.RESET_ALL}")
else: else: