Commit Graph
657 Commits
Author SHA1 Message Date
maziggy 63c707b1df Add Schedule button to archive cards (Issue #208)
- Add "Schedule" button next to "Reprint" on archive cards for quick
  access to print queue functionality
- Button respects queue:create permission for restricted users
- Previously only accessible via context menu (right-click)

Closes #208
2026-02-01 09:28:02 +01:00
maziggy 9bd12df6bf Changed tests for new backup module 2026-02-01 09:18:31 +01:00
maziggy 40d285db2e Add relative path storage for library files to fix backup portability
Library files now store paths relative to base_dir instead of absolute
  paths. This ensures thumbnails and files work correctly after restoring
  a backup on a different system or with a different data directory.

  Changes:
  - Add to_relative_path() and to_absolute_path() helper functions
  - Update file upload, ZIP extraction, and STL thumbnail generation
    to store relative paths
  - Update download, thumbnail, gcode, and delete endpoints to resolve
    relative paths when accessing files
  - Add database migration to convert existing absolute paths to relative

  Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

  The code is ready for testing. After pushing to the remote host:

  1. The migration will run automatically on startup, converting any existing absolute paths
  2. New files will be stored with relative paths
  3. Thumbnails should display correctly after backup/restore
2026-02-01 08:58:28 +01:00
maziggy e1ff8f19e7 Simplify backup/restore with complete database + files ZIP approach
Replace the complex JSON-based backup system (~2000 lines) with a simple
  approach that copies the SQLite database and all data directories into a
  single ZIP file.

  Backend changes:
  - Add close_all_connections() and reinitialize_database() helpers to database.py
  - New GET /backup endpoint: creates complete ZIP with bambuddy.db and all
    data directories (archive, virtual_printer, plate_calibration, icons, projects)
  - New POST /restore endpoint: extracts ZIP, replaces database and directories,
    requires restart after restore
  - Move legacy endpoints to /backup-legacy and /restore-legacy for transition

  Frontend changes:
  - Simplify api.exportBackup() - no longer takes category parameters
  - Simplify api.importBackup() - no longer takes overwrite parameter
  - Remove BackupModal and RestoreModal components from GitHubBackupSettings
  - Add simple Download/Restore buttons with inline logic
  - Add blocking modal overlay during backup/restore operations
  - Add beforeunload handler to prevent accidental navigation
  - Show operation status messages during backup/restore

  Benefits:
  - ~100 lines vs ~2000 lines of backup/restore code
  - Complete by definition - SQLite database contains ALL data
  - No code changes needed when schema changes
  - No ID remapping required - IDs stay the same
  - Faster - file copy vs querying all tables
2026-02-01 08:35:49 +01:00
maziggy 001e328ce8 Add configurable FPS and status-only mode to streaming overlay
- Add ?fps=N parameter to control camera frame rate (1-30, default 15)
- Add ?camera=false parameter for status-only overlay without camera feed
- Increase default camera FPS from 10 to 15 across all camera views
- Add comprehensive tests for new overlay parameters

Resolves user request on Issue #164 for higher FPS and status-only option.
2026-02-01 08:15:54 +01:00
maziggy 304157133c Bumped version 2026-01-31 19:09:56 +01:00
maziggy 7d1f98e407 Missing Model Imports (Fixed):
1. ams_history - AMS sensor history table
  2. pending_upload - Virtual printer pending uploads table
  3. slot_preset - AMS slot preset mappings table

  Missing Column Migrations (Added earlier in session):
  1. print_queue.target_model - Model-based queue assignment
  2. print_queue.required_filament_types - Filament type requirements
  3. print_queue.waiting_reason - Why job is waiting
  4. printers.nozzle_count - Dual-extruder detection
  5. printers.print_hours_offset - Baseline hours adjustment
  6. notification_providers.on_queue_job_added - Queue job added notification
  7. notification_providers.on_queue_job_assigned - Queue job assigned notification
  8. notification_providers.on_queue_job_started - Queue job started notification
  9. notification_providers.on_queue_job_waiting - Queue job waiting notification
  10. notification_providers.on_queue_job_skipped - Queue job skipped notification
  11. notification_providers.on_queue_job_failed - Queue job failed notification
  12. notification_providers.on_queue_completed - Queue completed notification

  Tables verified as OK (no migrations needed):
  - api_keys - No new columns since v0.1.5
  - external_links - No new columns since v0.1.5
  - library_files/folders - New in v0.1.6, created fresh
  - github_backup_config/logs - New in v0.1.6, created fresh
  - project_bom_items - New in v0.1.6, created fresh
  - groups/user_groups - New in v0.1.6, created fresh
2026-01-31 18:15:38 +01:00
maziggyandClaude Opus 4.5 6ff394d016 Always rebuild Docker image without cache
Add --no-cache and --pull flags to ensure clean builds every time.
Remove registry cache arguments that could cause stale layers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:52:26 +01:00
maziggyandClaude Opus 4.5 0a9bca2239 Add missing migrations for printer nozzle_count and print_hours_offset
These columns were added in 0.1.6 beta but migrations were missing:
- nozzle_count: Integer DEFAULT 1 (for dual-extruder detection)
- print_hours_offset: Float DEFAULT 0.0 (baseline hours adjustment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:46:17 +01:00
maziggyandClaude Opus 4.5 7e88092d61 Add missing migration for model-based queue columns
Add migration for target_model, required_filament_types, and waiting_reason
columns in print_queue table. These columns were added to the model for the
model-based queue assignment feature but the migration was missing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:34:06 +01:00
MartinNYHC 1209e181a4 Merge pull request #203 from maziggy/0.1.6-final
v0.1.6 final
v0.1.6
2026-01-31 17:02:35 +01:00
MartinNYHC 75d6be40dc Merge branch 'main' into 0.1.6-final 2026-01-31 17:00:32 +01:00
maziggyandClaude Opus 4.5 85c180909b Break SSRF taint chain by reconstructing URLs from validated components
- Add _sanitize_camera_url() that returns reconstructed URL from
  validated and parsed components, breaking CodeQL's taint tracking
- Update _capture_mjpeg_frame, _capture_snapshot, _stream_mjpeg to
  use sanitized URLs instead of original user input
- Keep _validate_camera_url as legacy wrapper for backwards compat

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:53:37 +01:00
maziggyandClaude Opus 4.5 2960261aa9 Add SSRF mitigation for external camera URLs
Block access to cloud metadata services and dangerous destinations:
- AWS/GCP/Azure metadata endpoint (169.254.169.254)
- GCP internal metadata hostnames
- localhost and loopback addresses
- All link-local addresses (169.254.x.x)

Local network IPs (192.168.x.x, 10.x.x.x) are still allowed since
cameras are typically on the same LAN as the server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:49:12 +01:00
maziggyandClaude Opus 4.5 57e88044e9 Fix CodeQL security warnings
- Path traversal: Convert device number to integer to break taint chain,
  use strict /dev/videoN validation with range limit
- SSRF: Add documentation explaining intentional SSRF for user-configured
  external camera URLs, add lgtm suppression comments
- Info exposure: Don't expose exception messages in plate calibration
  errors, only expose error type name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:45:13 +01:00
maziggy d713577863 Fixed CodeQL errors 2026-01-31 16:35:10 +01:00
maziggy c454cad075 Housekeeping 2026-01-31 15:40:11 +01:00
MartinNYHC ec87c89d95 Merge pull request #195 from maziggy/feature/192
Add H2D Pro printer model support
2026-01-31 15:36:29 +01:00
MartinNYHC be7b3f99a2 Merge branch '0.1.6-final' into feature/192 2026-01-31 15:36:17 +01:00
maziggy 8be9bc757c @renovate baseline-browser-mapping@latest 2026-01-31 15:20:47 +01:00
MartinNYHC 600f314214 Merge pull request #201 from maziggy/feature/auth_details
Add group-based permissions system with granular access control
2026-01-31 15:15:55 +01:00
MartinNYHC 391214be79 Merge branch '0.1.6-final' into feature/auth_details 2026-01-31 15:15:39 +01:00
MartinNYHC 87e9a04197 Merge pull request #188 from maziggy/feature/164
Streaming overlay page for OBS integration (#164)
2026-01-31 15:10:39 +01:00
MartinNYHC 8a4b318dbf Merge branch '0.1.6-final' into feature/164 2026-01-31 15:10:27 +01:00
maziggy 0664c96cbf Misc merge fixes 2026-01-31 15:09:23 +01:00
maziggyandClaude Opus 4.5 d1de2a6c64 Remove unused variable in SmartPlugCard test
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:03:30 +01:00
MartinNYHC cbd0ab62c2 Merge pull request #185 from maziggy/feature/173
Add MQTT smart plug support for energy monitoring (Issue #173)
2026-01-31 15:01:22 +01:00
maziggyandClaude Opus 4.5 a965afa6cb Merge branch '0.1.6-final' into feature/173
Merged MQTT smart plug support with latest 0.1.6-final features.
Kept MQTT plug functionality (separate topics, multipliers, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:00:12 +01:00
MartinNYHC c12d8b296f Merge pull request #198 from maziggy/feature/183
Feature/183
2026-01-31 14:51:10 +01:00
MartinNYHC 402f448d83 Merge branch '0.1.6-final' into feature/183 2026-01-31 14:50:57 +01:00
MartinNYHC 0d3709ee9b Merge pull request #186 from maziggy/feature/176
Add script automation and visibility options (#176)
2026-01-31 14:44:19 +01:00
maziggyandClaude Opus 4.5 26728f268f Merge branch '0.1.6-final' into feature/176
Resolved conflicts:
- CHANGELOG.md: Kept both HA Script Support and STL Thumbnail features
- database.py: Kept both migration sets (UNIQUE constraint removal + queue columns)
- SmartPlugCard.tsx: Merged script UI support with base styling
- static/: Rebuilt frontend with merged changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 14:43:45 +01:00
maziggy 4cbcac82e3 Fixed error in scheduler 2026-01-31 14:35:36 +01:00
maziggy 196b7a93e9 Added one-shot install scripts 2026-01-31 14:31:10 +01:00
maziggy 428f54a68d Fix Home Assistant smart plug auto-on for queued prints (Issue #200)
The print scheduler was hardcoded to use Tasmota service when powering
on printers for queued prints. Home Assistant plugs were not checked,
causing "Tasmota device not found" errors.

Changes:
- Make get_service_for_plug() public in smart_plug_manager
- Update print_scheduler to use smart_plug_manager.get_service_for_plug()
  instead of tasmota_service directly
- Fixes both _power_on_and_wait() and _power_off_if_needed() methods

Closes #200
2026-01-31 12:59:45 +01:00
maziggy 89229a5ecc Add group-based permissions system with granular access control
Implement a full permissions system replacing simple admin/user roles:

Backend:
- Add Group model with many-to-many user relationship
- Add 50+ granular permissions (resource:action pattern)
- Create default groups: Administrators, Operators, Viewers
- Add permission-checking dependencies for route protection
- Add groups API endpoints (CRUD, user assignment)
- Add change password endpoint for users
- Update backup/restore to include groups
- Migrate existing users to groups on startup

Frontend:
- Add GroupsPage for managing groups and permissions
- Add permission helpers to AuthContext (hasPermission, hasAnyPermission)
- Add PermissionRoute component for protected routes
- Disable buttons/features based on permissions (with tooltips)
- Add change password modal in sidebar for all users
- Add forgot password info modal on login page
- Show user groups in UsersPage with group assignment

Testing:
- Add integration tests for groups API
- Add tests for user-group assignments
- Add tests for change password endpoint
- Seed default groups in test fixtures

Closes #28 #161
2026-01-31 12:50:15 +01:00
maziggy 29bede21b8 Mobile layout fixes 2026-01-31 09:36:36 +01:00
maziggy 42a14f024d Fix AMS mapping for model-based queue jobs (Issue #192)
When using "Any [Model]" queue assignment, the scheduler now computes
AMS mapping after a printer is assigned, instead of requiring it upfront.

This fixes H2D Pro (and other printers) failing at filament loading when
queued via model-based assignment. The issue was that no AMS mapping was
sent to the printer because the specific printer wasn't known at queue time.

Closes #192
2026-01-31 08:39:21 +01:00
maziggy 2795694e5b Add tag management feature (Issue #183)
Implement centralized tag management for print archives:
- GET /archives/tags endpoint to list all tags with usage counts
- PUT /archives/tags/{name} endpoint to rename tags across archives
- DELETE /archives/tags/{name} endpoint to delete tags from archives
- TagManagementModal component with search, sort, rename, and delete
- Gear icon button next to tag filter dropdown on Archives page
- Fix tag autocompletion in EditArchiveModal using dedicated getTags API

Closes #183
2026-01-31 08:24:06 +01:00
maziggy 4c8f0fbeeb Housekeeping 2026-01-31 07:54:55 +01:00
maziggy 140087eeb7 Make MQTT JSON path optional for smart plug monitoring (#173)
- Path is now optional for power, energy, and state topics
- When path is empty, raw MQTT payload value is used directly
- Energy and state topics no longer fall back to power topic
- Added helper text in UI explaining path is optional
- Fixes energy monitoring not working with separate topics

Closes 173
2026-01-30 17:18:22 +01:00
maziggy 25043beafa Sync 2026-01-30 16:57:58 +01:00
MartinNYHC a1064d077c Merge pull request #196 from MisterBeardy/feature/stl_thumbnail
Feature/stl thumbnail
2026-01-30 16:46:43 +01:00
maziggy ed046a062b Merge 0.1.6-final into feature/stl_thumbnail 2026-01-30 16:38:14 +01:00
maziggy 7382ee1b20 Add frontend tests for STL thumbnails, update README and CHANGELOG
- Add 9 frontend tests for STL thumbnail generation
  - Update CHANGELOG with STL thumbnail feature details
  - Update README File Manager section

  Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-30 16:27:51 +01:00
maziggy fa84835876 Improve File Manager mobile responsiveness 2026-01-30 15:59:56 +01:00
maziggy e87fe7ad87 Add H2D Pro printer model support
- Add H2D Pro option to printer model dropdowns (add/edit modals)
- Support both O1E and O2D internal codes for H2D Pro compatibility
- Add O2D to RTSP-capable and chamber temp supported models
- Add H2DPRO variant to firmware check mapping
- Add H2D Pro and X1E to bug report issue template

Closes #192
2026-01-30 15:38:52 +01:00
MisterBeardy c291e3a0a8 feat: Add STL thumbnail generation functionality
- Implemented batch STL thumbnail generation API endpoint.
- Added Pydantic schemas for batch thumbnail requests and responses.
- Created service for generating thumbnails from STL files using trimesh and matplotlib.
- Updated file upload and ZIP extraction endpoints to include thumbnail generation option.
- Enhanced frontend to support STL thumbnail generation during file uploads and ZIP extractions.
- Added integration and unit tests for the new thumbnail generation features.
- Updated requirements to include necessary libraries for STL processing.
2026-01-30 09:37:30 -05:00
maziggy 04f4dccd41 Enhanced MQTT support with separate topics and multipliers (#173)
- Add separate MQTT topics for power, energy, and state monitoring
  - mqtt_power_topic, mqtt_power_path, mqtt_power_multiplier
  - mqtt_energy_topic, mqtt_energy_path, mqtt_energy_multiplier
  - mqtt_state_topic, mqtt_state_path, mqtt_state_on_value
- Support different MQTT topics per data type (e.g., Zigbee2MQTT with
  separate power/energy/state topics)
- Individual multipliers for power and energy (e.g., mW→W, Wh→kWh)
- Configurable ON value for state monitoring (e.g., "ON", "true", "1")
- Maintain backward compatibility with legacy mqtt_topic/mqtt_multiplier
- Database migration auto-copies legacy fields to new fields
- Update backup/restore to handle new MQTT fields
- Add backend tests for new MQTT configurations
- Update frontend form with organized Power/Energy/State sections

Closes #173
2026-01-30 14:17:26 +01:00
maziggy c937e6781b Improved docker tests 2026-01-30 13:54:20 +01:00