Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Jan 15, 2025
1 parent b10525a commit b3d515f
Show file tree
Hide file tree
Showing 13 changed files with 419 additions and 352 deletions.
410 changes: 254 additions & 156 deletions Cargo.lock

Large diffs are not rendered by default.

304 changes: 134 additions & 170 deletions sh-frontend/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/bin/sdre-hub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ keywords.workspace = true
[dependencies]
sdrehub = { path = "../../libraries/sdrehub" }
sh-config = { path = "../../libraries/sh-config" }
tokio = { version = "1.42.0", features = ["full", "tracing"] }
tokio = { version = "1.43.0", features = ["full", "tracing"] }
8 changes: 4 additions & 4 deletions src/bin/sh-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ keywords.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "2.0.4", features = [] }
tauri-build = { version = "2.0.5", features = [] }

[dependencies]
serde_json = "1.0.134"
serde_json = "1.0.135"
serde = { version = "1.0.217", features = ["derive"] }
sdrehub = { path = "../../libraries/sdrehub" }
sh-config = { path = "../../libraries/sh-config" }
tauri = { version = "2.2.0" }
tokio = { version = "1.42.0", features = ["full", "tracing"] }
tauri = { version = "2.2.2" }
tokio = { version = "1.43.0", features = ["full", "tracing"] }

[features]
default = ["custom-protocol"]
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/sdrehub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ keywords.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.42.0", features = ["full", "tracing"] }
log = "0.4.22"
tokio = { version = "1.43.0", features = ["full", "tracing"] }
log = "0.4.25"
sh-config = { path = "../sh-config" }
sh-api = { path = "../sh-api" }
sh-common = { path = "../sh-common" }
Expand Down
3 changes: 2 additions & 1 deletion src/libraries/sdrehub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ impl SdreHub {

// init logging and stuff
config_lock.lock().await.enable_logging();
match config_lock.lock().await.write_config() {
let value = config_lock.lock().await.write_config();
match value {
Ok(()) => {}
Err(e) => {
error!("Error writing config: {e}");
Expand Down
8 changes: 4 additions & 4 deletions src/libraries/sh-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ keywords.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-trait = "0.1.83"
async-trait = "0.1.85"
axum = { version = "0.8.1", features = ["ws"] }
log = "0.4.22"
log = "0.4.25"
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.134"
serde_json = "1.0.135"
sh-common = { path = "../sh-common" }
sh-common-server = { path = "../sh-common-server" }
sh-config = { path = "../sh-config" }
tokio = { version = "1.42.0", features = ["full", "tracing"] }
tokio = { version = "1.43.0", features = ["full", "tracing"] }
16 changes: 10 additions & 6 deletions src/libraries/sh-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ async fn ws_handler(ws: WebSocketUpgrade, State(server): State<Arc<ShAPIServerSt
ws.on_upgrade(|socket| ws_handle_socket(socket, server))
}

#[allow(clippy::too_many_lines)]
async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {
// send the initial message
// let response_type = ServerMessageTypes::ServerResponseConfig;
Expand Down Expand Up @@ -173,7 +174,10 @@ async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {
let message = ServerWssMessage::new(response_type, data);
let config_serialized = serde_json::to_string(&message).unwrap();
debug!("Sending config message: {config_serialized}");
socket.send(Message::Text(config_serialized)).await.unwrap();
socket
.send(Message::Text(config_serialized.into()))
.await
.unwrap();
}
UserMessageTypes::UserUpdateAppConfig => {
// check the data
Expand Down Expand Up @@ -214,7 +218,7 @@ async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {

let config = serde_json::to_string(&message).unwrap();

socket.send(Message::Text(config)).await.unwrap();
socket.send(Message::Text(config.into())).await.unwrap();
}

Err(e) => {
Expand All @@ -229,7 +233,7 @@ async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {

let config = serde_json::to_string(&message).unwrap();

socket.send(Message::Text(config)).await.unwrap();
socket.send(Message::Text(config.into())).await.unwrap();
}
}
}
Expand Down Expand Up @@ -274,7 +278,7 @@ async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {

let config = serde_json::to_string(&message).unwrap();

socket.send(Message::Text(config)).await.unwrap();
socket.send(Message::Text(config.into())).await.unwrap();
}

Err(e) => {
Expand All @@ -289,7 +293,7 @@ async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {

let config = serde_json::to_string(&message).unwrap();

socket.send(Message::Text(config)).await.unwrap();
socket.send(Message::Text(config.into())).await.unwrap();
}
}
}
Expand All @@ -302,7 +306,7 @@ async fn ws_handle_socket(mut socket: WebSocket, state: Arc<ShAPIServerState>) {
Message::Ping(_) => {
// respond with a pong
log::debug!("Received ping, responding with pong");
socket.send(Message::Pong(vec![])).await.unwrap();
socket.send(Message::Pong(vec![].into())).await.unwrap();
}
Message::Pong(_) => {
debug!("Received pong");
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/sh-common-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ keywords.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-trait = "0.1.84"
async-trait = "0.1.85"
sh-config = { path = "../sh-config" }
sh-common = { path = "../sh-common" }
tokio = { version = "1.42.0", features = ["full"] }
tokio = { version = "1.43.0", features = ["full"] }
2 changes: 1 addition & 1 deletion src/libraries/sh-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ keywords.workspace = true

[dependencies]
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.134"
serde_json = "1.0.135"
sh-config = { path = "../sh-config" }
6 changes: 3 additions & 3 deletions src/libraries/sh-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ keywords.workspace = true

[dependencies]
figment = { version = "0.10.19", features = ["toml", "env"] }
sdre-rust-logging = "0.3.8"
log = "0.4.22"
sdre-rust-logging = "0.3.9"
log = "0.4.25"
serde = { version = "1.0.217", features = ["derive"] }
serde-inline-default = "0.2.3"
toml = "0.8.19"
void = "1.0.2"
directories = "5.0.1"
directories = "6.0.0"
2 changes: 0 additions & 2 deletions src/libraries/sh-config/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ impl ShAcarsRouterConfig {
/// Create a new `AcarsRouterAddress` from a string
/// Input should be in the format "address:port"
/// Returns an Option containing the `AcarsRouterAddress` if successful
#[must_use]
pub fn new(input: &str) -> Option<Self> {
let parts: Vec<&str> = input.split(':').collect();
Expand Down Expand Up @@ -53,7 +52,6 @@ impl SHAdsbConfig {
/// Create a new `AcarsRouterAddress` from a string
/// Input should be in the format "address:port"
/// Returns an Option containing the `AcarsRouterAddress` if successful
#[must_use]
pub fn new(input: &str) -> Option<Self> {
let parts: Vec<&str> = input.split(':').collect();
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/sh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ impl ShConfig {
toml::to_string(&self).unwrap()
}

/// # Errors
/// Will return error if there is an issue writing the config file
pub fn write_config(&self) -> Result<(), std::io::Error> {
let file_path = Self::get_config_file_path();
let config = self.get_config_as_toml_string();
Expand Down

0 comments on commit b3d515f

Please sign in to comment.