Commit Graph
561 Commits
Author SHA1 Message Date
maziggy 180752f7e6 Updated Github workflow 2026-01-28 09:15:26 +01:00
maziggy ead2bfc822 @renovate baseline-browser-mapping@latest 2026-01-28 07:18:19 +01:00
maziggy f17c9e572b Updated the workflow:
- Changed stale-issue-label from feedback to stale (so stale issues get the "stale" label)
- Added remove-issue-labels: 'feedback' to remove the feedback label when issues are auto-closed
2026-01-28 07:13:01 +01:00
maziggy 2bc0ef122d Minor layout fixes 2026-01-27 17:15:26 +01:00
maziggy b258e14eda Minor layout fixes 2026-01-27 16:56:01 +01:00
maziggy 181a748506 Minor layout fixes 2026-01-27 16:55:05 +01:00
maziggy 80d4b63939 Add Prometheus metrics endpoint for external monitoring (#161)
Expose printer telemetry at /api/v1/metrics in Prometheus text format for
integration with Grafana, Prometheus, and other monitoring systems.

Backend:
- Add metrics.py route with GET /api/v1/metrics endpoint
- Support optional bearer token authentication
- Export printer metrics: connection, state, temperatures, fans, WiFi
- Export print metrics: progress, remaining time, layer count
- Export statistics: prints by status, filament used, print time
- Export queue metrics: pending and active jobs
- Add prometheus_enabled and prometheus_token settings

Frontend:
- Add Prometheus Metrics card in Settings → Network tab
- Toggle to enable/disable metrics endpoint
- Optional bearer token field for authentication
- Display list of available metrics

Tests:
- Add test_metrics_api.py with 7 integration tests
- Test access control (disabled, enabled, token auth)
- Test metrics format and content validation
2026-01-27 16:49:28 +01:00
maziggy 3a03cfe928 Add resizable sidebar and text wrap option to File Manager (#160)
- Add draggable resize handle to folder sidebar (200-500px range)
- Persist sidebar width in localStorage
- Double-click resize handle to reset to default width
- Add "Wrap" toggle button in Folders header for text wrapping
- When wrap enabled: folder names break across lines, menu always visible
- When wrap disabled: folder names truncate with tooltip on hover
- Persist wrap preference in localStorage

Closes #160
2026-01-27 16:13:04 +01:00
maziggy cc4dd3a0e8 Auto-control chamber light for plate detection
- Automatically turn on chamber light before plate check if it's off
- Restore light to original state after modal closes or check completes
- Add 2.5s delay for light to turn on and camera to adjust exposure
- Remove manual light warning from plate check modal
- Apply to both manual plate checks (modal) and automatic checks on print start
2026-01-27 16:00:47 +01:00
maziggy 2c761e7663 Add library file support to print queue scheduler
The print queue now supports two sources:
- archive_id: Print from existing archive (existing behavior)
- library_file_id: Print from file manager library files (NEW)

Previously, queue items from the file manager failed with "Archive not
found" because the scheduler only handled archive-based prints.

Changes:
- Add LibraryFile model import
- Update _start_print() to handle both archive and library file sources
- Handle absolute vs relative file paths correctly
- Update logging and MQTT notifications to use correct filename

Fixes GitHub issue #163
2026-01-27 15:40:27 +01:00
maziggy 14e8e512f2 Fix timezone comparison in GitHub backup scheduler
The scheduler compared timezone-aware datetime.now(UTC) with naive
datetimes from the SQLite database, causing "can't compare offset-naive
and offset-aware datetimes" error.

Fixed by adding UTC timezone to naive datetimes before comparison.
2026-01-27 15:21:32 +01:00
maziggy 84fe13dd07 Fix print queue not starting when printer state is FAILED
The print scheduler only considered IDLE, FINISH, and unknown as valid
idle states. This caused the queue to not process items when the printer
was in FAILED state (e.g., after an aborted print).

Added FAILED to the list of idle states since a failed print means the
printer is ready to accept a new print job.
2026-01-27 15:16:18 +01:00
maziggy 4ea7f7c4aa Add GitHub profile backup feature
New feature to automatically backup K-profiles, cloud profiles, and app
settings to a GitHub repository with scheduled or on-demand execution.

Features:
- Configure GitHub repo URL and Personal Access Token
- Schedule backups hourly, daily, or weekly (background scheduler)
- Manual backup trigger with real-time progress tracking
- Skip unchanged commits (only creates commit when data changes)
- Backup history log with status and commit links
- Requires Bambu Cloud login for full profile access
- New Settings → Backup & Restore tab consolidating all backup options
- GitHub backup config included in local backup/restore (except PAT)

Backend:
- New models: GitHubBackupConfig, GitHubBackupLog
- New service: GitHubBackupService with scheduler and GitHub API client
- New routes: /github-backup/* for config, status, logs, and triggers
- Updated settings.py to include github_backup in backup/restore

Frontend:
- New GitHubBackupSettings.tsx component with auto-save
- Updated SettingsPage with Backup tab and status indicator
- Added API types and methods to client.ts

Tests:
- Backend integration tests for all GitHub backup API endpoints
- Frontend API type and endpoint tests
2026-01-27 15:01:06 +01:00
maziggy ea737c4719 Updated CHANGELOG 2026-01-27 13:02:17 +01:00
maziggy 5c0b5500fb Fix backup/restore 2026-01-27 12:52:24 +01:00
maziggy b28b829bd8 Fix backup/restore 2026-01-27 12:47:43 +01:00
maziggy 945121b799 Fix plate calibration backup/restore with printer ID remapping
- Add "Plate Detection" option to backup modal
- Store printer_id_to_serial mapping in backup for calibration files
- Remap printer IDs during restore based on serial numbers so files
  like printer_3_ref_0.jpg get correctly renamed if printer 3 becomes
  printer 2 on the new system
- Add parents=True to mkdir calls in config.py to fix startup crash
- Labels/metadata are now correctly restored via the metadata.json files
2026-01-27 12:39:02 +01:00
maziggy 30f7d41ec3 Add plate calibration to backup and fix directory creation
- Add "Plate Detection" option to backup modal for exporting empty plate
  reference images (requires Printers to be selected)
- Add parents=True to mkdir calls in config.py to create full directory
  tree on first run (fixes startup crash when data dir doesn't exist)
- Update BackupModal test to use exact match for "Printers" text
2026-01-27 12:30:15 +01:00
maziggy 8f30f08559 Fix startup crash when data directory doesn't exist
Add parents=True to mkdir calls for archive_dir and plate_calibration_dir
in config.py to create the full directory tree on first run.
2026-01-27 12:12:04 +01:00
maziggy c52c505ad8 Added explicit permissions: issues: write 2026-01-27 11:24:49 +01:00
maziggy d6dcc7656d Fix auth mock in tests
Add missing /api/v1/auth/status mock to MSW handlers to prevent
network errors during frontend tests
2026-01-27 11:23:23 +01:00
maziggy cdf52a6a28 Added stale issues workflow 2026-01-27 11:14:48 +01:00
maziggy c196ae017a Fix plate detection calibration persistence
- Check cv2.imwrite() return value to catch silent failures
- Verify reference image file exists after save
- Validate file size is reasonable (>1KB) to detect corruption
- Add logging for save, rotate, and delete operations
- Use temp directory for plate calibration during tests to avoid
  deleting real user calibration files

Previously, calibration could report success even if the image file
failed to save. Additionally, running tests would delete real
calibration files because tests shared the same plate_calibration_dir.
2026-01-27 10:38:44 +01:00
maziggy db236f0aa7 Improved cv2.imwrite for build plate empty detection 2026-01-27 10:14:39 +01:00
maziggy e57fb87a52 Add queue bulk editing and fix milestone time display
New Features:
- Queue bulk edit: Select multiple pending items and edit printer
  assignment, print options, or cancel them at once (Issue #159)
- Tri-state toggles (unchanged/on/off) for selective field updates

Fixes:
- Progress milestone notifications showed wrong time (e.g., "17m" instead
  of "17h 47m") - fixed by converting remaining_time from minutes to
  seconds (Issue #157)
- File Manager folder names now show full name on hover tooltip (Issue #160)

Backend:
- Added PATCH /queue/bulk endpoint for bulk updates
- Route ordering fixed to prevent /bulk matching as /{item_id}

Frontend:
- Added checkbox selection to pending queue items
- Added bulk action toolbar with Select All, Edit Selected, Cancel Selected
- Created BulkEditModal with tri-state toggles for each setting

Tests:
- Added 7 integration tests for bulk update endpoint

Closes #159
2026-01-27 09:35:28 +01:00
maziggy 60d9505c0d Add tooltip for truncated folder names in File Manager
Long folder names are truncated to prevent layout issues. Added title
attribute so users can hover to see the full folder name.

Fixes #160
2026-01-27 09:07:18 +01:00
maziggy d0cc282d3e Allow folder names to wrap in File Manager navigation
Long folder names were truncated with ellipsis. Now they wrap onto
multiple lines and show full name on hover tooltip.

Closes #160
2026-01-27 09:04:20 +01:00
maziggy 2e03fca2df Fix progress milestone notification showing wrong time unit
The remaining_time from printer state is in minutes (from mc_remaining_time),
but _format_duration() expects seconds. This caused "17h 47m" to display as
"17m" in milestone notifications.

Closes #157
2026-01-27 08:53:48 +01:00
maziggy b9495877fc Add HMS error notifications with translations and plate detection fixes
New Features:
- HMS error notifications with human-readable messages (853 error codes)
- Plate not empty notification category (separate toggle in settings)
- Module-friendly names: Print/Task, AMS/Filament, Nozzle/Extruder, etc.
- Backup/restore now includes plate calibration reference images

Fixes:
- Plate calibration images now persist after restart in Docker
- Telegram notifications no longer fail on error codes with underscores
- Plate detection combo button: main toggles detection, chevron opens modal

Tests:
- Added HMS error code tests (10 tests)
- Implemented Dashboard, FileManagerModal, UploadModal tests (previously skipped)
- Added notification service tests for HMS errors and plate detection
- Fixed AuthContext unmount memory leak in tests
2026-01-27 08:48:57 +01:00
maziggy 9d6164ab1c Add USB camera support (V4L2)
- Add USB camera type to external camera service
- Auto-detect available V4L2 devices on Linux
- New API endpoint: GET /api/v1/printers/usb-cameras
- Use ffmpeg for USB camera capture and streaming
- Add "USB Camera (V4L2)" option in Settings UI
- Debounce camera URL input to avoid saving on every keystroke

Closes #143
2026-01-27 06:40:14 +01:00
maziggy 82be877843 Fixed CI 2026-01-26 15:52:23 +01:00
maziggy c9b3263381 Updated .gitignore 2026-01-26 15:04:15 +01:00
maziggy 274a398bbf Added missing dependency test and warning on app startup 2026-01-26 14:54:26 +01:00
maziggy afe7ddeb72 Added missing dependency test and warning on app startup 2026-01-26 14:52:46 +01:00
maziggy 2d3437f68e Added missing dependency test and warning on app startup 2026-01-26 14:49:52 +01:00
maziggy d575e060fa Added missing dependency test and warning on app startup 2026-01-26 14:46:20 +01:00
MartinNYHC 4ff9378a6b Merge pull request #158 from maziggy/feature/empty_plate_detection
Add build plate empty detection feature
2026-01-26 14:38:19 +01:00
maziggy 6b0e3e7964 Replace python-jose with PyJWT to eliminate ecdsa vulnerability 2026-01-26 13:24:15 +01:00
maziggy 4b2d8b51e0 Add security scanning to CI pipeline
- Add pip-audit check to PR workflow (non-blocking warning)
- Add npm audit check to PR workflow (non-blocking, high severity only)
- Create scheduled weekly security audit workflow that:
  - Runs strict pip-audit and npm audit
  - Creates/updates GitHub issues when vulnerabilities found
  - Uploads audit results as artifacts
  - Supports manual trigger via workflow_dispatch
2026-01-26 13:20:33 +01:00
maziggy c7458fc73f Add security scanning to CI pipeline
- Add pip-audit check to PR workflow (non-blocking warning)
- Add npm audit check to PR workflow (non-blocking warning)
- Create scheduled weekly security audit workflow that:
  - Runs strict pip-audit and npm audit
  - Creates/updates GitHub issues when vulnerabilities found
  - Uploads audit results as artifacts
  - Supports manual trigger via workflow_dispatch
2026-01-26 13:17:43 +01:00
maziggy 888891fdc6 Add build plate empty detection feature
Automatically detect if objects are on the build plate before printing
and pause the print immediately if detected.

Features:
- Per-printer toggle to enable/disable plate detection
- Multi-reference calibration: store up to 5 reference images per printer
  for different plate types (textured, smooth, high-temp, etc.)
- Automatic print pause when objects detected at print start
- Push notification and WebSocket alert when print is paused
- ROI (Region of Interest) calibration UI with sliders to adjust
  detection area
- Reference management: view thumbnails, add labels, delete references
- Works with both built-in and external cameras
- Uses buffered camera frames when stream is active (no blocking)
- Split button UI: main button opens modal, chevron toggles on/off
- Green visual indicator when plate detection is enabled
- Included in backup/restore
2026-01-26 13:04:29 +01:00
maziggy d34816e2c7 Fix progress milestone notifications not triggering (Issue #157)
The on_print_progress notification method existed but was never called.
Added milestone tracking in on_printer_status_change that:
- Tracks last notified milestone per printer
- Detects when progress crosses 25%, 50%, 75% thresholds
- Sends notification via notification_service.on_print_progress()
- Resets tracking when progress drops below 5% (new print)

Closes #157
2026-01-26 10:08:03 +01:00
maziggy bb7e8398bc Completely removed telemetry 2026-01-26 09:34:04 +01:00
maziggy d3ebbe503c Minor frontend test fixes 2026-01-26 09:22:06 +01:00
maziggy 97238644a0 Added missing database migrations 2026-01-26 09:19:28 +01:00
maziggy caf3f3ae0a Minor frontend fixes 2026-01-26 09:11:15 +01:00
maziggy 93e2f0af82 Minor frontend fixes 2026-01-26 09:09:58 +01:00
maziggy 3a3f6a1845 Settings API PATCH Method
- Added PATCH support to `/api/settings` for Home Assistant rest_command compatibility

Closes #152
2026-01-25 13:43:47 +01:00
maziggy ec3c47f048 Fix P2S empty archive tiles - add root folder to FTP search paths (Issue #146)
Printers without an SD card store files in the root folder `/` instead of
`/cache`. Added root folder to search paths in both main.py and bambu_ftp.py
so 3MF files can be found regardless of storage configuration.

Closes #146
2026-01-25 13:33:51 +01:00
maziggy 30537cfa54 Add project import/export with ZIP file support
Features:
- Export single project as ZIP containing project.json and all files
  from linked library folders
- Export all projects as JSON (metadata only) for bulk backup
- Import from ZIP (creates folders and extracts files) or JSON
- New /api/v1/projects/import/file endpoint for file uploads
- Frontend buttons on Projects page and Project Detail page
- BOM items are now fully editable (not just checkbox toggle)
2026-01-25 13:17:15 +01:00