diff --git a/client/public/locales/cs/common.json b/client/public/locales/cs/common.json index 8d81cb6..bbc6f69 100644 --- a/client/public/locales/cs/common.json +++ b/client/public/locales/cs/common.json @@ -105,7 +105,8 @@ "showTemperatures": "Teploty", "showSpoolComment": "Poznámka k cívce", "showFilamentComment": "Poznámka k filamentu", - "showVendorComment": "Poznámka k výrobci" + "showVendorComment": "Poznámka k výrobci", + "useHTTPUrl": "Použít HTTP(S) odkaz v QR kódu" }, "spoolSelect": { "title": "Vybrat cívky", diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index 53160f8..348a687 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -106,7 +106,8 @@ "showTemperatures": "Temperatures", "showSpoolComment": "Spool Comment", "showFilamentComment": "Filament Comment", - "showVendorComment": "Vendor Comment" + "showVendorComment": "Vendor Comment", + "useHTTPUrl": "Use HTTP(S) link in QR code" }, "spoolSelect": { "title": "Select Spools", diff --git a/client/src/components/printing/spoolQrCodePrintingDialog.tsx b/client/src/components/printing/spoolQrCodePrintingDialog.tsx index b4ad9c3..0d20d10 100644 --- a/client/src/components/printing/spoolQrCodePrintingDialog.tsx +++ b/client/src/components/printing/spoolQrCodePrintingDialog.tsx @@ -21,6 +21,7 @@ const SpoolQRCodePrintingDialog: React.FC = ({ visibl const [showSpoolComment, setShowSpoolComment] = useSavedState("print-showSpoolComment", false); const [showFilamentComment, setShowFilamentComment] = useSavedState("print-showFilamentComment", false); const [showVendorComment, setShowVendorComment] = useSavedState("print-showVendorComment", false); + const [useHTTPUrl, setUseHTTPUrl] = useSavedState("print-useHTTPUrl", false); const formatFilament = (filament: IFilament) => { let vendorPrefix = ""; @@ -49,7 +50,7 @@ const SpoolQRCodePrintingDialog: React.FC = ({ visibl const tempLine = temps.join(" - "); return { - value: `web+spoolman:s-${spool.id}`, + value: useHTTPUrl ? `${window.location.origin}/spool/show/${spool.id}` : `web+spoolman:s-${spool.id}`, label: (

= ({ visibl setShowVendorComment(checked)} /> + + setUseHTTPUrl(checked)} /> + } /> diff --git a/client/src/components/qrCodeScanner.tsx b/client/src/components/qrCodeScanner.tsx index 8f6713d..0106600 100644 --- a/client/src/components/qrCodeScanner.tsx +++ b/client/src/components/qrCodeScanner.tsx @@ -18,6 +18,11 @@ const QRCodeScannerModal: React.FC = () => { setVisible(false); navigate(`/spool/show/${match.groups.id}`); } + const fullURLmatch = result.match(/^https?:\/\/[^/]+\/spool\/show\/(?[0-9]+)$/); + if (fullURLmatch && fullURLmatch.groups) { + setVisible(false); + navigate(`/spool/show/${fullURLmatch.groups.id}`); + } }; return (