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