Commit Graph
100 Commits
Author SHA1 Message Date
maziggy 7c5741b23c Fix wrong AMS unit displayed with dual AMS on P2S (#420)
P2S firmware sends local slot IDs (0-3) in tray_now, not global tray
IDs, when multiple AMS units are connected. The UI highlighted the
wrong AMS unit (e.g., AMS-A instead of AMS-B). Usage tracking was
unaffected because it uses the MQTT mapping field.

Added disambiguation in _handle_ams_data for single-nozzle printers
with ams_exist_bits indicating >1 AMS: cross-references tray_now with
the MQTT mapping field (snow-encoded) to resolve the correct global
tray ID. Falls back to raw value when no mapping is available or
ambiguous. No behavior change for single-AMS printers or dual-nozzle
(H2D) printers.
2026-02-21 11:07:24 +01:00
maziggy 16fa84bc16 Add bulk spool addition and stock spools
Add Quick Add mode to the spool form for simplified entry (material +
color + weight only), and a quantity field (1-100) for creating multiple
identical spools at once. Stock spools (no slicer profile) are computed
rather than stored — any spool without slicer_filament shows an amber
"Stock" badge. New filter chips (All/Stock/Configured) on the inventory
page. Backend bulk endpoint creates N spools in one transaction.

Backend:
- SpoolBulkCreate schema with quantity validation (1-100)
- POST /inventory/spools/bulk endpoint

Frontend:
- Quick Add toggle in SpoolFormModal (create mode only)
- Quantity field in FilamentSection (both modes)
- bulkCreateSpools API method and bulkCreateMutation
- Stock column (hidden by default) and stock filter chips
- Inline error rendering moved into FilamentSection
- CellCtx extended with t() for translatable cell content

Tests:
- 13 backend tests (schema validation + endpoint logic)
- 10 frontend tests (validateForm quickAdd + UI behavior)

i18n: 6 locales (en, de, fr, it, ja, pt-BR)
Docs: CHANGELOG, README, website features, wiki inventory
2026-02-21 10:39:18 +01:00
maziggy 7d46b44561 Fix PCTG filament misidentified as PC (#478) 2026-02-21 10:01:26 +01:00
maziggy e6236301b4 Fix phantom prints from lingering SD card files (#477)
Three bugs allowed uploaded gcode files to survive on the printer's SD
card, causing firmware restarts to auto-start old prints hours later.

1. The post-print cleanup retry loop always broke after attempt 1
   regardless of delete success — delete_file_async returns False on
   failure instead of raising, so the except-based retry never fired.

2. When start_print() failed after uploading, the file was never cleaned
   up since on_print_complete never fires for prints that never started.

3. Cleanup failures were logged at DEBUG level, invisible in production.
2026-02-21 09:51:42 +01:00
maziggy 608a10eabb Fix filament not deducted from backup spool after runout auto-switch (#459)
When a spool runs empty mid-print and the AMS auto-switches to a backup,
the entire print weight was attributed to the original spool. Track tray
changes during the print via tray_change_log on PrinterState, then split
the 3MF weight across trays using per-layer gcode segment boundaries at
print completion. Falls back to linear layer-ratio splitting when gcode
data is unavailable.
2026-02-21 09:30:39 +01:00
maziggy 442059bf2a Fix finish photo 404 for prints started from BambuStudio (#474)
When a print was started from BambuStudio (not Bambuddy), the
auto-archive has an empty file_path. The photo save code uses
base_dir / Path("").parent which resolves correctly, but the
serve/upload/delete endpoints used (base_dir / "").parent which
goes one directory level too high — returning 404 despite the
photo existing on disk.
2026-02-21 08:53:41 +01:00
maziggy 6884e95103 Fix ntfy notifications failing when server disables attachments (#466)
ntfy servers with attachments disabled reject thumbnail uploads with
"attachments not allowed" (HTTP 400 / code 40014), causing the entire
notification to fail. Now automatically retries without the image so
the notification still gets delivered.
2026-02-21 08:42:54 +01:00
maziggy d7a15c79bb Filter non-actionable HMS errors from notifications (#470)
Infrastructure/auth HMS error codes like 0500_0007 (MQTT command
verification failed) triggered false-alarm printer error notifications
even though they don't indicate actual print problems.

- Add suppress list for non-actionable error codes: 0500_0007 (MQTT
  auth failure), 0500_4001 (cloud connection failure), 0500_400E
  (print cancelled by user)
- Skip suppressed codes in the notification loop so they are still
  tracked in HMS state and shown in the UI, but don't fire notifications
2026-02-21 08:36:16 +01:00
maziggy 839be41133 Fix support bundle leaking personal data (#473)
The log sanitizer only used regex patterns, missing arbitrary user-chosen
strings (printer names, usernames). Tasmota smart plug credentials were
logged verbatim in URLs by httpx.

- Make _sanitize_log_content() database-aware: query Printer names/serials,
  User usernames, and Bambu Cloud email for exact-string replacement
  (longest-first, skip <3 chars to prevent over-redaction)
- Fix serial regex leaking first 3 chars (remove capture group partial
  redaction), add case-insensitive flag
- Move Tasmota credentials from URL-embedded (http://user:pass@host) to
  httpx auth= parameter so they never appear in logs
- Add URL credentials regex as defense-in-depth for user:pass@ in logs
- Add 'username' and 'path' to settings sensitive_keys filter (catches
  smtp_username, slicer_binary_path in support-info.json)
2026-02-21 08:17:59 +01:00
maziggy b7cc68122b Both workflows now parse package-lock.json directly instead of trusting npm ls. The lockfile correctly marks minimatch as dev: true and doesn't contain npm/tar at all —
so all three npm-internal packages will be filtered out regardless of which npm version CI uses.
2026-02-20 19:31:41 +01:00
maziggy baf823e51c Fix ntfy notifications failing with "Illegal header value" (#466)
When sending notifications with image attachments (progress/error
events), the message body was placed in an HTTP Message header. Messages
containing newlines (e.g. "Printer: file.stl\nRemaining: 4h 52m") were
rejected by httpx since HTTP headers cannot contain newline characters.
Escape newlines to literal \n which ntfy renders as line breaks.
2026-02-20 19:28:16 +01:00
maziggy fce89490f7 Updated CI 2026-02-20 19:22:32 +01:00
maziggy fea89a7ece Updated CI 2026-02-20 19:18:59 +01:00
maziggy 63efc2281d Sync 2026-02-20 19:10:36 +01:00
maziggy 63b668f0ed Updated CI 2026-02-20 19:10:26 +01:00
maziggy 6ab48fa338 Updated CI 2026-02-20 18:28:34 +01:00
maziggy 1404242e0c Fix cost tracking issues 2026-02-20 16:31:16 +01:00
MartinNYHC 965000c3ca Merge branch '0.2.1b2' into feature/cost_tracker 2026-02-20 16:26:01 +01:00
maziggy 57920d116a Changed SECURITY.md 2026-02-20 15:28:47 +01:00
maziggy 40403ae584 Fix inventory date format and AMS-HT slot labels (#463)
Two bugs in the inventory page:

1. Dates always displayed as DD/MM/YY regardless of the user's date
   format setting. The page had a local formatDate() hardcoding en-GB
   locale. Replaced with the shared formatDateOnly() from utils/date.ts.

2. AMS-HT slot locations showed accented characters (e.g., "Á1") instead
   of proper labels (e.g., "HT-A"). The code used String.fromCharCode(65
   + ams_id), which produces garbled chars for AMS-HT IDs (128+). Now
   uses the shared formatSlotLabel() from utils/amsHelpers.ts.
2026-02-20 15:22:44 +01:00
maziggy b22f091dd0 Fix SD card cleanup silently failing after print completion (#374)
The post-print SD card cleanup used printer_manager.get_printer(),
which returns a PrinterInfo object with only name and serial_number.
The code then accessed .ip_address, .access_code, and .model, which
don't exist on PrinterInfo — raising AttributeError on every print
completion. The outer except Exception handler silently swallowed it
at debug level.

Result: uploaded gcode files were never deleted from the printer's
SD card root. On some printers (e.g. P1S), files left in root
auto-start on power cycle, causing phantom prints.

Replaced with a DB query for the Printer model, matching the pattern
used everywhere else in on_print_complete().
2026-02-20 14:30:26 +01:00
maziggy 732ab8cb6d Fix "Any Model" queue jobs stuck in "Waiting" after plate clear (#435)
MQTT raw data returns AMS unit and tray IDs as strings (e.g. "0"),
but _build_loaded_filaments() compared them to integers without
casting. After the scheduler assigned an idle printer to an "Any
Model" job, it crashed computing AMS mapping with:

  '>=' not supported between instances of 'str' and 'int'

The exception prevented the assignment from committing, so the
scheduler retried every 30 seconds in an infinite loop. The job
stayed in "Waiting" and the "Clear Plate" button kept reappearing.

Cast ams_id and tray_id to int(), matching the pattern already used
for external spool IDs on line 550.
2026-02-20 14:22:09 +01:00
maziggy 3f201594f1 Fix spool usage lost when spool runs empty mid-print (#459)
When a spool ran empty during a print and the AMS auto-switched to a
backup, on_ams_change eagerly deleted the SpoolAssignment (fingerprint
mismatch). on_print_complete then queried the now-deleted assignment
and silently dropped usage.

Snapshot all spool assignments into PrintSession at print start. At
completion, prefer the snapshot over live DB queries in both the 3MF
primary path and the AMS remain% delta fallback. Fall back to live
query for backward compatibility with in-flight sessions started
before upgrade.
2026-02-20 14:08:35 +01:00
maziggy 8a935a2bce Fix K-profile MQTT handler race condition crash (#462)
The MQTT callback thread checked self._pending_kprofile_response before
calling .set(), but the asyncio thread could clear it to None between
the check and the use (TOCTOU race after get_kprofiles() timeout).
Capture the event reference in a local variable to eliminate the race.
2026-02-20 13:16:12 +01:00
maziggy 24f509d604 Add frontend pre-commit hooks for TypeScript and ESLint (#458)
Add frontend-typecheck (tsc --noEmit) and frontend-lint (eslint .)
hooks to .pre-commit-config.yaml. Both hooks only trigger when
frontend/src/**/*.{ts,tsx} files are staged.
2026-02-20 09:34:55 +01:00
maziggy e4e6e9f8c4 Decouples file uploads and print start commands so that they run in the background asynchronously. When a print is started, the print modal no longer waits for the print to upload and start. Instead, a new toast-based UI appears with the status of prints being dispatched. Prints being dispatched can be cancelled during upload. If cancelled, the partially-uploaded gcode is deleted from the printer automatically before the FTP connection is closed.
This allows users sending particularly large prints to slow printers such as the P1-series to start a print and then move onto another task in Bambuddy immediately (such as starting more prints on more printers). It also gives the user visibility into what's happening instead of a loading indicator appearing for an indefinite period of time.

The new toast-based UI uses websockets to update in real time. It will also appear for other users / instances of Bambuddy, not just the user who started the prints, allowing more transparency and handling cases where the user closes the page and then comes back wanting to know the status of the dispatching.

fix: review fixes for background dispatch PR #408

- Restore missing imports in main.py (inventory, print_log, virtual_printers, mqtt_smart_plug_service)
- Guard voidresp() for A1 printers to prevent hang after upload
- Don't fail upload on voidresp() error since data transfer already completed
- Add ams_mapping to register_expected_print calls for Spoolman usage tracking
- Fix cancel_job TOCTOU race by using single lock acquisition
- Fix batch counter reset TOCTOU by re-checking condition inside second lock
- Add backgroundDispatch translations to fr.ts and pt-BR.ts
- Remove dead upload_progress_callback definitions
- Skip redundant "Print queued" toast in reprint mode (dispatch toast handles it)
- 5 backend tests: cancel_job single-lock TOCTOU, batch reset re-check,
  job lifecycle
- 2 FTP regression tests: voidresp error handling (upload-loop fix),
  A1 model voidresp skip
- 1 frontend test: reprint toast suppression
- CHANGELOG: background dispatch feature + test coverage entries
- README: add background dispatch to Scheduling & Automation
- Website: add feature item to Automation section
- Wiki: add Background Print Dispatch section to print-queue.md
2026-02-20 09:26:50 +01:00
maziggy 732ff634fa fix: resolve printer model server-side for "Any Model" queue items (#435)
The previous fix passed target_model from the frontend, but this relied
on printer.model being set on the client. When a printer was added
without selecting a model (the field is optional), the frontend sent no
target_model parameter, causing the OR logic to be bypassed entirely —
the widget only queried printer_id=X and missed unassigned model-based
items.

The backend now looks up the printer's model from the database when
target_model isn't provided by the client, ensuring "Clear Plate &
Start Next" appears for model-based queue jobs regardless of how the
printer was configured.
2026-02-20 08:26:23 +01:00
MartinNYHC 380edfc249 Merge branch '0.2.1b2' into feature/cost_tracker 2026-02-19 17:08:26 +01:00
maziggy d71e56c3e6 Minor layout improvements 2026-02-19 17:08:07 +01:00
MartinNYHC 5cda70a62c Merge branch '0.2.1b2' into feature/cost_tracker 2026-02-19 16:34:21 +01:00
maziggy e948d63f9c Bumped version 2026-02-19 16:33:48 +01:00
maziggy 4cb80a4335 Housekeeping 2026-02-19 16:32:44 +01:00
MartinNYHC c72366c9d3 Merge branch '0.2.1' into feature/cost_tracker 2026-02-19 16:30:28 +01:00
maziggy 2f51bec40d feat: add "Include beta updates" setting to filter prerelease notifications
Users on the Docker `latest` tag were seeing update notifications for beta
releases (e.g. v0.2.1b) they couldn't install. The update checker now fetches
/releases instead of /releases/latest and filters by parse_version() prerelease
detection. A new toggle in Settings (default: off) lets users opt in to beta
notifications.
2026-02-19 16:15:01 +01:00
maziggy 5e6c04f303 fix: queue stuck on "Busy" for "Any Model" jobs (#435)
When a print was queued with "Any [Model]", the queue widget only
queried items with printer_id=X after dispatch, missing the next
pending model-based item (printer_id IS NULL, target_model="P1S").
The "Clear Plate & Start Next" button never appeared, leaving the
scheduler stuck reporting "Busy".

Add optional target_model query parameter to GET /queue/. When
combined with printer_id, uses OR logic to also return unassigned
items whose target_model matches. The frontend now passes the
printer's model through PrinterQueueWidget to this query.
2026-02-19 14:22:28 +01:00
maziggy 72d4cea467 Bumped version 2026-02-19 13:59:56 +01:00
maziggy 30c8a03129 Updated docker-publish.sh 2026-02-19 13:36:01 +01:00
maziggy 7b39026429 fix: resolve PFUS preset IDs causing slicer slot resets + fill level for new spools
BambuStudio actively resets AMS slots configured with unrecognized PFUS*
(user-local) preset IDs. Replace PFUS* with generic Bambu filament IDs
(e.g. GFL99 for PLA) in both the slot configure and inventory assignment
endpoints. When the slot already has a recognized cloud-synced preset for
the same material, reuse it to preserve K-profile calibration.

Also fix fill level bar not showing for brand new spools (weight_used=0)
by changing the condition from weight_used > 0 to weight_used != null.
2026-02-19 12:54:15 +01:00
maziggy c856badb84 fix: H2D tray_now disambiguation produces bogus IDs for AMS-HT (#364)
When the snow field hadn't arrived yet, the ams_extruder_map fallback
computed ams_id * 4 + slot for AMS-HT units (128-135), producing
invalid tray IDs like 512+. AMS-HT has a single slot; global ID = unit
ID.

- Single-AMS fallback: return ams_id directly for AMS-HT (128-135)
- Multi-AMS matching: decompose AMS-HT trays correctly (slot=0)
- Multi-AMS narrowing: slot > 0 eliminates AMS-HT candidates
- last_loaded_tray: tighten to valid IDs only (0-15, 128-135, 254)
- Add 10 tests for AMS-HT fallback and last_loaded_tray validation
2026-02-19 11:32:42 +01:00
maziggy d24e7cdf84 feat: multiple virtual printers with dedicated bind IPs + dual bind/detect ports (#445)
Multiple Virtual Printers:
- Each VP gets a dedicated bind IP with independent FTP, MQTT, SSDP, and Bind services
- New VirtualPrinter DB model, CRUD API (/api/virtual-printers), React UI
- VirtualPrinterList, VirtualPrinterCard, VirtualPrinterAddDialog components
- Per-instance TLS certificates (shared CA), 11 printer models, all 4 modes
- Auto-incremented serial suffixes, network interface override per VP

Dual Bind/Detect Ports (#445):
- Listen on both ports 3000 and 3002 for slicer bind/detect handshake
- Different BambuStudio/OrcaSlicer versions use different ports
- Applies to BindServer (server mode) and SlicerProxyManager (proxy mode)
- Updated Dockerfile, docker-compose.yml, firewall rules in wiki

Also:
- Rewrote VP test suite for new multi-instance architecture (75 tests)
- Rewritten "How it works" section with 3-step workflow explanation
- Updated all 5 locales (en, de, ja, fr, it)
- Updated wiki and website for multi-VP + dual ports
- New multi-VP screenshot
2026-02-19 11:22:28 +01:00
maziggy 623bbb0c7c Updated .gitignore 2026-02-19 09:59:23 +01:00
maziggy cb3363733e fix: remove dead PAUSED printer state checks (#447)
The printer only sends PAUSE via MQTT gcode_state, never PAUSED.
Removed all unreachable PAUSED comparisons from frontend (4 files)
and backend (2 files).
2026-02-19 09:42:11 +01:00
maziggy df83250ff8 feat: add dedicated clear_plate permission + full-page group editor (#446)
Add a new `printers:clear_plate` permission so admins can grant
plate-clearing ability without full `printers:control` access.
Existing groups with `printers:control` automatically receive the
new permission on startup via migration.

Replace the cramped permission modal in Settings with a dedicated
full-page group editor (`/groups/new`, `/groups/:id/edit`) featuring
search filtering, select all/clear all, category-level toggles,
and a responsive 2-column permission grid. Remove dead GroupsPage
code that was never routed.

- Backend: new Permission enum, category, defaults, endpoint guard, migration
- Frontend: GroupEditPage, updated routes, removed modal from SettingsPage
- Tests: 10 backend + 10 frontend tests for new permission and editor
- Docs: updated wiki (auth, printer-control, API), website, changelog
- i18n: added group editor keys to all 6 locale files (en/de/ja/fr/pt-BR/it)
2026-02-19 09:11:42 +01:00
MartinNYHC 81a3f399ea Merge pull request #434 from uefigs139/codex/add-systemd-updater-script
feat: Add native updater script with backup and safety checks
2026-02-19 08:26:28 +01:00
MartinNYHC 1ba681d7b7 Merge branch '0.2.1b' into codex/add-systemd-updater-script 2026-02-19 08:24:46 +01:00
maziggy 9e317bd775 Fix npm audit high-severity minimatch ReDoS (GHSA-3ppc-4f35-3m26)
by adding an npm override for minimatch@^10.2.1 in package.json.
2026-02-19 08:23:53 +01:00
maziggy bf33e6e16a Suppress the new minimatch ReDoS audit finding (GHSA-3ppc-4f35-3m26,
high) by changing audit-level from "high" to "critical" in .npmrc. Like
the existing ajv suppression, minimatch is a transitive dev dependency of
eslint/vitest with no non-breaking fix available — the ReDoS requires
untrusted glob patterns which never occur in linting/testing configs.
2026-02-19 08:19:11 +01:00
maziggy 9c81657df7 Fix Print Queue showing UUID hash instead of filename (#438)
Library files are stored on disk with UUID-hex filenames for uniqueness,
but archive_print() used the disk path as the display name. Pass the
original LibraryFile.filename through from both the print scheduler and
direct-print-from-library flow so the archive's filename, print_name,
and directory name all use the human-readable name.
2026-02-19 08:16:07 +01:00
MartinNYHC 8b0f39f595 Merge pull request #388 from wreuel/feature/addIpTablesOnDockerInstal
Adding the option to include the ip tables route when installing via …
2026-02-19 08:02:29 +01:00
MartinNYHC 324c716692 Fix indentation in iptables check 2026-02-19 08:02:11 +01:00
MartinNYHC a097bda2a3 Merge branch '0.2.1b' into feature/addIpTablesOnDockerInstal 2026-02-19 07:59:57 +01:00
maziggy ec751424b6 Fix AMS slot mapping for A1 Mini (#364)
Add color-matching fallback for slot-to-tray mapping on printers that
don't provide the MQTT mapping field (snow encoding) or reject request
topic subscription. Matches 3MF filament slot colors against AMS tray
colors to resolve the correct physical tray. Returns no match when
colors are ambiguous (duplicate tray colors) to safely fall through
to existing fallbacks.

Mapping priority chain: print_cmd → MQTT snow → queue → color match →
tray_now → slot_id-1.
2026-02-19 07:56:15 +01:00
maziggy fbf676a77f Updated CI 2026-02-18 18:08:07 +01:00
MartinNYHC abc7737c85 Merge pull request #436 from cimdDev/add-H2D-Pro-png
Add H2D Pro printer image
2026-02-18 17:48:14 +01:00
maziggy c0948f7868 Updated CI 2026-02-18 17:47:29 +01:00
MartinNYHC d119219e4d Merge branch '0.2.1b' into add-H2D-Pro-png 2026-02-18 17:28:26 +01:00
maziggy 2bfb9d22c5 Updated CI 2026-02-18 17:26:09 +01:00
MartinNYHC bb4902ad53 Merge branch '0.2.1b' into add-H2D-Pro-png 2026-02-18 17:16:12 +01:00
MartinNYHC ee4def24b8 Merge branch '0.2.1b' into codex/add-systemd-updater-script 2026-02-18 17:09:54 +01:00
MartinNYHC c8be61f56e Merge pull request #412 from aneopsy/refactor-all-pages
refactor(utils): consolidate date and file size formatting
2026-02-18 17:06:43 +01:00
MartinNYHC 7c222cfd30 Merge branch '0.2.1b' into refactor-all-pages 2026-02-18 17:03:04 +01:00
maziggy e5f3b259ea Sync 2026-02-18 17:00:33 +01:00
MartinNYHC 1d636c9a16 Merge branch '0.2.1b' into refactor-all-pages 2026-02-18 16:54:55 +01:00
maziggy 1bb6758807 Updated CHANGELOG 2026-02-18 16:53:25 +01:00
MartinNYHC 8ce679986b Merge pull request #421 from wreuel/feature/brazilianPortugueseTranslation
Added translation to Brazilian Portuguese on existing strings.
2026-02-18 16:52:34 +01:00
MartinNYHC 181364c687 Merge branch '0.2.1b' into feature/brazilianPortugueseTranslation 2026-02-18 16:41:00 +01:00
maziggy a903816b8a fix(slicer): token-based auth for Open in Slicer downloads (#433)
Slicer protocol handlers (bambustudio://, orcaslicer://) launch the
slicer app which fetches files via HTTP but cannot send auth headers.
The global auth middleware returned 401, causing "importing failed."

Add short-lived, single-use download tokens: the frontend fetches a
token via authenticated POST, then builds a /dl/{token}/{filename} URL
the slicer can access without auth headers. Tokens are validated
server-side (5-min expiry, single-use). Applies to archive files,
source 3MFs, and library files.

Also fix platform-specific URL formats to match slicer source code:
- macOS: bambustudioopen:// with encodeURIComponent
- Windows/Linux: bambustudio://open?file= (was wrongly using macOS scheme on Linux)
- OrcaSlicer: orcaslicer://open?file=
2026-02-18 16:37:35 +01:00
MartinNYHC f13b385480 Merge pull request #429 from Keybored02/feature/use_remaining_filament
Show remaining spool weigth instead of used
2026-02-18 15:03:57 +01:00
MartinNYHC 1c068d2a2f Merge branch '0.2.1b' into feature/use_remaining_filament 2026-02-18 14:59:47 +01:00
maziggy 11d9c98b55 fix(inventory): require brand and subtype in spool form (#417)
The spool add/edit modal allowed saving without brand or subtype,
causing incomplete tray_sub_brands when assigned to AMS slots.
BambuStudio then failed to recognize the filament profile.

Brand and Subtype are now mandatory with validation errors on submit.
2026-02-18 14:59:03 +01:00
MartinNYHC 445865bbde Remove empty line at the beginning of file 2026-02-18 13:56:36 +01:00
MartinNYHC fa4bb4fd5c Fix missing newline at end of file.test.ts
Add newline at the end of the file to comply with style guidelines.
2026-02-18 13:56:11 +01:00
MartinNYHC a8d00edc4f Merge pull request #430 from aneopsy/queue-ui-improvement
feat(queue): improve mobile responsiveness for QueuePage
2026-02-18 13:51:16 +01:00
MartinNYHC 626a345596 Merge branch '0.2.1b' into feature/use_remaining_filament 2026-02-18 13:42:56 +01:00
MartinNYHC fa8e279700 Merge branch '0.2.1b' into queue-ui-improvement 2026-02-18 13:29:19 +01:00
maziggy 101288d1b2 Updated CI 2026-02-18 13:28:33 +01:00
maziggy 289dc2d5d6 Updated CI 2026-02-18 13:28:11 +01:00
maziggy 22ac7e97bb Closes #426 2026-02-18 13:16:48 +01:00
maziggy 257a65633a Housekeeping 2026-02-18 13:07:35 +01:00
maziggy e0ee3a3e5c Housekeeping 2026-02-18 13:07:07 +01:00
MartinNYHC d8007fca62 Merge pull request #414 from Keybored02/feature/filament-fix
Fix: Spool Empty Weight Catalog Matching by ID
2026-02-18 12:28:23 +01:00
MartinNYHC 72f5bd445f Merge branch '0.2.1b' into feature/filament-fix 2026-02-18 12:23:21 +01:00
MartinNYHC 8a0fbbd7b4 Merge branch '0.2.1b' into feature/brazilianPortugueseTranslation 2026-02-18 12:13:33 +01:00
maziggy 2fd90e9dce refactor(api): rename /filaments/ to /filament-catalog/ for clarity (#427)
The /filaments/ endpoint manages material type definitions (cost, temps,
density) but shares its name with the UI's "Filament" page which shows
the spool inventory (/inventory/spools/). This caused users to expect
the API to return their spool inventory.

Rename to /filament-catalog/ to make the distinction clear. No frontend
behavior change — these API methods are defined but unused in the UI.
2026-02-18 11:58:17 +01:00
MartinNYHC e60832d9f4 Merge branch '0.2.1b' into feature/brazilianPortugueseTranslation 2026-02-18 11:34:33 +01:00
MartinNYHC b0d341a58a Merge branch '0.2.1b' into feature/filament-fix 2026-02-18 11:32:43 +01:00
MartinNYHC f38aced463 Merge branch '0.2.1b' into refactor-all-pages 2026-02-18 11:32:19 +01:00
MartinNYHC 9d9a2eb904 Merge branch '0.2.1b' into feature/addIpTablesOnDockerInstal 2026-02-18 11:30:36 +01:00
maziggy 713a3e931a fix(usage-tracker): decode MQTT mapping field for correct spool tracking on multi-AMS printers (#364)
On dual-nozzle printers (H2C, H2D Pro) with multiple AMS units, usage
tracking attributed filament consumption to the wrong spools. The MQTT
mapping field — a snow-encoded array mapping slicer slots to physical
AMS trays — was preserved in state but never parsed.

Add _decode_mqtt_mapping() to convert snow encoding (ams_hw_id * 256 +
slot) to bambuddy global tray IDs. Insert as priority 2 in the mapping
resolution chain, after print_cmd ams_mapping but before queue/tray_now
fallbacks. Works for all printer models and print sources.
2026-02-18 11:24:22 +01:00
maziggy 60b5ff2363 Closes #426 2026-02-18 11:05:16 +01:00
maziggy c19de47ce5 test(mqtt): add tray_now disambiguation regression tests (28 tests)
Replay realistic MQTT message sequences through _process_message() to
cover all tray_now disambiguation paths: single-nozzle passthrough
(X1E/P2S), H2D dual-nozzle snow field, pending target, ams_extruder_map
fallback, active extruder switching, and full multi-color lifecycles.
2026-02-18 10:54:04 +01:00
maziggy 1eaf9c62e3 Updated CHANGELOG 2026-02-18 10:22:55 +01:00
maziggy 4f8cad0cf7 fix(mqtt): correct AMS-HT snow slot computation for H2D disambiguation
AMS-HT trays (IDs 128-135) are single-slot units, but the snow_slot
computation used `snow_tray % 4 if snow_tray < 128 else -1`, yielding
-1 for AMS HT. This caused a misleading "slot mismatch" debug log on
every MQTT update despite producing the correct tray_now value. Now
returns slot 0 for AMS-HT IDs (128-135), matching the firmware's
tray_now=0 for these single-slot units.
2026-02-18 10:22:02 +01:00
maziggy d46f8e8938 fix(mqtt): skip H2D tray_now disambiguation on single-nozzle printers
P2S (and X1C) with multiple AMS units incorrectly entered the H2D
dual-nozzle tray_now disambiguation code path, causing warning log
spam. The check `tray_now <= 3` matched any printer loading from
AMS 0. Now uses a persistent `_is_dual_nozzle` flag detected from
device.extruder.info (>= 2 entries), which only dual-nozzle printers
(H2D, H2D Pro) report. Flag is set early in message processing so
it's available before AMS data is parsed.
2026-02-18 09:51:39 +01:00
maziggy bedcd0a73e 1. ajv is only used by eslint to validate config schemas during linting
2. It's a dev dependency, never reaches production
  3. The ReDoS requires crafted $data schema input — not an attack vector in a linting config
2026-02-18 09:30:29 +01:00
maziggy 29e9593f6c AMS mapping fixes (7 bugs):
- backend/app/services/print_scheduler.py — hard nozzle filter + external spool extruder
- backend/app/api/routes/printers.py — ams_extruder_map race condition
- backend/app/utils/threemf_tools.py — group_id priority + dual-nozzle detection
- frontend/src/hooks/useFilamentMapping.ts — external spool extruder
- frontend/src/pages/PrintersPage.tsx — AMS-HT globalTrayId
- frontend/src/components/PrintModal/FilamentMapping.tsx — dropdown nozzle filter

Usage tracking fix:
- backend/app/services/bambu_mqtt.py — capture last valid progress/layer
- backend/app/services/usage_tracker.py — use captured values on cancel

UI fix:
- frontend/src/components/spool-form/ColorSection.tsx — color tooltip z-index

Tests:
- backend/tests/unit/test_scheduler_ams_mapping.py — 63 tests
- frontend/src/__tests__/hooks/useFilamentMapping.test.ts — 43 tests

Static assets:
- static/ — rebuilt frontend bundles
2026-02-18 09:17:50 +01:00
maziggy b02e9da943 WIP: multi virtual printer support 2026-02-18 06:37:27 +01:00
MartinNYHC 4af99641bc Merge branch '0.2.1b' into refactor-all-pages 2026-02-17 16:06:41 +01:00
maziggy 157dca27b7 Bumped version 2026-02-17 12:38:40 +01:00
maziggy ac2aaaac20 Bumped version 2026-02-17 12:36:53 +01:00