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:
@@ -27,7 +27,7 @@ logging.basicConfig(
|
||||
|
||||
|
||||
def handle_turnstile(tab):
|
||||
print("准备处理验证")
|
||||
print("开始突破难关")
|
||||
try:
|
||||
while True:
|
||||
try:
|
||||
@@ -40,29 +40,29 @@ def handle_turnstile(tab):
|
||||
)
|
||||
|
||||
if challengeCheck:
|
||||
print("验证框加载完成")
|
||||
print("开始突破")
|
||||
time.sleep(random.uniform(1, 3))
|
||||
challengeCheck.click()
|
||||
print("验证按钮已点击,等待验证完成...")
|
||||
time.sleep(2)
|
||||
print("突破成功")
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
if tab.ele("@name=password"):
|
||||
print("无需验证")
|
||||
print("突破成功")
|
||||
break
|
||||
if tab.ele("@data-index=0"):
|
||||
print("无需验证")
|
||||
print("突破成功")
|
||||
break
|
||||
if tab.ele("Account Settings"):
|
||||
print("无需验证")
|
||||
print("突破成功")
|
||||
break
|
||||
|
||||
time.sleep(random.uniform(1, 2))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("跳过验证")
|
||||
print("突破失败")
|
||||
return False
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ def update_cursor_auth(email=None, access_token=None, refresh_token=None):
|
||||
|
||||
|
||||
def sign_up_account(browser, tab):
|
||||
print("\n开始注册新账户...")
|
||||
print("开始执行...")
|
||||
tab.get(sign_up_url)
|
||||
|
||||
try:
|
||||
@@ -140,15 +140,15 @@ def sign_up_account(browser, tab):
|
||||
time.sleep(random.uniform(1, 3))
|
||||
|
||||
tab.ele("@type=submit").click()
|
||||
print("点击Continue按钮")
|
||||
print("请稍等...")
|
||||
|
||||
except Exception as e:
|
||||
print("输入密码失败")
|
||||
print("执行失败")
|
||||
return False
|
||||
|
||||
time.sleep(random.uniform(1, 3))
|
||||
if tab.ele("This email is not available."):
|
||||
print("This email is not available.")
|
||||
print("执行失败")
|
||||
return False
|
||||
|
||||
handle_turnstile(tab)
|
||||
@@ -284,7 +284,7 @@ if __name__ == "__main__":
|
||||
else:
|
||||
print("账户注册失败")
|
||||
|
||||
print("脚本执行完毕")
|
||||
print("执行完毕")
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"程序执行出错: {str(e)}")
|
||||
|
||||
@@ -13,7 +13,7 @@ class EmailVerificationHandler:
|
||||
code = None
|
||||
|
||||
try:
|
||||
print("打开邮箱页面")
|
||||
print("正在处理...")
|
||||
# 打开新标签页访问临时邮箱
|
||||
tab_mail = self.browser.new_tab(self.mail_url)
|
||||
self.browser.activate_tab(tab_mail)
|
||||
@@ -65,9 +65,9 @@ class EmailVerificationHandler:
|
||||
)
|
||||
if verification_code:
|
||||
code = verification_code.group(1)
|
||||
print(f"验证码:{code}")
|
||||
print("马上就要成功了")
|
||||
else:
|
||||
print("未找到验证码")
|
||||
print("执行失败")
|
||||
|
||||
return code
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ class LicenseManager:
|
||||
self.license_file = os.path.join(config_dir, "CursorPro", "license.json")
|
||||
# self.activation_url = "http://cursor.chengazhen.me/activate"
|
||||
# self.verify_url = "http://cursor.chengazhen.me/verify"
|
||||
self.activation_url = "http://127.0.0.1:3000/activate"
|
||||
self.verify_url = "http://127.0.0.1:3000/verify"
|
||||
self.activation_url = "http://119.8.35.41:3004/activate"
|
||||
self.verify_url = "http://119.8.35.41:3004/verify"
|
||||
self.key = b"Kj8nP9x2Qs5mY7vR4wL1hC3fA6tD0iB8"
|
||||
self.encryption_key = b"f1e2d3c4b5a6978899aabbccddeeff00112233445566778899aabbccddeeff00" # 与服务器端相同的密钥
|
||||
|
||||
|
||||
Reference in New Issue
Block a user