feat: 删除无用的东西
This commit is contained in:
@@ -1,16 +1,20 @@
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class CursorAuthManager:
|
class CursorAuthManager:
|
||||||
"""Cursor认证信息管理器"""
|
"""Cursor认证信息管理器"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# 判断操作系统
|
# 判断操作系统
|
||||||
if os.name == 'nt': # Windows
|
if os.name == "nt": # Windows
|
||||||
self.db_path = os.path.join(os.getenv('APPDATA'), 'Cursor', 'User', 'globalStorage', 'state.vscdb')
|
self.db_path = os.path.join(
|
||||||
|
os.getenv("APPDATA"), "Cursor", "User", "globalStorage", "state.vscdb"
|
||||||
|
)
|
||||||
else: # macOS
|
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):
|
def update_auth(self, email=None, access_token=None, refresh_token=None):
|
||||||
"""
|
"""
|
||||||
@@ -22,11 +26,11 @@ class CursorAuthManager:
|
|||||||
"""
|
"""
|
||||||
updates = []
|
updates = []
|
||||||
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))
|
||||||
|
|
||||||
if not updates:
|
if not updates:
|
||||||
print("没有提供任何要更新的值")
|
print("没有提供任何要更新的值")
|
||||||
@@ -43,6 +47,7 @@ class CursorAuthManager:
|
|||||||
|
|
||||||
if cursor.rowcount > 0:
|
if cursor.rowcount > 0:
|
||||||
print(f"成功更新 {key.split('/')[-1]}")
|
print(f"成功更新 {key.split('/')[-1]}")
|
||||||
|
print("更新成功")
|
||||||
else:
|
else:
|
||||||
print(f"未找到 {key.split('/')[-1]} 或值未变化")
|
print(f"未找到 {key.split('/')[-1]} 或值未变化")
|
||||||
|
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ if __name__ == "__main__":
|
|||||||
if sign_up_account(browser, tab):
|
if sign_up_account(browser, tab):
|
||||||
token = get_cursor_session_token(tab)
|
token = get_cursor_session_token(tab)
|
||||||
if token:
|
if token:
|
||||||
print(f"CursorSessionToken: {token}")
|
# print(f"CursorSessionToken: {token}")
|
||||||
print("账户注册成功")
|
print("账户注册成功")
|
||||||
if auto_update_cursor_auth:
|
if auto_update_cursor_auth:
|
||||||
update_cursor_auth(
|
update_cursor_auth(
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user