fix(spoolman): resolve escaped quotes issues in filament sub_type metadata#489
Open
BigMcRat wants to merge 41 commits into
Open
fix(spoolman): resolve escaped quotes issues in filament sub_type metadata#489BigMcRat wants to merge 41 commits into
BigMcRat wants to merge 41 commits into
Conversation
… RFID cards - Move filament config methods from AFC_lane to AFC_lane_spoolman - Auto-detect RFID cards and bind to Spoolman spools via lot_nr field - Support comma-delimited card_uid values in lot_nr (card_uid:XXX,card_uid:YYY) - Add SET_SPOOL_ID and REFRESH_SPOOL gcode commands per lane - Implement webhook callbacks for Spoolman proxy integration - Remove card_uid from other spools when binding to new spool
- Update afc-lite.md with comprehensive Spoolman auto-binding documentation - Document RFID card detection flow and lot_nr format - Add gcode commands reference (SET_SPOOL_ID, REFRESH_SPOOL) - Add respond_info notifications for card binding/unbinding actions - Update limitations section to reflect now-supported features
- Add automatic card_uid removal from spoolman when unbinding via SPOOL_ID=0 - Add unbind_spool_callback webhook endpoint for unbinding flow - Add gcode.respond_info notifications for bind/unbind actions - Add notification when RFID card is missing but spoolman is available - Fix SPOOL_ID parsing to handle empty string values
Adds `24_settings_tweaks_spoolman.yaml` to enable/disable Spoolman via firmware-config, prompting for the server URL on enable and validating it is a reachable Spoolman instance before writing the moonraker config. Extends firmware-config to support `inputs` on settings options: each entry defines a named form field (label, placeholder, regex) rendered in the confirm modal, validated client-side, and injected as named env vars into the option `cmd`.
… RFID cards - Move filament config methods from AFC_lane to AFC_lane_spoolman - Auto-detect RFID cards and bind to Spoolman spools via lot_nr field - Support comma-delimited card_uid values in lot_nr (card_uid:XXX,card_uid:YYY) - Add SET_SPOOL_ID and REFRESH_SPOOL gcode commands per lane - Implement webhook callbacks for Spoolman proxy integration - Remove card_uid from other spools when binding to new spool
- Update afc-lite.md with comprehensive Spoolman auto-binding documentation - Document RFID card detection flow and lot_nr format - Add gcode commands reference (SET_SPOOL_ID, REFRESH_SPOOL) - Add respond_info notifications for card binding/unbinding actions - Update limitations section to reflect now-supported features
- Add automatic card_uid removal from spoolman when unbinding via SPOOL_ID=0 - Add unbind_spool_callback webhook endpoint for unbinding flow - Add gcode.respond_info notifications for bind/unbind actions - Add notification when RFID card is missing but spoolman is available - Fix SPOOL_ID parsing to handle empty string values
Adds `24_settings_tweaks_spoolman.yaml` to enable/disable Spoolman via firmware-config, prompting for the server URL on enable and validating it is a reachable Spoolman instance before writing the moonraker config. Extends firmware-config to support `inputs` on settings options: each entry defines a named form field (label, placeholder, regex) rendered in the confirm modal, validated client-side, and injected as named env vars into the option `cmd`.
…c-spoolman-auto-register
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.
Problem
The Spoolman API handles custom fields formatted as 'Text' by serializing strings with escaped inner quotes (e.g.,
"\"plus_HS\""). When Moonraker proxies this payload down to Klipper, Python retains the inner literal quotes ('"plus_HS"').As a result, the backend passes the uncleaned string further down to the Snapmaker core subsystem (
print_task_config.py). This forces the touch screen system to generate an invalid format insideprint_task.json(visible assub_type:"plus_HS"with unwanted quotation marks inside thegui.log).Solution
This patch intercepts the incoming data directly at the Moonraker proxy gate inside
spoolman.py.clean_json_structure) to process incoming payloads dynamically..strip('"')on all strings to cleanly shave off native or nested literal quotation marks at the flanks of the metadata entries..replace()rules to filter out any lingering internal backslashes (\) or multi-escaped quotation characters.rpc_spoolman_proxyendpoint.Verification
Successfully live-tested via manual hot-swapping inside the printer's RAM.
Verified via
moonraker.log:{"id": 45, "filament": {"extra": {"sub_type": "\"plus_HS\""}}}{"id": 45, "filament": {"extra": {"sub_type": "plus_HS"}}}