Commit Graph
1847 Commits
Author SHA1 Message Date
maziggy 2db76c325b Updated README 2026-01-13 09:49:52 +01:00
maziggy b39aa492cd - Fixed chamber temperature badge on printer card for printers without chammber temperature sensor
Fix Applied:
  1. Added supports_chamber_temp() helper function that returns True only for X1/X1C/X1E, P2S, and H2 series
  2. Modified printer_state_to_dict() to filter out chamber, chamber_target, chamber_heating from temperatures for unsupported models
  3. Added model caching in PrinterManager so we can look up the model without a database query
  4. Updated all callers (main.py, websocket.py) to pass the model

  The chamber temperature widget will now simply not appear for P1S/P1P/A1/A1Mini printers since the temperatures.chamber field won't be sent to the frontend.
2026-01-12 15:15:53 +01:00
maziggy 9ae25f4c6e - Fixed bug where chamber_light state was not included in WebSocket broadcasts, so the frontend never received updates when the printer's light state actually changed (only the optimistic update would show, which could be overwritten or stay stale) 2026-01-12 09:52:49 +01:00
MartinNYHC 22dbdd7378 Merge pull request #81 from maziggy/0.1.6b7
v0.1.6b7

  ## AMS Color Mapping (#76)
  - Manual AMS slot selection in ReprintModal, AddToQueueModal, EditQueueItemModal
  - Dropdown to override auto-matched AMS slots with any loaded filament
  - Blue ring indicator distinguishes manual selections from auto-matches
  - Status indicators: green (match), yellow (type only), orange (not found)
  - Shared color utility (utils/colors.ts) with ~200 Bambu color mappings
  - Widened modals (max-w-md → max-w-lg) to fit long color names
  - Fixed AMS mapping format to match Bambu Studio exactly:
    - Use slot_id from 3MF to position tray IDs correctly
    - Fill unused slots with -1 placeholder
    - Add ams_mapping2 with detailed {ams_id, slot_id} pairs
  - Resolves "stuck at filament change" on multi-color reprints

  ## Print Options in Reprint Modal
  - Bed leveling, flow calibration, vibration calibration toggles
  - First layer inspection, timelapse toggles
  - Collapsible "Print Options" section
  - Fixed print command format for proper printer recognition
  
  ## Time Format Setting (#75)
  - New date utilities (utils/date.ts): parseUTCDate, formatDate, formatDateTime
  - Applied to 12 components: PrintersPage, ArchivesPage, QueuePage,
    ProjectDetailPage, SystemInfoPage, AMSHistoryModal, NotificationLogViewer,
    CalendarView, FilamentTrends, PrinterQueueWidget, ProfilesPage
  - Fixes archive times showing in UTC instead of local timezone

  ## Statistics Dashboard (#72)
  - Size-aware rendering passes widget size (1/4, 1/2, full) to components
  - PrintCalendar: Dynamic cell sizing via ResizeObserver, 3/6/12 months
  - SuccessRateWidget: Per-printer breakdown at larger sizes
  - TimeAccuracyWidget: Per-printer breakdown at larger sizes
  - FilamentTypesWidget: Grid layout at larger sizes
  - FailureAnalysisWidget: More failure reasons at larger sizes

  ## Firmware Update Helper
  - Check firmware versions against Bambu Lab servers for LAN-only printers
  - Orange "Update" badge on printer cards when updates available
  - Firmware modal with version info, release notes, upload progress
  - One-click upload to printer SD card via FTP with progress callback
  - Local firmware caching for faster re-uploads
  - New services: firmware_check.py, firmware_update.py
  - New routes: /api/v1/firmware/*

  ## FTP Reliability
  - Configurable retry (1-10 attempts, 1-30s delay) in Settings > General
  - Applies to: 3MF archiving, print uploads, timelapse downloads,
    reprint uploads, firmware updates
  - A1/A1 Mini SSL fix: skip SSL on data channel entirely (control encrypted)
  - X1C/P1S: SSL with session reuse on data channel (required by vsFTPd)
  - Configurable FTP timeout (10-120s, default 30s) for slow WiFi

  ## Bulk Operations
  - Bulk project assignment from multi-select toolbar (#70)
  - BatchProjectModal for assigning archives to projects
  - "Remove from project" option for bulk clearing

  ## Chamber Light Control (#67)
  - Light toggle button on printer cards (next to camera)
  - Custom ChamberLight SVG icon with on/off states
  - Backend: POST /printers/{id}/chamber-light?on=true|false
  - H2D dual chamber lights controlled together

  ## Support Bundle Feature
  - Debug logging toggle with real-time duration timer in Layout
  - /api/v1/support/bundle generates ZIP with system info and logs
  - Privacy protection: filters secrets, sanitizes paths, removes IPs/emails
  - Requires debug logging enabled before download

  ## Archive Improvements
  - List view: edit/delete buttons and context menu with full parity
  - Object count display on cards (extracted from 3MF metadata)
  - Cross-view highlighting: click calendar/project to highlight in cards
  - Context menu button (⋮) on cards and list rows

  ## Maintenance Improvements (#59)
  - wiki_url field for custom type documentation links
  - Model-specific Bambu Lab wiki URLs for system types
  - External link icon next to maintenance item names
  - Fix: deleted printer now removed from maintenance

  ## Spoolman Integration
  - Clear location when spools removed from AMS during sync
  - find_spools_by_location_prefix() to find spools at a printer
  - clear_location_for_removed_spools() clears stale locations

  ## Bug Fixes
  - Browser freeze from CameraPage WebSocket (removed duplicate connection)
  - Project card filament badges showing duplicates and raw color codes
  - Print object label positioning in skip objects modal
  - Printer hour counter not updated on backend restart
  - Virtual printer excluded from discovery
  - Print cover fetch in Docker environments
  - Critical: Archive delete safety checks prevent deleting parent dirs
v0.1.6b7
2026-01-12 09:27:49 +01:00
MartinNYHC e801799e03 Merge branch 'main' into 0.1.6b7 2026-01-12 09:21:22 +01:00
maziggy bdf9518a72 - Created shared color utility (frontend/src/utils/colors.ts):
- Moved BAMBU_HEX_COLORS mapping and getColorName()/hexToColorName() functions to a shared location
  - Exported functions for use across components

- Updated modals to use shared colors:
  - ReprintModal.tsx - removed ~100 lines of duplicate color code, now imports from utils/colors
  - AddToQueueModal.tsx - same cleanup
  - EditQueueItemModal.tsx - same cleanup

- Added AMS mapping to EditQueueItemModal:
  - Added state for showFilamentMapping, isRefreshing, manualMappings
  - Added queries for filament requirements and printer status
  - Added loadedFilaments, filamentComparison, amsMapping memos
  - Added collapsible filament mapping UI section (same as other modals)
  - Initializes manualMappings from existing item.ams_mapping
  - Submits ams_mapping when saving changes

- Backend changes:
  - Added ams_mapping field to PrintQueueItemUpdate schema
  - Updated update_queue_item route to serialize ams_mapping to JSON

- Frontend API client:
  - Added ams_mapping to PrintQueueItemUpdate interface

- Changed "Print" to "Reprint" on archive card button (ArchivesPage.tsx:690)

- Bumped service worker to v22
2026-01-12 08:38:09 +01:00
maziggy 56cfdc50a0 Additional fixes made:
- Comprehensive hex-based color mapping (~200 Bambu colors from CSV)
  - Fixed tooltips to use Bambu color lookup
  - Widened modals (max-w-md → max-w-lg)
  - Adjusted grid layout to fit long color names
  - Service worker bumped to v21

Pending changes in bambuddy repo:
  - CHANGELOG.md, README.md
  - backend/app/api/routes/print_queue.py
  - backend/tests/integration/test_print_queue_api.py
  - frontend components (ReprintModal, AddToQueueModal, EditQueueItemModal)
  - sw.js (v21)
2026-01-12 08:37:57 +01:00
maziggyandClaude Opus 4.5 ad4e4fc3a2 Add manual AMS slot selection for prints (#76)
- ReprintModal: Dropdown to override auto-matched AMS slots
- AddToQueueModal: Collapsible filament mapping section
- Backend: Store ams_mapping in print queue, apply when print starts
- Color names in dropdowns (decoded from Bambu codes or derived from hex)
- Blue ring indicator for manually selected vs auto-matched slots
- Status indicators: green (match), yellow (type only), orange (not found)

Closes #76

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 08:37:47 +01:00
maziggy e2ace4f946 Bumped version to 0.1.6b7 2026-01-12 08:35:19 +01:00
maziggy da2d768002 Fix time format setting not applied to UI date/time displays (#75)
- Add time format utilities to date.ts (applyTimeFormat, formatDateTime,
    formatTimeOnly, TimeFormat type)
  - PrintersPage: Pass timeFormat to formatETA for printer card ETA display
  - ArchivesPage: Add timeFormat prop to ArchiveCard for archive timestamps
  - AMSHistoryModal: Apply timeFormat to chart labels, axis ticks, and tooltip
  - ProjectDetailPage: Use formatDateTime for timeline dates
  - QueuePage: Pass timeFormat to formatRelativeTime for scheduled prints
  - SystemInfoPage: Use formatDateTime for boot time display
  - NotificationLogViewer: Apply timeFormat to notification timestamps
  - Bump service worker cache version to v17

Closes #75
2026-01-11 13:49:03 +01:00
maziggy f7f4d88222 Improve Statistics dashboard widgets to utilize space when expanded (#72)
- Add size-aware rendering to Dashboard component, passing widget size
    (1/4, 1/2, full) to component render functions
  - PrintCalendar: Dynamic cell sizing using ResizeObserver to fill
    available width, shows 3/6/12 months based on widget size
  - SuccessRateWidget: Per-printer breakdown at larger sizes
  - TimeAccuracyWidget: Per-printer breakdown at larger sizes
  - FilamentTypesWidget: Grid layout at larger sizes
  - FailureAnalysisWidget: More failure reasons at larger sizes
  - Bump service worker cache version
2026-01-11 10:13:09 +01:00
maziggy b1653acc71 Add bulk project assignment to multi-select toolbar
- New BatchProjectModal component for assigning archives to projects
  - "Project" button in selection toolbar (next to Tags)
  - Select a project to assign all selected archives at once
  - "Remove from project" option to clear assignments in bulk
  - Proper query invalidation for Projects page and Project Detail page

Closes #70
2026-01-11 09:05:30 +01:00
maziggy 6f6df1e339 Add chamber light control to printer card
- Add light toggle button next to camera button at bottom of card
  - Custom ChamberLight SVG icon with on/off states (yellow fill + rays when on)
  - Backend endpoint: POST /printers/{id}/chamber-light?on=true|false
  - Optimistic UI update for instant feedback
  - Works on all Bambu Lab printers (X1, P1, A1, H2D)
  - H2D dual chamber lights controlled together

Closes #67
2026-01-11 08:47:13 +01:00
MartinNYHC f14ca7bb12 Merge pull request #74 from maziggy/fix/ci-all-tests
Run all backend tests in CI (unit + integration)
2026-01-11 08:09:31 +01:00
maziggy 8abfaa391a Rename Docker Test job back to Docker Build for branch protection 2026-01-11 07:59:19 +01:00
maziggyandClaude Opus 4.5 02dbc5a84f Add full Docker test suite to CI (matches test_docker.sh)
- Test 1: Build production image, verify imports & static files
- Test 2: Backend unit tests in Docker container
- Test 3: Frontend unit tests in Docker container
- Test 4: Integration tests (health, API, static files)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:53:03 +01:00
maziggyandClaude Opus 4.5 c665c3e6a3 Add Docker integration tests to CI
Match test_docker.sh workflow:
- Build Docker image
- Verify backend imports
- Verify static files exist
- Test health endpoint
- Test API endpoint
- Test static files served

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:47:21 +01:00
maziggyandClaude Opus 4.5 11482dd4d3 Run all backend tests in CI (unit + integration)
Previously only ran tests/unit/, now runs tests/ to match
test_backend.sh workflow (513 tests instead of 239).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:45:12 +01:00
maziggyandClaude Opus 4.5 fa7296389b Run all backend tests in CI (unit + integration)
Previously only ran tests/unit/, now runs tests/ to match
test_backend.sh workflow (513 tests instead of 239).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:44:55 +01:00
MartinNYHC 5007c77604 Merge pull request #73 from VREmma/fix/a1p1_file_upload
Updated A1/A1mini/P1S Upload fix
2026-01-11 07:40:44 +01:00
maziggyandClaude Opus 4.5 d1d4152551 Fix backend code formatting for CI
- Update ruff pre-commit hook to v0.14.11
- Apply ruff format to pass CI checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:30:22 +01:00
maziggyandClaude Opus 4.5 db0fc0f19b Fix backend code formatting for CI
- Update ruff pre-commit hook to v0.14.11
- Apply ruff format to pass CI checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:29:26 +01:00
maziggy 169f2aaf08 Updated linter 2026-01-11 07:23:37 +01:00
maziggy fdac28e472 Updated linter 2026-01-11 07:19:45 +01:00
maziggy b95d0113ac Updated linter 2026-01-11 07:19:24 +01:00
maziggy 1a5d867e14 Enabled Github CI 2026-01-11 07:06:32 +01:00
maziggy 6acc4a8713 Enabled Github CI 2026-01-11 07:05:35 +01:00
VREmma 9969005f6c Updated A1/A1mini/P1S Upload fix 2026-01-10 19:44:17 -06:00
maziggy 013f801e6b Fix project card filament badges showing duplicates and raw color codes
Multi-color prints store comma-separated values in filament_color (e.g.,
"#FFFFFF,#43403D") and filament_type (e.g., "PLA, PLA-S"). The project
cards were displaying these raw strings instead of splitting them into
individual badges.

- Split comma-separated colors into individual color swatches
- Split comma-separated materials into individual text badges
- Deduplicate both to avoid showing "PLA" multiple times
2026-01-10 07:56:18 +01:00
maziggy 42149b90ab Issue #66 summary: Archive times showing in UTC instead of local timezone
Problem: The backend stores timestamps in UTC, but when sending them to the frontend without timezone indicators, JavaScript interprets them inconsistently. Users saw UTC times displayed directly instead of converted to their local timezone (e.g., America/New_York).

  Solution implemented:

  1. Created /frontend/src/utils/date.ts with utilities:
    - parseUTCDate(dateStr) - Parses backend timestamps as UTC by appending 'Z' to strings without timezone indicators
    - formatDate(dateStr, options) - Formats UTC timestamps to local date/time
    - formatDateOnly(dateStr, options) - Formats UTC timestamps to local date-only
  2. Updated 15 frontend files to use the new utilities:
    - ArchivesPage.tsx - Archive cards and list view dates
    - PrintersPage.tsx - Last print date
    - SettingsPage.tsx - API key last used date
    - QueuePage.tsx - Scheduled print times
    - ProjectDetailPage.tsx - Due dates and timeline
    - ProfilesPage.tsx - Relative time display
    - CalendarView.tsx - Calendar grouping by local date
    - NotificationLogViewer.tsx - Log timestamps
    - NotificationProviderCard.tsx - Last success date
    - AMSHistoryModal.tsx - Chart data timestamps
    - FilamentTrends.tsx - Usage data grouping
    - PrinterQueueWidget.tsx - Queue item dates
2026-01-10 07:40:44 +01:00
maziggy 82a6025eeb Fix A1/A1 Mini FTP by skipping SSL on data channel entirely
The previous fix only skipped SSL session reuse for A1 printers but
  still wrapped the data channel in SSL. VREmma's testing (issue #31)
  showed that A1 printers need the data channel to not be SSL-wrapped
  at all - they timeout waiting for transfer completion responses.

  The fix:
  - X1C/P1S: SSL with session reuse on data channel (required by vsFTPd)
  - A1/A1 Mini: No SSL on data channel (control channel remains encrypted)

  This matches VREmma's working fix (c723f25) which set ftplib._SSLSocket
  to None, but implemented properly within the ImplicitFTP_TLS class.

  Fixes #31
  Thanks VREmma!
2026-01-10 07:22:59 +01:00
maziggy 0e3e37ffc1 Fix A1/A1 Mini FTP compatibility and add configurable timeout
Resolves FTP transfer failures on A1/A1 Mini printers caused by SSL
session reuse incompatibility. Also adds configurable FTP timeout
setting for slow WiFi connections.

Changes:
  - Add SSL session reuse bypass for A1/A1 Mini printers (auto-detected)
  - Add printer_model parameter to FTP functions for model detection
  - Add configurable FTP timeout (10-120s, default 30s) in Settings
  - Update all FTP callers: archiving, reprint, timelapse, firmware upload

Technical details:
  - A1/A1 Mini printers don't support vsFTPd's SSL session reuse
  - X1C/P1S continue to use session reuse as required by their FTP server
  - ImplicitFTP_TLS now accepts skip_session_reuse flag
  - BambuFTPClient auto-detects A1/A1 Mini and sets flag accordingly
2026-01-09 09:17:02 +01:00
maziggy d8cecb0695 Add FTP retry for unreliable WiFi connections
Added configurable retry logic for all FTP operations to handle
  unreliable WiFi on P1S, X1C, and other Bambu Lab printers.

  Features:
  - Enable/disable retry in Settings > General > FTP Retry
  - Configurable retry count (1-10 attempts, default: 3)
  - Configurable retry delay (1-30 seconds, default: 2s)
  - Applies to: 3MF archiving, print uploads, timelapse downloads,
    reprint uploads, and firmware updates
2026-01-09 08:52:45 +01:00
maziggy e2b2877965 Archive improvements: list view actions, object count, cross-view highlighting
Added:
  - Archive list view: edit/delete buttons and context menu with full feature parity
  - Archive object count display on cards (extracted from 3MF metadata)
  - Cross-view archive highlighting: click in calendar/project to highlight in card view
  - Context menu button (⋮) on cards and list rows for easy access
  - Spoolman: clear location when spools are removed from AMS

  Fixed:
  - QR code endpoint 500 error (added qrcode[pil] dependency)
2026-01-09 08:24:14 +01:00
maziggy b4bc046684 Clear Spoolman location when spool is removed from AMS
Previously, when syncing to Spoolman, the location field was set to the
  printer/AMS slot but was never cleared when the spool was removed from
  the AMS.

  Now during sync, the system tracks which tray UUIDs are currently in the
  AMS and clears the location for any spools that were previously at this
  printer but are no longer present.

  Changes:
  - Add clear_location parameter to update_spool() method
  - Add find_spools_by_location_prefix() to find spools at a printer
  - Add clear_location_for_removed_spools() to clear stale locations
  - Update sync_printer_ams and sync_all_printers endpoints to clear
    locations for removed spools after syncing
2026-01-09 07:43:40 +01:00
maziggy 03f473f7ab - Browser freeze fix
CameraPage no longer receives WebSocket messages - it was creating a second WebSocket connection that would also try to process print_complete events.
- Improved stall detection:
  Now continues checking even when in error state.
  Also triggers reconnect if the stream process died (!status.active)
  Added console logging to help debug: Stream issue detected: stalled=X, active=X, reconnecting...
2026-01-08 16:48:24 +01:00
maziggy 50a5f5473b Fixed print object label positioning in skip objects modal 2026-01-08 16:42:35 +01:00
maziggy 000ef632d8 Add print options to reprint modal and fix AMS mapping for multi-color prints
Features:
  - Add print options UI to reprint modal (bed leveling, flow calibration,
    vibration calibration, first layer inspection, timelapse)
  - Collapsible "Print Options" section with toggle switches
  - Default values: bed leveling=on, vibration_cali=on, others=off

  Fixes:
  - Fix AMS mapping format to match Bambu Studio exactly
    - Use slot_id from 3MF to position tray IDs correctly
    - Fill unused slots with -1 placeholder
    - Add ams_mapping2 with detailed {ams_id, slot_id} pairs
  - Fix print command format for proper printer recognition
    - Add auto_bed_leveling, cfg, extrude_cali_flag, nozzle_offset_cali
    - Use American spelling "bed_leveling" (not British "bed_levelling")
    - Match sequence_id format from official apps
  - Prevent duplicate tray assignment in filament matching

  This resolves the "stuck at filament change" issue on multi-color reprints
  affecting X1C and other multi-AMS printer configurations.
2026-01-08 16:27:29 +01:00
maziggy 63c08c8154 Fixed critical bug.
The delete_archive() function in backend/app/services/archive.py now has these safety checks:

  1. Empty path check: Refuses to delete files if file_path is empty/whitespace
  2. Path containment check: Verifies archive_dir is inside settings.archive_dir
  3. Depth check: Ensures we're at least 1 level deep inside archive directory
  4. Logging: All security refusals are logged with SECURITY prefix
  5. Database record still deleted: Even if file deletion is refused, the orphan DB record is cleaned up

  Before the fix:
  file_path = settings.base_dir / archive.file_path  # If empty: /opt/bambuddy
  archive_dir = file_path.parent                      # = /opt
  shutil.rmtree(archive_dir)                         # DELETES /opt!
2026-01-08 14:09:49 +01:00
maziggy 508116e5b7 Fixed bug, where deleted printer was not removed from maintenance 2026-01-07 08:01:24 +01:00
maziggy 4f2a45c190 Add maintenance documentation links with model-specific wiki URLs (#59)
Features:
  - Add wiki_url field to MaintenanceType for custom type documentation links
  - Add printer_model to MaintenanceStatus for model-specific URL mapping
  - Display external link icon next to maintenance item names
  - Map system maintenance types to Bambu Lab wiki pages by printer model:
    - Lubricate Linear Rails, Clean Nozzle/Hotend, Check Belt Tension
    - Clean Carbon Rods (X1/P1 only), Clean Build Plate, Check PTFE Tube
    - HEPA/Carbon Filter, Left Nozzle Rail (H2 series)
  - Add Documentation Link input to custom type create/edit forms

  Bug fix:
  - Fix 500 error when assigning maintenance type to printer (lazy loading)

  Database:
  - Add migration for wiki_url column on maintenance_types table
2026-01-07 07:53:42 +01:00
maziggy fe1d10b705 1. Runtime tracking - Removed the 60s upper bound so restarts don't break hour counting
2. Chamber stream check - Added _active_chamber_streams check for A1/P1 printers (proactive)
3. Browser freeze - Removed immediate printerStatus invalidation on print_complete
2026-01-06 09:10:59 +01:00
maziggy c960b91f2a Fixed bug where printer's hour counter was not updated, if backend was restarted 2026-01-06 08:50:59 +01:00
maziggy a1c69dc89d Changed version to 0.1.6 2026-01-05 10:43:30 +01:00
maziggy 6794846ac0 Fixed timer issue in debug log collection 2026-01-05 10:01:51 +01:00
maziggy 50fd0c018b Add support bundle feature for issue reporting
- Add /api/v1/support/debug-logging endpoints to toggle debug log level
  - Add /api/v1/support/bundle endpoint to generate ZIP with system info and logs
  - Debug logging state persists across restarts via Settings database
  - Add debug logging indicator banner in Layout with real-time duration timer
  - Add Support & Troubleshooting section to System Information page
  - Privacy protection:
    - Filter sensitive settings (emails, keys, tokens, URLs, configs)
    - Sanitize paths to remove usernames
    - Remove hostname from collected data
    - Replace IP addresses with [IP] and emails with [EMAIL] in logs
  - Add privacy info panel explaining what data is/isn't collected
  - Require debug logging to be enabled before downloading support bundle
2026-01-05 09:54:31 +01:00
maziggy 4f2fa7685a Minor fixes 2026-01-05 08:48:58 +01:00
maziggy 59fe2a6ec7 Improved camera window stream management 2026-01-05 08:22:12 +01:00
maziggy eddee5b6e9 Improved printer card size selector 2026-01-05 08:03:13 +01:00
maziggy 19dfbf1c96 Excluded virtual printer from printer discovery 2026-01-05 07:52:39 +01:00