mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
chore: modify disable auto update & config
This commit is contained in:
parent
5604f5073d
commit
0a779063bf
@ -66,7 +66,8 @@ def setup_config(translator=None):
|
|||||||
'machine_id_path': os.path.join(appdata, "Cursor", "machineId"),
|
'machine_id_path': os.path.join(appdata, "Cursor", "machineId"),
|
||||||
'cursor_path': os.path.join(localappdata, "Programs", "Cursor", "resources", "app"),
|
'cursor_path': os.path.join(localappdata, "Programs", "Cursor", "resources", "app"),
|
||||||
'updater_path': os.path.join(localappdata, "cursor-updater"),
|
'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
|
# Create storage directory
|
||||||
os.makedirs(os.path.dirname(default_config['WindowsPaths']['storage_path']), exist_ok=True)
|
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"),
|
'machine_id_path': os.path.expanduser("~/Library/Application Support/Cursor/machineId"),
|
||||||
'cursor_path': "/Applications/Cursor.app/Contents/Resources/app",
|
'cursor_path': "/Applications/Cursor.app/Contents/Resources/app",
|
||||||
'updater_path': os.path.expanduser("~/Library/Application Support/cursor-updater"),
|
'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
|
# Create storage directory
|
||||||
os.makedirs(os.path.dirname(default_config['MacPaths']['storage_path']), exist_ok=True)
|
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 "",
|
'machine_id_path': os.path.join(cursor_dir, "machineid") if cursor_dir else "",
|
||||||
'cursor_path': get_linux_cursor_path(),
|
'cursor_path': get_linux_cursor_path(),
|
||||||
'updater_path': os.path.join(config_base, "cursor-updater"),
|
'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
|
# Read existing configuration and merge
|
||||||
|
@ -66,8 +66,8 @@ class AutoUpdateDisabler:
|
|||||||
}
|
}
|
||||||
self.product_json_path = self.product_json_paths.get(self.system)
|
self.product_json_path = self.product_json_paths.get(self.system)
|
||||||
|
|
||||||
def _change_main_js(self):
|
def _remove_update_url(self):
|
||||||
"""Change main.js"""
|
"""Remove update URL"""
|
||||||
try:
|
try:
|
||||||
original_stat = os.stat(self.product_json_path)
|
original_stat = os.stat(self.product_json_path)
|
||||||
original_mode = original_stat.st_mode
|
original_mode = original_stat.st_mode
|
||||||
@ -232,8 +232,8 @@ class AutoUpdateDisabler:
|
|||||||
if not self._create_blocking_file():
|
if not self._create_blocking_file():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# 5. Change main.js
|
# 5. Remove update URL from product.json
|
||||||
if not self._change_main_js():
|
if not self._remove_update_url():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print(f"{Fore.GREEN}{EMOJI['CHECK']} {self.translator.get('update.disable_success') if self.translator else '自动更新已禁用'}{Style.RESET_ALL}")
|
print(f"{Fore.GREEN}{EMOJI['CHECK']} {self.translator.get('update.disable_success') if self.translator else '自动更新已禁用'}{Style.RESET_ALL}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user