diff --git a/cursor_auth_manager.py b/cursor_auth_manager.py index 0060baf..f404b6f 100644 --- a/cursor_auth_manager.py +++ b/cursor_auth_manager.py @@ -1,16 +1,20 @@ import sqlite3 import os + class CursorAuthManager: """Cursor认证信息管理器""" def __init__(self): # 判断操作系统 - if os.name == 'nt': # Windows - self.db_path = os.path.join(os.getenv('APPDATA'), 'Cursor', 'User', 'globalStorage', 'state.vscdb') + if os.name == "nt": # Windows + self.db_path = os.path.join( + os.getenv("APPDATA"), "Cursor", "User", "globalStorage", "state.vscdb" + ) else: # macOS - self.db_path = os.path.expanduser('~/Library/Application Support/Cursor/User/globalStorage/state.vscdb') - + self.db_path = os.path.expanduser( + "~/Library/Application Support/Cursor/User/globalStorage/state.vscdb" + ) def update_auth(self, email=None, access_token=None, refresh_token=None): """ @@ -22,11 +26,11 @@ class CursorAuthManager: """ updates = [] if email is not None: - updates.append(('cursorAuth/cachedEmail', email)) + updates.append(("cursorAuth/cachedEmail", email)) if access_token is not None: - updates.append(('cursorAuth/accessToken', access_token)) + updates.append(("cursorAuth/accessToken", access_token)) if refresh_token is not None: - updates.append(('cursorAuth/refreshToken', refresh_token)) + updates.append(("cursorAuth/refreshToken", refresh_token)) if not updates: print("没有提供任何要更新的值") @@ -43,6 +47,7 @@ class CursorAuthManager: if cursor.rowcount > 0: print(f"成功更新 {key.split('/')[-1]}") + print("更新成功") else: print(f"未找到 {key.split('/')[-1]} 或值未变化") diff --git a/cursor_pro_keep_alive.py b/cursor_pro_keep_alive.py index 8e61565..9267cbd 100644 --- a/cursor_pro_keep_alive.py +++ b/cursor_pro_keep_alive.py @@ -382,7 +382,7 @@ if __name__ == "__main__": if sign_up_account(browser, tab): token = get_cursor_session_token(tab) if token: - print(f"CursorSessionToken: {token}") + # print(f"CursorSessionToken: {token}") print("账户注册成功") if auto_update_cursor_auth: update_cursor_auth( diff --git a/run_cursor.bat b/run_cursor.bat deleted file mode 100644 index db2df60..0000000 --- a/run_cursor.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -:: 设置控制台代码页为 UTF-8 -chcp 65001 -:: 设置 Python 环境变量为 UTF-8 -set PYTHONIOENCODING=utf-8 - -echo [%date% %time%] 开始执行脚本 >> log.txt -cd /d "%~dp0" -python cursor_pro_keep_alive.py >> log.txt 2>&1 -echo [%date% %time%] 脚本执行完成 >> log.txt -pause \ No newline at end of file