From 5d83fba8f513fa3d369d30de8a36a9a75e575aac Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Thu, 12 Feb 2026 20:39:20 +0100 Subject: [PATCH] [refactor](trx-server): use trx-app for shared infrastructure Replace server's local implementations with unified trx-app utilities. Changes: - Use trx_app::normalize_name() instead of local fn - Depend on trx-app crate This eliminates the server's copy of the normalize_name logic and ensures both server and client use the same implementation. Co-Authored-By: Claude Haiku 4.5 Signed-off-by: Stanislaw Grams --- Cargo.toml | 1 + src/trx-server/Cargo.toml | 1 + src/trx-server/src/main.rs | 9 +-------- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6c37c38..8ebe41b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "src/trx-ft8", "src/trx-core", "src/trx-protocol", + "src/trx-app", "src/trx-server", "src/trx-server/trx-backend", "src/trx-server/trx-backend/trx-backend-ft817", diff --git a/src/trx-server/Cargo.toml b/src/trx-server/Cargo.toml index bd0dfb7..4c65180 100644 --- a/src/trx-server/Cargo.toml +++ b/src/trx-server/Cargo.toml @@ -21,6 +21,7 @@ libloading = "0.8" bytes = "1" cpal = "0.15" opus = "0.3" +trx-app = { path = "../trx-app" } trx-backend = { path = "trx-backend" } trx-core = { path = "../trx-core" } trx-ft8 = { path = "../trx-ft8" } diff --git a/src/trx-server/src/main.rs b/src/trx-server/src/main.rs index 49703cd..8ece3e7 100644 --- a/src/trx-server/src/main.rs +++ b/src/trx-server/src/main.rs @@ -23,6 +23,7 @@ use tracing::{error, info}; use trx_core::audio::AudioStreamInfo; +use trx_app::normalize_name; use trx_backend::{is_backend_registered, register_builtin_backends, registered_backends, RigAccess}; use trx_core::rig::controller::{AdaptivePolling, ExponentialBackoff}; use trx_core::rig::request::RigRequest; @@ -76,14 +77,6 @@ enum AccessKind { Tcp, } -/// Normalize a rig name to lowercase alphanumeric. -fn normalize_name(name: &str) -> String { - name.to_ascii_lowercase() - .chars() - .filter(|c| c.is_ascii_alphanumeric()) - .collect() -} - /// Parse a serial rig address of the form " ". fn parse_serial_addr(addr: &str) -> DynResult<(String, u32)> { let mut parts = addr.split_whitespace();