Skip to content

Commit

Permalink
feat: Add user mode selection for machine ID reset and registration
Browse files Browse the repository at this point in the history
  • Loading branch information
cheng zhen committed Feb 3, 2025
1 parent 433f71c commit 5207694
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions cursor_pro_keep_alive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import platform
import json
import sys
from colorama import Fore, Style

from exit_cursor import ExitCursor
Expand Down Expand Up @@ -393,11 +394,39 @@ def check_cursor_version():
return None


def reset_machine_id(less_than_0_45):
if less_than_0_45:
MachineIDResetter().reset_machine_ids()
else:
patch_cursor_get_machine_id.patch_cursor_get_machine_id()


if __name__ == "__main__":
print_logo()
browser_manager = None
try:
logging.info("\n=== 初始化程序 ===")
# 提示用户选择操作模式
print("\n请选择操作模式:")
print("1. 仅重置机器码")
print("2. 完整注册流程")
while True:
try:
choice = int(input("请输入选项 (1 或 2): ").strip())
if choice in [1, 2]:
break
else:
print("无效的选项,请重新输入")
except ValueError:
print("请输入有效的数字")

if choice == 1:
# 仅执行重置机器码
less_than_0_45 = check_cursor_version()
reset_machine_id(less_than_0_45)
logging.info("机器码重置完成")
sys.exit(0)

# 小于0.45的版本需要打补丁
less_than_0_45 = check_cursor_version()
if less_than_0_45:
Expand Down Expand Up @@ -456,11 +485,7 @@ def check_cursor_version():
)

logging.info("重置机器码...")
# 判断cursor版本是否小于0.45
if less_than_0_45:
MachineIDResetter().reset_machine_ids()
else:
patch_cursor_get_machine_id.patch_cursor_get_machine_id()
reset_machine_id(less_than_0_45)
logging.info("所有操作已完成")
else:
logging.error("获取会话令牌失败,注册流程未完成")
Expand Down

0 comments on commit 5207694

Please sign in to comment.