Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 5207694

Browse files
author
cheng zhen
committed
feat: Add user mode selection for machine ID reset and registration
1 parent 433f71c commit 5207694

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

cursor_pro_keep_alive.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import platform
33
import json
4+
import sys
45
from colorama import Fore, Style
56

67
from exit_cursor import ExitCursor
@@ -393,11 +394,39 @@ def check_cursor_version():
393394
return None
394395

395396

397+
def reset_machine_id(less_than_0_45):
398+
if less_than_0_45:
399+
MachineIDResetter().reset_machine_ids()
400+
else:
401+
patch_cursor_get_machine_id.patch_cursor_get_machine_id()
402+
403+
396404
if __name__ == "__main__":
397405
print_logo()
398406
browser_manager = None
399407
try:
400408
logging.info("\n=== 初始化程序 ===")
409+
# 提示用户选择操作模式
410+
print("\n请选择操作模式:")
411+
print("1. 仅重置机器码")
412+
print("2. 完整注册流程")
413+
while True:
414+
try:
415+
choice = int(input("请输入选项 (1 或 2): ").strip())
416+
if choice in [1, 2]:
417+
break
418+
else:
419+
print("无效的选项,请重新输入")
420+
except ValueError:
421+
print("请输入有效的数字")
422+
423+
if choice == 1:
424+
# 仅执行重置机器码
425+
less_than_0_45 = check_cursor_version()
426+
reset_machine_id(less_than_0_45)
427+
logging.info("机器码重置完成")
428+
sys.exit(0)
429+
401430
# 小于0.45的版本需要打补丁
402431
less_than_0_45 = check_cursor_version()
403432
if less_than_0_45:
@@ -456,11 +485,7 @@ def check_cursor_version():
456485
)
457486

458487
logging.info("重置机器码...")
459-
# 判断cursor版本是否小于0.45
460-
if less_than_0_45:
461-
MachineIDResetter().reset_machine_ids()
462-
else:
463-
patch_cursor_get_machine_id.patch_cursor_get_machine_id()
488+
reset_machine_id(less_than_0_45)
464489
logging.info("所有操作已完成")
465490
else:
466491
logging.error("获取会话令牌失败,注册流程未完成")

0 commit comments

Comments
 (0)