Преглед изворни кода

Slicer sidecars: SIDECAR_BIND publishes the ports on one address

- New optional setting in slicer-api/.env; unset changes nothing
- 127.0.0.1 for Bambuddy on the same host with network_mode: host
- Documented in .env.example and the slicer-api README
maziggy пре 6 дана
родитељ
комит
5b0d43e8d4
4 измењених фајлова са 16 додато и 2 уклоњено
  1. 1 0
      CHANGELOG.md
  2. 7 0
      slicer-api/.env.example
  3. 6 0
      slicer-api/README.md
  4. 2 2
      slicer-api/docker-compose.yml

+ 1 - 0
CHANGELOG.md

@@ -21,6 +21,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **The H2C shows how long each nozzle has printed (#1908, contributed by @Keybored02 in #3507)** — Recent H2C firmware counts the print time of every nozzle, which says more about a nozzle's use than the wear estimate. Hovering over a nozzle on the printer card, in the nozzle rack or on the left and right hotend, now shows its **Print time** next to **Wear**. Firmware that does not report it, and other printers, show no print time. Wiki updated.
 
 - **The profile editor offers the material types of the preferred slicer (#2928, requested by @doncaruana, contributed by @Keybored02 in #3544)** — The **Filament Type** dropdown of a filament profile was one list kept in Bambuddy, with types a slicer does not know (and without ones it does), so a profile could be valid here and not in the slicer. It now offers the types of the slicer chosen under Settings → Slicer: Bambu Studio's or OrcaSlicer's, which differ (Orca has SBS and the PA11/PA12 families, Bambu Studio has TPU-AMS). A profile keeps the type it has, imported or cloud-synced, even if the list does not have it, and changing the preferred slicer changes no existing profile.
+- **The slicer sidecars can be published on one address only (suggested by @pleasantone)** — The sidecar compose file published the slicer ports on every network interface, and the sidecars have no login. The new `SIDECAR_BIND` setting in `slicer-api/.env` limits them to one address: `127.0.0.1` when Bambuddy runs on the same host with its default `network_mode: host`. Left unset, nothing changes, so Bambuddy in bridge mode or on another host still reaches the sidecars
 ### Changed
 - **A slice sent again from the slicer adds a print to its archive (#1634, requested by @d3nn3s08, contributed by @Keybored02 in #3508)** — A print from the File Manager or the queue already joined the archive of its file, but a print sent from Bambu Studio or OrcaSlicer, or started on the printer, always got a new archive: the slicer writes a new 3MF each time it sends, so the file never matched, and the archive's print count stayed at one. Bambuddy now also keeps the hash of each archive's G-code, and a print whose G-code matches an archive nobody owns, in no project and not from a File Manager file adds a run to that archive. The archive takes the new 3MF in place of its old one and keeps its photos, timelapses, notes, tags and earlier runs; a name set by hand stays, and a name taken from the file follows the new file. While another print of it is running, the archive keeps its file and only gets the run. A model sliced again with other settings gets an archive of its own. OrcaSlicer writes the slicing time into the G-code, so with it only the same slice sent again matches. Archives made before are read once in the background after the update. Wiki updated.
 - **SpoolBuddy writes OpenTag3D 2.004 on NTAG215 and NTAG216 tags (#3500, suggested by @pleasantone)** — SpoolBuddy wrote the first version of the OpenTag3D layout. The current version moved every field, so a reader that only knows it read the brand, colour, weight and temperatures from the wrong places. Tags with room for it now get version 2.004, with material, brand, colour name, up to four colours, minimum and maximum print temperature, net weight and empty spool weight. Version 2 no longer fits on an NTAG213, so those keep the first version. SpoolBuddy picks by the size the tag reports, and falls back to the first version if it can't read it; a SpoolBuddy that hasn't been updated keeps writing the first version. Bambuddy does not track density or bed temperature, so a version 2 tag leaves them unset. Wiki updated.

+ 7 - 0
slicer-api/.env.example

@@ -6,6 +6,13 @@
 ORCA_API_PORT=3003
 BAMBU_API_PORT=3001
 
+# Address the ports are published on. Unset publishes them on all
+# interfaces. The sidecars have no login, so anyone who can reach the ports
+# can use them. If Bambuddy runs on this same host with network_mode: host
+# (its default compose file), set 127.0.0.1 so only this host can reach them.
+# Leave it unset when Bambuddy runs in bridge mode or on another host.
+#SIDECAR_BIND=127.0.0.1
+
 # Sidecar image tag. Default is `latest` (current stable release).
 # Pinning options:
 #   bambuddy-X.Y.Z   pin to the sidecar image that shipped with Bambuddy X.Y.Z

+ 6 - 0
slicer-api/README.md

@@ -52,6 +52,12 @@ native, and a stopgap until native ARM64 images ship. See
 
 Override via `ORCA_API_PORT` / `BAMBU_API_PORT` in `.env`.
 
+The ports are published on all interfaces by default. The sidecars have no
+login, so anyone who can reach the ports can use them. If Bambuddy runs on
+the same host with `network_mode: host` (its default compose file), set
+`SIDECAR_BIND=127.0.0.1` in `.env` so only this host can reach them. Leave it
+unset when Bambuddy runs in bridge mode or on another host.
+
 ## Bambuddy wiring
 
 In the Bambuddy UI: **Settings → Slicer**:

+ 2 - 2
slicer-api/docker-compose.yml

@@ -39,7 +39,7 @@ services:
     container_name: orca-slicer-api
     restart: unless-stopped
     ports:
-      - "${ORCA_API_PORT:-3003}:3000"
+      - "${SIDECAR_BIND:+${SIDECAR_BIND}:}${ORCA_API_PORT:-3003}:3000"
     volumes:
       - ./data/orca:/app/data
     environment:
@@ -59,7 +59,7 @@ services:
     container_name: bambu-studio-api
     restart: unless-stopped
     ports:
-      - "${BAMBU_API_PORT:-3001}:3000"
+      - "${SIDECAR_BIND:+${SIDECAR_BIND}:}${BAMBU_API_PORT:-3001}:3000"
     volumes:
       - ./data/bambu:/app/data
     environment: