From 35ce3ad7719cf8d21b8ed2d446d2495887633899 Mon Sep 17 00:00:00 2001
From: PotentialStyx <62217716+PotentialStyx@users.noreply.github.com>
Date: Sat, 27 Apr 2024 17:08:48 -0700
Subject: [PATCH] feat(services, goval-ident): Implement chat variant of
`goval-ident` protocol - Fully implements
[`goval-ident`](https://govaldocs.pages.dev/service/goval-ident/) - Makes
`goval-ident` a disable-able feature - Unifies implemention of `chat` and
`gcsfiles` variants
---
Cargo.toml | 3 +-
services/Cargo.toml | 6 +-
services/src/gcsfiles.rs | 18 ++--
services/src/goval_ident.rs | 131 +++++++++++++++++++++++++++++
services/src/lib.rs | 26 +++++-
services/src/types/channel_info.rs | 4 +-
services/src/types/fs_watcher.rs | 4 +-
services/src/types/messaging.rs | 4 +-
services/src/types/mod.rs | 3 +
services/src/types/server_info.rs | 46 ++++++++++
src/goval_server.rs | 5 +-
src/main.rs | 7 +-
src/server_info.rs | 16 ++++
13 files changed, 245 insertions(+), 28 deletions(-)
create mode 100644 services/src/goval_ident.rs
create mode 100644 services/src/types/server_info.rs
create mode 100644 src/server_info.rs
diff --git a/Cargo.toml b/Cargo.toml
index d5fe515..0b2b06d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,12 +17,13 @@ See https://govaldocs.pages.dev"""
members = [".", "migration", "entity", "services", "protobuf"]
[features]
-default = ["replspace", "database", "repldb", "verify_connections"]
+default = ["replspace", "database", "repldb", "verify_connections", "goval-ident"]
repldb = ["database"]
database = ["dep:sea-orm", "dep:sea-query", "dep:migration", "dep:entity"]
replspace = []
fun-stuff = ["dep:chrono", "dep:chrono-tz"]
verify_connections = ["dep:hyper", "dep:hyper-tls", "dep:hyper-util", "dep:http-body-util"]
+goval-ident = ["homeval_services/goval-ident"]
[dependencies]
goval = { path = "protobuf", package = "protobuf" }
diff --git a/services/Cargo.toml b/services/Cargo.toml
index c220aa4..f3f78cb 100644
--- a/services/Cargo.toml
+++ b/services/Cargo.toml
@@ -4,6 +4,8 @@ version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[features]
+goval-ident = ["dep:serde_json"]
[dependencies]
anyhow = "1.0.81"
@@ -18,12 +20,14 @@ prost = "0.12.4"
prost-types = "0.12.3"
ropey = "1.6.0"
serde = "1.0.197"
-serde_json = "1.0.115"
similar = "2.2.1"
tokio = "1.36.0"
tracing = "0.1.40"
tracing-futures = "0.2.5"
+# goval-ident features
+serde_json = { version = "1.0.116", optional = true }
+
[lib]
name = "services"
path = "src/lib.rs"
diff --git a/services/src/gcsfiles.rs b/services/src/gcsfiles.rs
index 6d8b3a8..7688fb2 100644
--- a/services/src/gcsfiles.rs
+++ b/services/src/gcsfiles.rs
@@ -12,7 +12,7 @@ use tracing::{debug, warn};
impl traits::Service for GCSFiles {
async fn message(
&mut self,
- _info: &super::types::ChannelInfo,
+ #[allow(unused)] info: &super::types::ChannelInfo,
message: goval::Command,
_session: SessionID,
) -> Result