mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
Two recurring virtual-printer support pains, both on the Virtual Printers
settings page.
Setup check: a stethoscope action on each VP card runs a pass/fail/warn/skip
checklist — VP enabled, services running, bind interface still exists, access
code set, target printer (proxy mode), and a live TCP probe of the FTP / MQTT
/ discovery ports on the bind IP. start_server swallows per-service bind
errors, so a service object can exist while nothing is listening; probing the
bind IP from outside is the only reliable signal and it catches the common
"VP not visible in the slicer" bind-IP-conflict and stale-interface cases.
Slicer certificate: virtual printers present a TLS cert signed by a shared CA
the slicer must trust. Until now users had to docker exec in and cat
bbl_ca.crt. A "Slicer certificate" row on the settings card now offers Copy
and Download (bambuddy-virtual-printer-ca.crt) plus the SHA-256 fingerprint.
GET /virtual-printers/ca-certificate returns only the public certificate; the
CA private key never leaves the backend. The CA is generated on demand so the
button works before the first VP is enabled.
Backend:
- services/virtual_printer/diagnostic.py — run_vp_diagnostic + port probes
- schemas/virtual_printer.py — VPDiagnosticResult
- CertificateService.get_ca_certificate_info() + manager helper
- routes: GET /virtual-printers/ca-certificate, /{vp_id}/diagnostic
Frontend:
- VirtualPrinterDiagnosticModal.tsx; stethoscope button on VirtualPrinterCard
- caCert row on VirtualPrinterList; utils/clipboard.ts (shared copy w/
non-secure-context fallback + downloadTextFile), de-duplicating the
existing FQDN-copy logic
- vpDiagnostic.* + virtualPrinter.caCert.* across all 9 locales
9 backend unit tests + 4 route integration tests + 6 frontend tests.
Backend ruff clean, frontend build clean, i18n parity green.
24 lines
774 B
Python
24 lines
774 B
Python
"""Schemas for virtual printer diagnostics."""
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from backend.app.schemas.printer import DiagnosticCheck
|
|
|
|
|
|
class VPDiagnosticResult(BaseModel):
|
|
"""Result of a virtual-printer setup diagnostic run.
|
|
|
|
Mirrors ``PrinterDiagnosticResult`` but keyed to a virtual printer: the
|
|
checks probe the VP's own bind IP and local services rather than a remote
|
|
printer. ``checks[].id`` values are VP-specific (enabled, running,
|
|
bind_interface, access_code, target_printer, port_ftps, port_mqtt,
|
|
port_bind, certificate); the frontend renders the localized title and
|
|
fix text from id + status.
|
|
"""
|
|
|
|
vp_id: int
|
|
vp_name: str
|
|
mode: str
|
|
overall: str # "ok" | "warnings" | "problems"
|
|
checks: list[DiagnosticCheck]
|