feat(linux): queue bounded CUPS capture telemetry after login
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
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:
parent
d79fffed5e
commit
267279b2a1
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@fieldlens/print",
|
||||
"version": "0.1.29",
|
||||
"version": "0.1.30",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fieldlens-print"
|
||||
version = "0.1.29"
|
||||
version = "0.1.30"
|
||||
description = "FieldLens print-stream barcode capture companion"
|
||||
authors = ["Arrowstack"]
|
||||
edition = "2021"
|
||||
|
||||
@ -457,9 +457,7 @@ fn process_captured_pdf(
|
||||
|
||||
let target = unique_processed_path(processed_dir, label);
|
||||
if let Err(error) = fs::rename(path, &target) {
|
||||
state.push_job(
|
||||
app,
|
||||
JobSummary {
|
||||
let job = JobSummary {
|
||||
id,
|
||||
source: source.into(),
|
||||
label: label.to_string(),
|
||||
@ -469,8 +467,9 @@ fn process_captured_pdf(
|
||||
captured_at: chrono::Utc::now().to_rfc3339(),
|
||||
forwarded,
|
||||
error: Some(format!("archive captured PDF failed: {error}")),
|
||||
},
|
||||
);
|
||||
};
|
||||
queue_capture_diagnostic(state, &job, "pdf");
|
||||
state.push_job(app, job);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -495,6 +494,7 @@ fn process_captured_pdf(
|
||||
Ok(count) => count,
|
||||
Err(error) => {
|
||||
job.error = Some(error);
|
||||
queue_capture_diagnostic(state, &job, "pdf");
|
||||
state.push_job(app, job);
|
||||
return;
|
||||
}
|
||||
@ -507,6 +507,7 @@ fn process_captured_pdf(
|
||||
page.saturating_sub(1),
|
||||
page_count
|
||||
));
|
||||
queue_capture_diagnostic(state, &job, "pdf");
|
||||
state.push_job(app, job);
|
||||
return;
|
||||
}
|
||||
@ -558,6 +559,7 @@ fn process_captured_pdf(
|
||||
}
|
||||
}
|
||||
}
|
||||
queue_capture_diagnostic(state, &job, "pdf");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
@ -961,29 +963,7 @@ fn process_payload(
|
||||
};
|
||||
let error = error.or(parse_error);
|
||||
let captured_at = chrono::Utc::now().to_rfc3339();
|
||||
#[cfg(target_os = "windows")]
|
||||
if source == "raw-proxy" {
|
||||
state.queue_print_telemetry(crate::model::PrintTelemetry {
|
||||
id: id.clone(),
|
||||
source: "raw-proxy".into(),
|
||||
stream_format: classify_print_stream(&bytes).into(),
|
||||
byte_count: bytes.len(),
|
||||
barcode_count: barcodes.len(),
|
||||
forwarded,
|
||||
failure_kind: error.as_ref().map(|message| {
|
||||
let kind = if message.contains("parser") {
|
||||
"parser"
|
||||
} else if message.contains("forward") {
|
||||
"forward"
|
||||
} else {
|
||||
"capture"
|
||||
};
|
||||
kind.to_owned()
|
||||
}),
|
||||
app_version: env!("CARGO_PKG_VERSION").into(),
|
||||
captured_at: captured_at.clone(),
|
||||
});
|
||||
}
|
||||
let stream_format = classify_print_stream(&bytes);
|
||||
let pallet_print = barcodes.first().map(|barcode| {
|
||||
let text = String::from_utf8_lossy(&bytes);
|
||||
let snapshot = parse_pallet_snapshot(&text, &barcode.value);
|
||||
@ -1003,9 +983,7 @@ fn process_payload(
|
||||
comparison
|
||||
});
|
||||
|
||||
state.push_job(
|
||||
app,
|
||||
JobSummary {
|
||||
let job = JobSummary {
|
||||
id,
|
||||
source: source.into(),
|
||||
label,
|
||||
@ -1015,11 +993,33 @@ fn process_payload(
|
||||
captured_at,
|
||||
forwarded,
|
||||
error,
|
||||
},
|
||||
);
|
||||
};
|
||||
queue_capture_diagnostic(state, &job, stream_format);
|
||||
state.push_job(app, job);
|
||||
}
|
||||
|
||||
fn queue_capture_diagnostic(state: &SharedState, job: &JobSummary, stream_format: &str) {
|
||||
state.queue_print_telemetry(crate::model::PrintTelemetry {
|
||||
id: job.id.clone(),
|
||||
source: job.source.clone(),
|
||||
stream_format: stream_format.into(),
|
||||
byte_count: job.bytes,
|
||||
barcode_count: job.barcodes.len(),
|
||||
forwarded: job.forwarded,
|
||||
failure_kind: job.error.as_ref().map(|message| {
|
||||
if message.contains("parser") || message.contains("decode") || message.contains("pdfinfo") {
|
||||
"parser"
|
||||
} else if message.contains("forward") {
|
||||
"forward"
|
||||
} else {
|
||||
"capture"
|
||||
}.into()
|
||||
}),
|
||||
app_version: env!("CARGO_PKG_VERSION").into(),
|
||||
captured_at: job.captured_at.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "windows", test))]
|
||||
fn classify_print_stream(bytes: &[u8]) -> &'static str {
|
||||
if bytes.starts_with(b"%PDF-") { "pdf" }
|
||||
else if bytes.starts_with(b"%!PS") { "postscript" }
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "FieldLens Print",
|
||||
"version": "0.1.29",
|
||||
"version": "0.1.30",
|
||||
"identifier": "dev.arrowstack.fieldlens.print",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@ -142,7 +142,7 @@ let config: AppConfig
|
||||
let jobs: Job[] = []
|
||||
let status: Status = { running: false, mode: 'raw-proxy', pending: 0, jobs: 0 }
|
||||
let loginTimer: number | undefined
|
||||
let currentVersion = '0.1.29'
|
||||
let currentVersion = '0.1.30'
|
||||
let bundleType: BundleType | null = null
|
||||
let availableUpdate: Update | null = null
|
||||
let availableManualUpdate: ManualUpdate | null = null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user