Merged
Conversation
This implementation adds full WebUI-based printer discovery, connection, and management capabilities, bridging the gap that previously prevented proper printer connections via CLI flags. Backend Changes: - Enhanced ConnectionEstablishmentService with timeout handling (10s), retry logic (3 attempts with exponential backoff), and improved error logging to fix CLI connection hangs - Added discovery API routes (/api/discovery/scan, /api/discovery/scan-ip, /api/discovery/status, /api/discovery/cancel) for network scanning - Added printer management routes (/api/printers/connect, /api/printers/disconnect, /api/printers/saved, /api/printers/reconnect) - Integrated services with proper error handling and validation Frontend Changes: - Created printer-discovery feature with tabbed modal interface: * Network Scan tab: Auto-discover printers on local network * Manual Entry tab: Direct IP connection with printer type selection * Saved Printers tab: Reconnect to previously connected printers - Added "Add Printer" button to header for easy access - Implemented real-time discovery status updates and spinner - Added printer card UI with connection status badges - Full support for both 5M/Pro (new API) and legacy printers Key Features: - Network-wide printer discovery with IP matching - Saved printer management (reconnect, delete) - Smart printer type detection (5M family vs legacy) - Check code validation for 5M/Pro printers - IP address change detection for saved printers - Comprehensive error handling and user feedback This resolves the issue where CLI connections would hang during handshake and enables full discovery/connection workflows from the WebUI, allowing users to discover printers, match IPs, fetch serials for authentication, and establish connections without CLI flags.
Fixes: - Added AD5X and ad5x to 5M family printer detection (was only checking for "5M" or "Pro", causing AD5X to be incorrectly identified as legacy and failing to prompt for check code) - Fixed oversized icons by constraining SVG dimensions to 16x16px for: * .add-printer-btn icons * .discovery-tab-btn icons * .btn icons - Fixed saved printer card text alignment by making .printer-info a flex column with proper spacing The AD5X is now correctly identified as a 5M family printer requiring dual API connection with check code prompt.
Changed printer type detection to exactly match the backend PrinterUtils.detectPrinterFamily() implementation: - Removed overly broad 'Pro' check that could incorrectly catch legacy "Pro" models (e.g., Guider Pro, Creator Pro) - Now only checks for '5m' and 'ad5x' (case-insensitive) - This correctly identifies: * Adventurer 5M (contains '5m') * Adventurer 5M Pro (contains '5m') * AD5X (contains 'ad5x') * AD5X Pro (contains 'ad5x') - Prevents false positives on legacy Pro models Reference: FlashForgeUI-Electron/src/utils/PrinterUtils.ts:228-266
Complete the initial porting from FlashForgeUI-Electron to create a standalone WebUI server for FlashForge 3D printers. Major changes: - Add comprehensive CLAUDE.md documentation covering architecture, build system, runtime modes, and common patterns - Implement printer detection routes with 5M family detection logic - Add mDNS printer discovery support via node-mdns-js - Refine printer discovery UI with enhanced 5M detection - Create data/printer_details.json for persistent printer storage - Remove planning documents (BLUEPRINT, CURRENT_STATUS, etc.) - Add .claude/commands/push.md for streamlined commits This represents the first functional version, though not fully tested. Multi-printer support, camera streaming, Spoolman integration, and GridStack layout customization are all in place.
GhostTypes
pushed a commit
that referenced
this pull request
Jan 24, 2026
CRITICAL BUG FIX #2: The previous commit (3910927) fixed the handler logic but introduced a new initialization order bug that broke STARTUP connections. PROBLEM: Event handlers were registered AFTER connecting to printers, causing: - connectPrinters() runs → backends emit 'backend-initialized' - NO HANDLER REGISTERED YET → events lost - Handlers registered after connection complete - Result: NO MONITORS for startup connections (--last-used, --all-saved) SOLUTION: Moved event handler registration BEFORE connecting to printers: CORRECT ORDER: 1. Initialize Spoolman tracker coordinator 2. Register event handlers (backend-initialized, connected) ← BEFORE connection 3. Connect to printers (events fire → handlers receive them) 4. Start WebUI This ensures handlers are ready when backend-initialized events fire during BOTH startup connections AND dynamic connections. VERIFIED FLOWS: ✅ Startup: --last-used → handler receives events during connectPrinters() ✅ Startup: --all-saved → handler receives events during connectPrinters() ✅ Dynamic: API /api/printers/connect → handler already registered ✅ Dynamic: API /api/printers/reconnect → handler already registered Step numbering updated to reflect new order (10, 11, 12, 13...).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.