fix(linux): restore legacy CUPS capture compatibility
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled

This commit is contained in:
Admin 2026-09-26 03:05:24 +00:00
parent 0da470e66d
commit 68052a11ef
4 changed files with 23 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@fieldlens/print", "name": "@fieldlens/print",
"version": "0.1.25", "version": "0.1.26",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
[package] [package]
name = "fieldlens-print" name = "fieldlens-print"
version = "0.1.25" version = "0.1.26"
description = "FieldLens print-stream barcode capture companion" description = "FieldLens print-stream barcode capture companion"
authors = ["Arrowstack"] authors = ["Arrowstack"]
edition = "2021" edition = "2021"

View File

@ -28,6 +28,8 @@ use crate::{
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
const SYSTEM_CUPS_SPOOL_DIR: &str = "/var/lib/fieldlens-print/capture"; const SYSTEM_CUPS_SPOOL_DIR: &str = "/var/lib/fieldlens-print/capture";
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
const LEGACY_CUPS_SPOOL_DIR: &str = "/var/cache/cups/fieldlens-print";
#[cfg(target_os = "linux")]
const TEST_CAPTURE_SINK_ADDR: &str = "127.0.0.1:9101"; const TEST_CAPTURE_SINK_ADDR: &str = "127.0.0.1:9101";
pub struct CaptureRuntime { pub struct CaptureRuntime {
@ -65,7 +67,8 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
if matches!(config.mode, CaptureMode::SpoolFolder | CaptureMode::Both) { if matches!(config.mode, CaptureMode::SpoolFolder | CaptureMode::Both) {
let spool_dir = PathBuf::from(&config.spool_dir); let spool_dir = PathBuf::from(&config.spool_dir);
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let is_system_cups_spool = spool_dir == PathBuf::from(SYSTEM_CUPS_SPOOL_DIR); let is_system_cups_spool = spool_dir == PathBuf::from(SYSTEM_CUPS_SPOOL_DIR)
|| spool_dir == PathBuf::from(LEGACY_CUPS_SPOOL_DIR);
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
let is_system_cups_spool = false; let is_system_cups_spool = false;
@ -93,20 +96,22 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
let system_spool = PathBuf::from(SYSTEM_CUPS_SPOOL_DIR); for spool in [SYSTEM_CUPS_SPOOL_DIR, LEGACY_CUPS_SPOOL_DIR] {
let worker_stop = stop.clone(); let system_spool = PathBuf::from(spool);
let worker_state = state.clone(); let worker_stop = stop.clone();
let worker_app = app.clone(); let worker_state = state.clone();
let worker_config = config.clone(); let worker_app = app.clone();
handles.push(thread::spawn(move || { let worker_config = config.clone();
cups_cache_folder_loop( handles.push(thread::spawn(move || {
system_spool, cups_cache_folder_loop(
worker_config, system_spool,
worker_state, worker_config,
worker_app, worker_state,
worker_stop, worker_app,
) worker_stop,
})); )
}));
}
let sink = TcpListener::bind(TEST_CAPTURE_SINK_ADDR) let sink = TcpListener::bind(TEST_CAPTURE_SINK_ADDR)
.with_context(|| format!("bind test-capture sink {TEST_CAPTURE_SINK_ADDR}"))?; .with_context(|| format!("bind test-capture sink {TEST_CAPTURE_SINK_ADDR}"))?;

View File

@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "FieldLens Print", "productName": "FieldLens Print",
"version": "0.1.25", "version": "0.1.26",
"identifier": "dev.arrowstack.fieldlens.print", "identifier": "dev.arrowstack.fieldlens.print",
"build": { "build": {
"beforeDevCommand": "npm run dev", "beforeDevCommand": "npm run dev",