diff --git a/.env b/.env index 27ed12e..777f7d3 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -version=1.6.01 -VERSION=1.6.01 +version=1.6.02 +VERSION=1.6.02 diff --git a/.gitignore b/.gitignore index bb7cb54..654a570 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ build.mac.command build.py build.sh ENV/ +test.py install.bat run.bat diff --git a/CHANGELOG.md b/CHANGELOG.md index dd98cf8..0ecb0cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## v1.6.02 +1. Hotfix: Small Problem | 修復一些問題 +2. Add: Test some Bypass Code | 測試一些繞過代碼 + ## v1.6.01 1. Fix: Cursor Auth | 修復Cursor Auth 2. Add: Create Account Maximum Retry | 增加創建賬號最大重試次數 diff --git a/reset_machine_manual.py b/reset_machine_manual.py index 420cae5..0b4a927 100644 --- a/reset_machine_manual.py +++ b/reset_machine_manual.py @@ -64,6 +64,43 @@ def get_cursor_paths(translator=None) -> Tuple[str, str]: os.path.join(base_path, paths_map[system]["main"]), ) +def get_workbench_cursor_path(translator=None) -> str: + """Get Cursor workbench.desktop.main.js path""" + system = platform.system() + + paths_map = { + "Darwin": { # macOS + "base": "/Applications/Cursor.app/Contents/Resources/app", + "main": "out/vs/workbench/workbench.desktop.main.js" + }, + "Windows": { + "base": os.path.join(os.getenv("LOCALAPPDATA", ""), "Programs", "Cursor", "resources", "app"), + "main": "out/vs/workbench/workbench.desktop.main.js" + }, + "Linux": { + "bases": ["/opt/Cursor/resources/app", "/usr/share/cursor/resources/app"], + "main": "out/vs/workbench/workbench.desktop.main.js" + } + } + + if system not in paths_map: + raise OSError(translator.get('reset.unsupported_os', system=system) if translator else f"不支持的操作系统: {system}") + + if system == "Linux": + for base in paths_map["Linux"]["bases"]: + main_path = os.path.join(base, paths_map["Linux"]["main"]) + if os.path.exists(main_path): + return main_path + raise OSError(translator.get('reset.linux_path_not_found') if translator else "在 Linux 系统上未找到 Cursor 安装路径") + + base_path = paths_map[system]["base"] + main_path = os.path.join(base_path, paths_map[system]["main"]) + + if not os.path.exists(main_path): + raise OSError(translator.get('reset.file_not_found', path=main_path) if translator else f"未找到 Cursor main.js 文件: {main_path}") + + return main_path + def version_check(version: str, min_version: str = "", max_version: str = "", translator=None) -> bool: """Version number check""" version_pattern = r"^\d+\.\d+\.\d+$" @@ -102,6 +139,70 @@ def check_cursor_version(translator) -> bool: print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.check_version_failed', error=str(e))}{Style.RESET_ALL}") return False +def modify_workbench_js(file_path: str, translator=None) -> bool: + """ + Modify file content + """ + try: + # Save original file permissions + original_stat = os.stat(file_path) + original_mode = original_stat.st_mode + original_uid = original_stat.st_uid + original_gid = original_stat.st_gid + + # Create temporary file + with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", errors="ignore", delete=False) as tmp_file: + # Read original content + with open(file_path, "r", encoding="utf-8", errors="ignore") as main_file: + content = main_file.read() + + # Define replacement patterns + CButton_old_pattern = r'$(k,E(Ks,{title:"Upgrade to Pro",size:"small",get codicon(){return F.rocket},get onClick(){return t.pay}}),null)' + CButton_new_pattern = r'$(k,E(Ks,{title:"yeongpin GitHub",size:"small",get codicon(){return F.rocket},get onClick(){return function(){window.open("https://www.github.com/yeongpin","_blank")}}}),null)' + + CBadge_old_pattern = r'