diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f23bff..3cf8996 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index d815a00..0fb4a8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 | 添加繞過的多語言支持 diff --git a/config.py b/config.py index 9fb75ce..71b67a4 100644 --- a/config.py +++ b/config.py @@ -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) \ No newline at end of file diff --git a/locales/en.json b/locales/en.json index abc1f8b..4e6f1b0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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", diff --git a/locales/zh_cn.json b/locales/zh_cn.json index e448492..6167e10 100644 --- a/locales/zh_cn.json +++ b/locales/zh_cn.json @@ -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": "未找到认证按钮", diff --git a/locales/zh_tw.json b/locales/zh_tw.json index 87c2b91..43b2db8 100644 --- a/locales/zh_tw.json +++ b/locales/zh_tw.json @@ -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": "未找到認證按鈕", diff --git a/main.py b/main.py index 908a9f4..a7f4e01 100644 --- a/main.py +++ b/main.py @@ -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,7 +552,8 @@ 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 print_menu()