1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-14 09:42:10 -04:00

feat(cups): add manual printer addition by IP/hostname (#1868)

Add a new "Add by Address" flow in the printer settings that allows
users to manually add printers by IP address or hostname, enabling
printing to devices not visible via mDNS/Avahi discovery (e.g.,
printers behind Tailscale subnet routers, VPNs, or across network
boundaries).

Go backend:
- New cups.testConnection IPC method that probes remote printers via
  IPP Get-Printer-Attributes with /ipp/print then / fallback
- Input validation with host sanitization and protocol allowlist
- Auth-aware probing (HTTP 401/403 reported as reachable)
- lpadmin CLI fallback for CreatePrinter/DeletePrinter when
  cups-pk-helper polkit authorization fails

QML frontend:
- "Add by Address" toggle alongside existing device discovery
- Manual entry form with host, port, protocol fields
- Test Connection button with loading state and result display
- Smart PPD auto-selection by probed makeModel with driverless fallback
- All strings use I18n.tr() with translator context

Includes 20+ unit tests covering validation, probe delegation, TLS
flag propagation, auth error detection, and handler routing.
This commit is contained in:
Giorgio De Trane
2026-03-01 02:36:16 +01:00
committed by GitHub
parent 9cb0d8baf2
commit 20d383d4ab
9 changed files with 1148 additions and 43 deletions

View File

@@ -659,6 +659,12 @@
"reference": "Modules/Settings/DesktopWidgetsTab.qml:84",
"comment": ""
},
{
"term": "Add by Address",
"context": "Toggle button to manually add a printer by IP or hostname",
"reference": "Modules/Settings/PrinterTab.qml:351",
"comment": ""
},
{
"term": "Adjust the number of columns in grid view mode.",
"context": "Adjust the number of columns in grid view mode.",
@@ -2429,6 +2435,12 @@
"reference": "Modules/ControlCenter/Details/BluetoothDetail.qml:297",
"comment": ""
},
{
"term": "Connection failed",
"context": "Status message when test connection to printer fails",
"reference": "Modules/Settings/PrinterTab.qml:603",
"comment": ""
},
{
"term": "Contains",
"context": "notification rule match type option",
@@ -3293,6 +3305,12 @@
"reference": "Services/DMSNetworkService.qml:480",
"comment": ""
},
{
"term": "Discover Devices",
"context": "Toggle button to scan for printers via mDNS/Avahi",
"reference": "Modules/Settings/PrinterTab.qml:313",
"comment": ""
},
{
"term": "Disk",
"context": "Disk",
@@ -5267,6 +5285,12 @@
"reference": "Modals/FileBrowser/FileBrowserContent.qml:241",
"comment": ""
},
{
"term": "Host",
"context": "Label for printer IP address or hostname input field",
"reference": "Modules/Settings/PrinterTab.qml:462",
"comment": ""
},
{
"term": "Hostname",
"context": "system info label",
@@ -5345,6 +5369,12 @@
"reference": "Modules/Settings/NetworkTab.qml:943",
"comment": ""
},
{
"term": "IP address or hostname",
"context": "Placeholder text for manual printer address input",
"reference": "Modules/Settings/PrinterTab.qml:472",
"comment": ""
},
{
"term": "ISO Date",
"context": "date format option",
@@ -8261,6 +8291,12 @@
"reference": "Modals/Greeter/GreeterCompletePage.qml:398",
"comment": ""
},
{
"term": "Port",
"context": "Label for printer port number input field",
"reference": "Modules/Settings/PrinterTab.qml:486",
"comment": ""
},
{
"term": "Portal",
"context": "wallpaper transition option",
@@ -8483,6 +8519,12 @@
"reference": "Modules/Settings/PrinterTab.qml:433",
"comment": ""
},
{
"term": "Printer reachable",
"context": "Status message when test connection to printer succeeds",
"reference": "Modules/Settings/PrinterTab.qml:603",
"comment": ""
},
{
"term": "Printers",
"context": "Printers",
@@ -10775,6 +10817,12 @@
"reference": "Modules/Settings/ThemeColorsTab.qml:1944",
"comment": ""
},
{
"term": "Test Connection",
"context": "Button to test connection to a printer by IP address",
"reference": "Modules/Settings/PrinterTab.qml:541",
"comment": ""
},
{
"term": "Test Page",
"context": "Test Page",
@@ -10787,6 +10835,12 @@
"reference": "Services/CupsService.qml:627",
"comment": ""
},
{
"term": "Testing...",
"context": "Button state while testing printer connection",
"reference": "Modules/Settings/PrinterTab.qml:541",
"comment": ""
},
{
"term": "Text",
"context": "shadow color option | text color",