diff --git a/Cargo.toml b/Cargo.toml index 78ea42d..9b0d33e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] #giterated-daemon = { git = "https://giterated.dev/ambee/giterated-daemon" } -giterated-daemon = { path = "../giterated-daemon" } +giterated-models = { path = "../giterated-daemon/giterated-models" } tokio-tungstenite = { version = "*", features = ["rustls-tls-native-roots"] } tokio = { version = "1.32.0", features = ["full"] } tracing = "*" @@ -22,4 +22,5 @@ reqwest = { version = "0.11" } anyhow = "*" deadpool = "*" async-trait = "*" -thiserror = "*" \ No newline at end of file +thiserror = "*" +semver = "*" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index eb1c5bb..d6836b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,11 @@ pub mod request; pub mod model { - pub use giterated_daemon::model::*; + pub use giterated_models::model::*; } pub mod messages { - pub use giterated_daemon::messages::*; + pub use giterated_models::messages::*; } use std::convert::Infallible; @@ -13,20 +13,15 @@ use std::net::SocketAddr; use std::str::FromStr; use std::sync::Arc; - use deadpool::managed::{BuildError, Manager, Pool, RecycleError, RecycleResult}; use futures_util::{SinkExt, StreamExt}; -use giterated_daemon::messages::handshake::{ - HandshakeFinalize, HandshakeResponse, InitiateHandshake, +use giterated_models::{ + messages::handshake::{HandshakeFinalize, HandshakeResponse, InitiateHandshake}, + model::instance::Instance, }; - - -use giterated_daemon::model::instance::Instance; - - -use giterated_daemon::{validate_version, version}; +use semver::Version; use serde::Serialize; use tokio::net::TcpStream; use tokio_tungstenite::{connect_async, tungstenite::Message, MaybeTlsStream, WebSocketStream}; @@ -646,7 +641,13 @@ impl GiteratedApi { _instance: &Instance, ) -> Result<(), anyhow::Error> { // Send handshake initiation - Self::send_message(&InitiateHandshake { version: version() }, socket).await?; + Self::send_message( + &InitiateHandshake { + version: Version::from_str("0.0.0").unwrap(), + }, + socket, + ) + .await?; while let Some(message) = socket.next().await { let message = match message { @@ -684,19 +685,23 @@ impl GiteratedApi { } else { match serde_json::from_slice::(&payload) { Ok(response) => { - let message = if !validate_version(&response.version) { - error!( - "Version compatibility failure! Our Version: {}, Their Version: {}", - version(), - response.version - ); - - HandshakeFinalize { success: false } - } else { - info!("Connected with a compatible version"); - - HandshakeFinalize { success: true } - }; + // let message = if !validate_version(&response.version) { + // error!( + // "Version compatibility failure! Our Version: {}, Their Version: {}", + // version(), + // response.version + // ); + + // HandshakeFinalize { success: false } + // } else { + // info!("Connected with a compatible version"); + + // HandshakeFinalize { success: true } + // }; + + warn!("Version compatibility has been no-op'd"); + + let message = HandshakeFinalize { success: true }; // Send [`HandshakeFinalize`] to indicate if we're compatible or not Self::send_message(&message, socket).await?; } diff --git a/src/main.rs b/src/main.rs index 0ce6643..132d31f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,9 @@ use std::str::FromStr; use giterated_api::DaemonConnectionPool; -use giterated_daemon::{ +use giterated_api::{ messages::user::{UserBioRequest, UserBioResponse}, - model::{ - instance::Instance, - user::User, - }, + model::{instance::Instance, user::User}, }; use serde::{Deserialize, Serialize}; diff --git a/src/request.rs b/src/request.rs index 6e89dcd..ea2aa52 100644 --- a/src/request.rs +++ b/src/request.rs @@ -1,8 +1,11 @@ use anyhow::Error; use futures_util::{SinkExt, StreamExt}; -use giterated_daemon::model::{ - authenticated::{Authenticated, AuthenticationSourceProvider}, - instance::Instance, +use giterated_models::{ + messages::error::ConnectionError, + model::{ + authenticated::{Authenticated, AuthenticationSourceProvider}, + instance::Instance, + }, }; use serde::{de::DeserializeOwned, Serialize}; use tokio_tungstenite::tungstenite::Message; @@ -65,10 +68,7 @@ impl<'a, T: Serialize + DeserializeOwned> PreparedRequest<'a, T> { if as_target.is_err() { // Maybe we got an error payload? - if let Ok(error_payload) = serde_json::from_slice::< - giterated_daemon::messages::error::ConnectionError, - >(&payload) - { + if let Ok(error_payload) = serde_json::from_slice::(&payload) { return Err(error_payload.into()); } } else {