Skip to content

fix: Spoolman usage without Spoolman, one network grant per printer, proxy addresses, 2.5 colour sync - #50

Merged
bloodf merged 3 commits into
mainfrom
fix/u1-47-48-host-colour
Nov 18, 2026
Merged

bloodf merged 3 commits into
mainfrom
fix/u1-47-48-host-colour

Conversation

@bloodf

@bloodf bloodf commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Fixes #47
Fixes #48

Spoolman usage without Spoolman (#47)

Root cause: remember_job queued a usage job whenever reporting was on, even with no Spoolman URL. Booking then failed in Spoolman.connect() ("not configured"), _book put the job back for a retry every 60 s and notified each time, and the job was saved in usage_ledger.json, so it came back after every restart. Turning reporting off later didn't touch jobs already queued.

  • No URL or reporting off: nothing is queued.
  • set_target (page open, settings saved) drops waiting and retrying jobs when reporting is off or the URL is empty, silently.
  • On load, ledger jobs with no URL or report: false are dropped silently, so users who are already stuck are fixed by the update.
  • _book returns quietly for a job without a URL, so a "not configured" failure never notifies.

Permission prompt per camera frame (#48)

Root cause: the camera and remote-screen requests added ?t=<ms>. OrcaSlicer 2.5 stores a runtime approval for the exact URL it saw, so each frame was a new target and a new prompt. The plugin never declared a network target at load.

  • Camera and screen use one fixed URL each, kept fresh with Cache-Control: no-cache.
  • register_capabilities passes network_http=[scheme://host] for the printer and Spoolman set in the settings, plus the origins U1 Control used before. Those are remembered in the settings store when a printer is selected or the printer agent connects. In 2.5.1 a canonical scheme://host grant covers every port and path on that host, raw sockets included. Presets are not read at load because that crashed 2.5.1. If OrcaSlicer doesn't accept network_http, the plugin falls back to the old call.

Printer behind a reverse proxy

Root cause: normalize_host dropped the path. Every non-root address also got an https://host:7125 fallback. ws_call refused https ("websocket calls need plain http") and always requested /websocket at the root.

  • http(s)://host[:port][/prefix] and bare hostnames/IPs are accepted. The scheme is lowercased, the prefix is kept, and query and fragment are dropped.
  • The :7125 fallback only applies to a plain http address with no port and no path.
  • The websocket uses TLS (wss) for https, on port 443 by default, at <prefix>/websocket, with a proper Host header.
  • The printer agent's base_url keeps an https scheme and the path prefix.
  • Errors still name the address and the reason for each candidate (can't reach the U1 at <base> (<reason>), can't read printer address '<x>').

Project filament colours on OrcaSlicer 2.5

Root cause: sync_project staged filament_colour on the filament preset transaction. In 2.5.0 and 2.5.1, Tab::apply_preset_config_values only accepts filament preset keys, and filament_colour is a project setting (s_Preset_filament_options lists default_filament_colour only). So every commit failed. Neither 2.5.x nor upstream main has a plugin call to set a project slot's colour. default_filament_colour would edit the shared preset, which is wrong per slot.

  • The sync first tries the colour, which still works where the old key worked. If the host refuses filament_colour, it applies the preset without it, skips the colour for the remaining slots and logs that once. A colour problem never fails the sync.

Tests

  • tests/test_corrections.py: no URL queues nothing, reporting off / URL cleared drops jobs silently, a job with no URL never notifies, the ledger cleans up on load.
  • tests/test_address_forms.py (new): address forms, the fallback rules, the prefix kept for requests and uploads, wss with the prefix, permission_origin.
  • tests/test_features.py: the camera asks one fixed URL.
  • tests/test_agent.py: the load-time network_http grant comes from the remembered origins; base_url with a proxy.
  • tests/test_u1control.py: the presets are applied when OrcaSlicer refuses the colour.

All of these fail on main and pass here. Full suite locally: 460 tests OK.

…afe project sync (#48)

- camera and remote screen use one fixed URL each (no ?t= cache-buster): a
  runtime approval only covers the exact URL, so every frame prompted again
- request_permissions(network_http=[scheme://host]) at load for the printers
  and Spoolman in the settings or used before (remembered, never presets)
- printer address keeps scheme, port and path prefix; :7125 fallback only for
  plain http roots; websocket over TLS for https, under the prefix
- sync_project: OrcaSlicer 2.5 refuses filament_colour in a filament preset
  edit; apply the preset without it instead of failing every slot
@bloodf
bloodf merged commit 24c1404 into main Nov 18, 2026
4 checks passed
@bloodf
bloodf deleted the fix/u1-47-48-host-colour branch November 18, 2026 15:37
@bloodf bloodf mentioned this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activating camera generates endless permissions requests Spoolman use reporting error message never goes away, even after turning off feature

1 participant