mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-12-16 05:19:43 +01:00
Problem: VPS API keys were generated dynamically but never saved to the database, causing file fix operations to fail with "Invalid token" error. Root Cause: - When CyberPanel runs on VPS, it calls platform's /api/vps/generate-api-key/ - The returned API key was used for scan submission but not persisted - Later file fix operations couldn't validate this API key Solution: - Save VPS API key to ai_scanner_settings table whenever obtained - Modified 4 locations where VPS API key is retrieved: 1. startScan() - Save when initiating a scan 2. getPlatformMonitorUrl() - Save when checking scan status 3. addPaymentMethod() - Save when configuring payment (2 locations) Implementation: - Use get_or_create() to ensure scanner settings exist - Update existing settings if API key is empty or different - Set is_payment_configured=True for VPS accounts (implicit payment) - Continue operation even if saving fails (non-blocking) Result: - VPS API keys are automatically persisted on first use - File fixes work without manual database intervention - All AI Scanner features work seamlessly on VPS instances
48 KiB
48 KiB