Geräte-Agent für lokale Scan-Aufträge anlegen

This commit is contained in:
2026-06-02 12:59:04 +02:00
parent e9504e21e7
commit a26ff30cd8
16 changed files with 647 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { commandExists, runCommand } from "../commands.js"
export const hasCups = () => commandExists("lpstat")
export const listPrinters = async () => {
if (!await hasCups()) return []
const result = await runCommand("lpstat", ["-p"], { timeoutMs: 10_000 })
if (result.code !== 0) return []
return result.stdout
.split(/\r?\n/)
.map((line) => line.match(/^printer\s+(\S+)/)?.[1])
.filter((printer): printer is string => Boolean(printer))
}