diff --git a/config.py b/config.py index cf481c0..9fb75ce 100644 --- a/config.py +++ b/config.py @@ -66,7 +66,8 @@ def setup_config(translator=None): 'machine_id_path': os.path.join(appdata, "Cursor", "machineId"), 'cursor_path': os.path.join(localappdata, "Programs", "Cursor", "resources", "app"), 'updater_path': os.path.join(localappdata, "cursor-updater"), - 'update_yml_path': os.path.join(localappdata, "Programs", "Cursor", "resources", "app-update.yml") + 'update_yml_path': os.path.join(localappdata, "Programs", "Cursor", "resources", "app-update.yml"), + 'product_json_path': os.path.join(localappdata, "Programs", "Cursor", "resources", "app", "product.json") } # Create storage directory os.makedirs(os.path.dirname(default_config['WindowsPaths']['storage_path']), exist_ok=True) @@ -78,7 +79,8 @@ def setup_config(translator=None): 'machine_id_path': os.path.expanduser("~/Library/Application Support/Cursor/machineId"), 'cursor_path': "/Applications/Cursor.app/Contents/Resources/app", 'updater_path': os.path.expanduser("~/Library/Application Support/cursor-updater"), - 'update_yml_path': "/Applications/Cursor.app/Contents/Resources/app-update.yml" + 'update_yml_path': "/Applications/Cursor.app/Contents/Resources/app-update.yml", + 'product_json_path': "/Applications/Cursor.app/Contents/Resources/app/product.json" } # Create storage directory os.makedirs(os.path.dirname(default_config['MacPaths']['storage_path']), exist_ok=True) @@ -185,7 +187,8 @@ def setup_config(translator=None): 'machine_id_path': os.path.join(cursor_dir, "machineid") if cursor_dir else "", 'cursor_path': get_linux_cursor_path(), 'updater_path': os.path.join(config_base, "cursor-updater"), - 'update_yml_path': os.path.join(cursor_dir, "resources/app-update.yml") if cursor_dir else "" + 'update_yml_path': os.path.join(cursor_dir, "resources/app-update.yml") if cursor_dir else "", + 'product_json_path': os.path.join(cursor_dir, "resources/app/product.json") if cursor_dir else "" } # Read existing configuration and merge diff --git a/disable_auto_update.py b/disable_auto_update.py index 7b01280..2aee036 100644 --- a/disable_auto_update.py +++ b/disable_auto_update.py @@ -66,8 +66,8 @@ class AutoUpdateDisabler: } self.product_json_path = self.product_json_paths.get(self.system) - def _change_main_js(self): - """Change main.js""" + def _remove_update_url(self): + """Remove update URL""" try: original_stat = os.stat(self.product_json_path) original_mode = original_stat.st_mode @@ -232,8 +232,8 @@ class AutoUpdateDisabler: if not self._create_blocking_file(): return False - # 5. Change main.js - if not self._change_main_js(): + # 5. Remove update URL from product.json + if not self._remove_update_url(): return False print(f"{Fore.GREEN}{EMOJI['CHECK']} {self.translator.get('update.disable_success') if self.translator else '自动更新已禁用'}{Style.RESET_ALL}")