From 0181e086575113b136758fc937e96d5901fc9132 Mon Sep 17 00:00:00 2001 From: seb Date: Sun, 1 Nov 2026 23:56:34 +0100 Subject: [PATCH] u --- src/assets/printers/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/assets/printers/index.js b/src/assets/printers/index.js index b4675e6..01c2157 100644 --- a/src/assets/printers/index.js +++ b/src/assets/printers/index.js @@ -1,12 +1,15 @@ import zd41x from './zd41x.png'; -// Library of printer images, keyed by printer model (as reported by the agent). -const PRINTER_IMAGES = { - 'ZD410-200dpi': zd41x, -}; +// Library of printer images. Entries are matched in order against the +// printer model (as reported by the agent), case-insensitively. +const PRINTER_IMAGES = [ + { pattern: /^ZD41/i, image: zd41x }, // ZD410, ZD411, ZD410-200dpi, ... +]; export function getPrinterImage(model) { - return (model && PRINTER_IMAGES[model]) || null; + if (!model) return null; + const entry = PRINTER_IMAGES.find(({ pattern }) => pattern.test(String(model).trim())); + return entry?.image ?? null; } export default PRINTER_IMAGES;