feat: Introduce force update configuration feature with multilingual support

- Added a new function to force update the configuration file with the latest defaults, including backup and removal of the original file.
- Implemented multilingual support for force update messages in English, Simplified Chinese, and Traditional Chinese locale files.
- Updated CHANGELOG.md to reflect the new feature and fixes, bumping the version to 1.8.08 in the build workflow.
This commit is contained in:
yeongpin 2025-04-07 10:51:01 +08:00
parent 16b6ba95e2
commit 9c66725caf
7 changed files with 74 additions and 11 deletions

View File

@ -6,7 +6,7 @@ on:
version:
description: 'Version number (e.g. 1.0.9)'
required: true
default: '1.8.07'
default: '1.8.08'
permissions:
contents: write

View File

@ -1,5 +1,13 @@
# Change Log
## v1.8.08
1. Add: Force Update Config | 添加強制更新配置
2. Add: Multilanguage support for force update | 添加強制更新功能的多語言支持
3. Fix: Google Auth & Github Auth JWT Problem | 修復 Google Auth & Github Auth JWT 問題
4. Fix: Totally reset import & import * raw options problem | 修復 totally reset import & import * raw 選項問題
5. Fix: reset.file_not_found problem | 修復 reset.file_not_found 問題
6. Fix: Some Issues | 修復一些問題
## v1.8.07
1. Add: Bypass Cursor Version Check | 添加繞過 Cursor 版本檢查
2. Add: Multilanguage support for bypass | 添加繞過的多語言支持

View File

@ -3,6 +3,7 @@ import sys
import configparser
from colorama import Fore, Style
from utils import get_user_documents_path, get_default_chrome_path, get_linux_cursor_path
import shutil
EMOJI = {
"INFO": "",
@ -257,6 +258,44 @@ def print_config(config, translator=None):
print()
def force_update_config(translator=None):
"""
Force update configuration file with latest defaults
Args:
translator: Translator instance
Returns:
ConfigParser instance or None if failed
"""
try:
config_dir = os.path.join(get_user_documents_path(), ".cursor-free-vip")
config_file = os.path.join(config_dir, "config.ini")
datetime = datetime.datetime
time = datetime.now()
if os.path.exists(config_file):
try:
# create backup
backup_file = f"{config_file}.bak.{time.strftime('%Y%m%d_%H%M%S')}"
shutil.copy2(config_file, backup_file)
if translator:
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('config.backup_created', path=backup_file) if translator else f'Backup created: {backup_file}'}{Style.RESET_ALL}")
# delete original file
os.remove(config_file)
if translator:
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('config.config_removed') if translator else 'Config file removed for forced update'}{Style.RESET_ALL}")
except Exception as e:
if translator:
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('config.backup_failed', error=str(e)) if translator else f'Failed to backup config: {str(e)}'}{Style.RESET_ALL}")
# use existing setup_config function to create new config
return setup_config(translator)
except Exception as e:
if translator:
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('config.force_update_failed', error=str(e)) if translator else f'Force update config failed: {str(e)}'}{Style.RESET_ALL}")
return None
def get_config(translator=None):
"""Get existing config or create new one"""
return setup_config(translator)

View File

@ -117,7 +117,8 @@
"modify_file_failed": "Modify File Failed: {error}",
"windows_machine_id_updated": "Windows Machine ID Updated Successfully",
"update_windows_machine_id_failed": "Update Windows Machine ID Failed: {error}",
"update_windows_machine_guid_failed": "Update Windows Machine GUID Failed: {error}"
"update_windows_machine_guid_failed": "Update Windows Machine GUID Failed: {error}",
"file_not_found": "File Not Found: {path}"
},
"register": {
"title": "Cursor Registration Tool",
@ -555,7 +556,11 @@
"config_setup_error": "Error setting up config: {error}",
"storage_file_is_valid_and_contains_data": "Storage file is valid and contains data",
"error_reading_storage_file": "Error reading storage file: {error}",
"also_checked": "Also checked {path}"
"also_checked": "Also checked {path}",
"backup_created": "Backup created: {path}",
"config_removed": "Config file removed for forced update",
"backup_failed": "Failed to backup config: {error}",
"force_update_failed": "Force update config failed: {error}"
},
"oauth": {
"authentication_button_not_found": "Authentication button not found",

View File

@ -117,7 +117,8 @@
"modify_file_failed": "修改文件失败: {error}",
"windows_machine_id_updated": "Windows机器ID更新成功",
"update_windows_machine_id_failed": "更新Windows机器ID失败: {error}",
"update_windows_machine_guid_failed": "更新Windows机器GUID失败: {error}"
"update_windows_machine_guid_failed": "更新Windows机器GUID失败: {error}",
"file_not_found": "文件未找到: {path}"
},
"register": {
"title": "Cursor 注册工具",
@ -533,7 +534,11 @@
"config_setup_error": "配置设置错误",
"storage_file_is_valid_and_contains_data": "存储文件有效且包含数据",
"error_reading_storage_file": "读取存储文件时出错",
"also_checked": "也检查了 {path}"
"also_checked": "也检查了 {path}",
"backup_created": "备份创建: {path}",
"config_removed": "配置文件已删除用于强制更新",
"backup_failed": "备份失败: {error}",
"force_update_failed": "强制更新配置失败: {error}"
},
"oauth": {
"authentication_button_not_found": "未找到认证按钮",

View File

@ -117,7 +117,8 @@
"modify_file_failed": "修改文件失敗: {error}",
"windows_machine_id_updated": "Windows機器ID更新成功",
"update_windows_machine_id_failed": "更新Windows機器ID失敗: {error}",
"update_windows_machine_guid_failed": "更新Windows機器GUID失敗: {error}"
"update_windows_machine_guid_failed": "更新Windows機器GUID失敗: {error}",
"file_not_found": "文件未找到: {path}"
},
"register": {
@ -515,7 +516,11 @@
"config_setup_error": "配置設置錯誤",
"storage_file_is_valid_and_contains_data": "儲存文件有效且包含數據",
"error_reading_storage_file": "讀取儲存文件時出錯",
"also_checked": "也檢查了 {path}"
"also_checked": "也檢查了 {path}",
"backup_created": "備份已創建: {path}",
"config_removed": "配置文件已刪除用於強制更新",
"backup_failed": "備份失敗: {error}",
"force_update_failed": "強制更新配置失敗: {error}"
},
"oauth": {
"authentication_button_not_found": "未找到認證按鈕",

View File

@ -9,7 +9,7 @@ import locale
import platform
import requests
import subprocess
from config import get_config
from config import get_config, force_update_config
import shutil
import re
@ -275,8 +275,8 @@ def print_menu():
0: f"{Fore.GREEN}0{Style.RESET_ALL}. {EMOJI['ERROR']} {translator.get('menu.exit')}",
1: f"{Fore.GREEN}1{Style.RESET_ALL}. {EMOJI['RESET']} {translator.get('menu.reset')}",
2: f"{Fore.GREEN}2{Style.RESET_ALL}. {EMOJI['SUCCESS']} {translator.get('menu.register')} ({Fore.RED}{translator.get('menu.outdate')}{Style.RESET_ALL})",
3: f"{Fore.GREEN}3{Style.RESET_ALL}. {EMOJI['SUN']} {translator.get('menu.register_google')} {EMOJI['ROCKET']} ({Fore.YELLOW}{translator.get('menu.lifetime_access_enabled')} ({Fore.RED}{translator.get('menu.outdate')}{Style.RESET_ALL}))",
4: f"{Fore.GREEN}4{Style.RESET_ALL}. {EMOJI['STAR']} {translator.get('menu.register_github')} {EMOJI['ROCKET']} ({Fore.YELLOW}{translator.get('menu.lifetime_access_enabled')} ({Fore.RED}{translator.get('menu.outdate')}{Style.RESET_ALL}))",
3: f"{Fore.GREEN}3{Style.RESET_ALL}. {EMOJI['SUN']} {translator.get('menu.register_google')} {EMOJI['ROCKET']} ({Fore.YELLOW}{translator.get('menu.lifetime_access_enabled')}{Style.RESET_ALL})",
4: f"{Fore.GREEN}4{Style.RESET_ALL}. {EMOJI['STAR']} {translator.get('menu.register_github')} {EMOJI['ROCKET']} ({Fore.YELLOW}{translator.get('menu.lifetime_access_enabled')}{Style.RESET_ALL})",
5: f"{Fore.GREEN}5{Style.RESET_ALL}. {EMOJI['SUCCESS']} {translator.get('menu.register_manual')}",
6: f"{Fore.GREEN}6{Style.RESET_ALL}. {EMOJI['RESET']} {translator.get('menu.temp_github_register')}",
7: f"{Fore.GREEN}7{Style.RESET_ALL}. {EMOJI['ERROR']} {translator.get('menu.quit')}",
@ -552,6 +552,7 @@ def main():
if not config:
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('menu.config_init_failed')}{Style.RESET_ALL}")
return
force_update_config(translator)
if config.getboolean('Utils', 'enabled_update_check'):
check_latest_version() # Add version check before showing menu