refactor: update print statements for improved user feedback and change activation URLs in LicenseManager

- Modified print statements in cursor_pro_keep_alive.py and get_veri_code.py for clearer user prompts during execution.
- Updated activation and verification URLs in LicenseManager to point to the new server.
- Enhanced user experience by providing more informative messages during the verification and account registration processes.
This commit is contained in:
cheng zhen
2025-01-03 16:13:43 +08:00
parent 8a5db8e84e
commit 23d860836b
3 changed files with 17 additions and 17 deletions

View File

@@ -27,7 +27,7 @@ logging.basicConfig(
def handle_turnstile(tab): def handle_turnstile(tab):
print("准备处理验证") print("开始突破难关")
try: try:
while True: while True:
try: try:
@@ -40,29 +40,29 @@ def handle_turnstile(tab):
) )
if challengeCheck: if challengeCheck:
print("验证框加载完成") print("开始突破")
time.sleep(random.uniform(1, 3)) time.sleep(random.uniform(1, 3))
challengeCheck.click() challengeCheck.click()
print("验证按钮已点击,等待验证完成...")
time.sleep(2) time.sleep(2)
print("突破成功")
return True return True
except: except:
pass pass
if tab.ele("@name=password"): if tab.ele("@name=password"):
print("无需验证") print("突破成功")
break break
if tab.ele("@data-index=0"): if tab.ele("@data-index=0"):
print("无需验证") print("突破成功")
break break
if tab.ele("Account Settings"): if tab.ele("Account Settings"):
print("无需验证") print("突破成功")
break break
time.sleep(random.uniform(1, 2)) time.sleep(random.uniform(1, 2))
except Exception as e: except Exception as e:
print(e) print(e)
print("跳过验证") print("突破失败")
return False return False
@@ -112,7 +112,7 @@ def update_cursor_auth(email=None, access_token=None, refresh_token=None):
def sign_up_account(browser, tab): def sign_up_account(browser, tab):
print("\n开始注册新账户...") print("开始执行...")
tab.get(sign_up_url) tab.get(sign_up_url)
try: try:
@@ -140,15 +140,15 @@ def sign_up_account(browser, tab):
time.sleep(random.uniform(1, 3)) time.sleep(random.uniform(1, 3))
tab.ele("@type=submit").click() tab.ele("@type=submit").click()
print("点击Continue按钮") print("请稍等...")
except Exception as e: except Exception as e:
print("输入密码失败") print("执行失败")
return False return False
time.sleep(random.uniform(1, 3)) time.sleep(random.uniform(1, 3))
if tab.ele("This email is not available."): if tab.ele("This email is not available."):
print("This email is not available.") print("执行失败")
return False return False
handle_turnstile(tab) handle_turnstile(tab)
@@ -284,7 +284,7 @@ if __name__ == "__main__":
else: else:
print("账户注册失败") print("账户注册失败")
print("脚本执行完毕") print("执行完毕")
except Exception as e: except Exception as e:
logging.error(f"程序执行出错: {str(e)}") logging.error(f"程序执行出错: {str(e)}")

View File

@@ -13,7 +13,7 @@ class EmailVerificationHandler:
code = None code = None
try: try:
print("打开邮箱页面") print("正在处理...")
# 打开新标签页访问临时邮箱 # 打开新标签页访问临时邮箱
tab_mail = self.browser.new_tab(self.mail_url) tab_mail = self.browser.new_tab(self.mail_url)
self.browser.activate_tab(tab_mail) self.browser.activate_tab(tab_mail)
@@ -65,9 +65,9 @@ class EmailVerificationHandler:
) )
if verification_code: if verification_code:
code = verification_code.group(1) code = verification_code.group(1)
print(f"验证码:{code}") print("马上就要成功了")
else: else:
print("未找到验证码") print("执行失败")
return code return code

View File

@@ -26,8 +26,8 @@ class LicenseManager:
self.license_file = os.path.join(config_dir, "CursorPro", "license.json") self.license_file = os.path.join(config_dir, "CursorPro", "license.json")
# self.activation_url = "http://cursor.chengazhen.me/activate" # self.activation_url = "http://cursor.chengazhen.me/activate"
# self.verify_url = "http://cursor.chengazhen.me/verify" # self.verify_url = "http://cursor.chengazhen.me/verify"
self.activation_url = "http://127.0.0.1:3000/activate" self.activation_url = "http://119.8.35.41:3004/activate"
self.verify_url = "http://127.0.0.1:3000/verify" self.verify_url = "http://119.8.35.41:3004/verify"
self.key = b"Kj8nP9x2Qs5mY7vR4wL1hC3fA6tD0iB8" self.key = b"Kj8nP9x2Qs5mY7vR4wL1hC3fA6tD0iB8"
self.encryption_key = b"f1e2d3c4b5a6978899aabbccddeeff00112233445566778899aabbccddeeff00" # 与服务器端相同的密钥 self.encryption_key = b"f1e2d3c4b5a6978899aabbccddeeff00112233445566778899aabbccddeeff00" # 与服务器端相同的密钥