mirror of
https://github.com/psipher/cursor-free-vip-main.git
synced 2026-02-10 09:30:22 +00:00
## 🚀 Enhanced Features Implementation This PR introduces significant improvements to the Cursor Free VIP project with enhanced configuration management, error handling, and utility systems. ### ✨ New Features #### 🔧 Enhanced Configuration Management (`enhanced_config.py`) - **Multi-format support**: INI, JSON, YAML configuration formats - **Automatic validation**: Built-in configuration validation with detailed error reporting - **Backup system**: Automatic configuration backup and restore functionality - **Platform-specific paths**: Automatic detection and management of paths for Windows, macOS, and Linux - **Type safety**: Improved type checking and error handling #### 🛡️ Enhanced Error Handling (`enhanced_error_handler.py`) - **Automatic categorization**: Intelligent error classification (Network, File System, Process, etc.) - **Severity-based logging**: Critical, High, Medium, Low severity levels - **Recovery strategies**: Automatic retry logic with exponential backoff - **Error history**: Comprehensive error tracking and resolution management - **Custom callbacks**: Registerable error handlers for specific categories #### 🛠️ Enhanced Utility System (`enhanced_utils.py`) - **Advanced path management**: Cross-platform path detection and validation - **Multi-browser support**: Automatic detection of Chrome, Firefox, Edge, Brave, Opera - **Process monitoring**: Real-time process tracking and management - **System information**: Detailed system resource monitoring - **Network connectivity**: Automated network testing and validation ### 🔧 Technical Improvements - **Type safety**: Fixed all linter errors and type annotation issues - **Code robustness**: Improved error handling and exception management - **Maintainability**: Better code organization and documentation - **Cross-platform compatibility**: Enhanced support for Windows, macOS, and Linux ### �� Files Changed - `enhanced_config.py` - New enhanced configuration management system - `enhanced_utils.py` - New enhanced utility and system management - `enhanced_error_handler.py` - New enhanced error handling system - `CHANGELOG.md` - Updated with v1.11.04 release notes ### �� Testing - All new systems have been tested on Windows, macOS, and Linux - Type checking passes with no linter errors - Backward compatibility maintained with existing functionality ### 📝 Documentation - Comprehensive inline documentation for all new features - Updated CHANGELOG with detailed feature descriptions - Follows existing code style and conventions --- **Note**: These enhancements provide a solid foundation for future development while maintaining full backward compatibility with existing functionality.
104 lines
5.7 KiB
Python
104 lines
5.7 KiB
Python
import sys
|
|
import platform
|
|
import logging
|
|
from colorama import Fore, Style, init
|
|
from typing import Optional, Dict, List, Any, Tuple, Union
|
|
|
|
# Initialize colorama
|
|
init(autoreset=True)
|
|
|
|
# Configure logging
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s - %(levelname)s - %(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S"
|
|
)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
# Current version
|
|
version = "1.9.9"
|
|
|
|
# ASCII art logo
|
|
LOGO = f"""
|
|
{Fore.CYAN}
|
|
██████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗ ███████╗██████╗ ███████╗███████╗ ██╗ ██╗██╗██████╗
|
|
██╔════╝██║ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗ ██╔════╝██╔══██╗██╔════╝██╔════╝ ██║ ██║██║██╔══██╗
|
|
██║ ██║ ██║██████╔╝███████╗██║ ██║██████╔╝ █████╗ ██████╔╝█████╗ █████╗ ██║ ██║██║██████╔╝
|
|
██║ ██║ ██║██╔══██╗╚════██║██║ ██║██╔══██╗ ██╔══╝ ██╔══██╗██╔══╝ ██╔══╝ ╚██╗ ██╔╝██║██╔═══╝
|
|
╚██████╗╚██████╔╝██║ ██║███████║╚██████╔╝██║ ██║ ██║ ██║ ██║███████╗███████╗ ╚████╔╝ ██║██║
|
|
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═══╝ ╚═╝╚═╝
|
|
{Style.RESET_ALL}"""
|
|
|
|
# Simplified logo for terminals with limited width
|
|
SIMPLIFIED_LOGO = f"""
|
|
{Fore.CYAN}
|
|
██████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗
|
|
██╔════╝██║ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗
|
|
██║ ██║ ██║██████╔╝███████╗██║ ██║██████╔╝
|
|
██║ ██║ ██║██╔══██╗╚════██║██║ ██║██╔══██╗
|
|
╚██████╗╚██████╔╝██║ ██║███████║╚██████╔╝██║ ██║
|
|
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝
|
|
{Fore.GREEN}FREE VIP {version}{Style.RESET_ALL}
|
|
{Style.RESET_ALL}"""
|
|
|
|
# Contributors info
|
|
CURSOR_CONTRIBUTORS = f"""
|
|
{Fore.CYAN}╔══════════════════════════════════════════════════════════════════╗
|
|
║ {Fore.YELLOW}CURSOR FREE VIP{Fore.CYAN} ║
|
|
╠══════════════════════════════════════════════════════════════════╣
|
|
║ {Fore.GREEN}Author:{Fore.WHITE} yeongpin {Fore.CYAN}║
|
|
║ {Fore.GREEN}GitHub:{Fore.WHITE} https://github.com/yeongpin/cursor-free-vip {Fore.CYAN}║
|
|
║ {Fore.GREEN}Version:{Fore.WHITE} {version} {Fore.CYAN}║
|
|
╚══════════════════════════════════════════════════════════════════╝{Style.RESET_ALL}
|
|
"""
|
|
|
|
def get_terminal_width() -> int:
|
|
"""Get terminal width with fallback for different platforms.
|
|
|
|
Returns:
|
|
int: Terminal width in characters
|
|
"""
|
|
try:
|
|
# Try to get terminal size using different methods based on platform
|
|
if platform.system() == "Windows":
|
|
from shutil import get_terminal_size
|
|
columns = get_terminal_size().columns
|
|
else:
|
|
import os
|
|
columns = os.get_terminal_size().columns
|
|
|
|
return columns
|
|
except Exception as e:
|
|
logger.warning(f"Failed to get terminal width: {e}")
|
|
# Default width if detection fails
|
|
return 80
|
|
|
|
def print_logo() -> None:
|
|
"""Print logo with version information based on terminal width."""
|
|
try:
|
|
# Get terminal width
|
|
terminal_width = get_terminal_width()
|
|
|
|
# Choose logo based on terminal width
|
|
if terminal_width < 100:
|
|
logo = SIMPLIFIED_LOGO
|
|
else:
|
|
logo = LOGO
|
|
|
|
# Print logo
|
|
print(logo)
|
|
|
|
# Print version info
|
|
print(f"{Fore.GREEN}Version: {version}{Style.RESET_ALL}")
|
|
print(f"{Fore.CYAN}{'═' * min(80, terminal_width)}{Style.RESET_ALL}")
|
|
|
|
except Exception as e:
|
|
logger.error(f"Error printing logo: {e}")
|
|
# Fallback to simplified version if any error occurs
|
|
print(SIMPLIFIED_LOGO)
|
|
print(f"{Fore.GREEN}Version: {version}{Style.RESET_ALL}")
|
|
|
|
if __name__ == "__main__":
|
|
print_logo()
|
|
print(CURSOR_CONTRIBUTORS)
|