diff --git a/src/api/endpoints_v1.rs b/src/api/endpoints_v1.rs index 3e3c108..671628a 100644 --- a/src/api/endpoints_v1.rs +++ b/src/api/endpoints_v1.rs @@ -1,9 +1,8 @@ use actix_web::web; use actix_web::{HttpResponse, get}; -use crate::docking; +use crate::v1::{docking, os, all_info, battery}; use crate::version; -use crate::battery; #[get("/are_you_there")] pub async fn index() -> HttpResponse { @@ -12,7 +11,7 @@ pub async fn index() -> HttpResponse { #[get("/all_info")] pub async fn get_all_info() -> HttpResponse { - match crate::api::all_info::get_all_info() { + match all_info::stats::get_all_info() { Ok(info) => { #[cfg(debug_assertions)] @@ -48,7 +47,7 @@ pub async fn get_dock_info() -> HttpResponse { #[get("/os_info")] pub async fn get_os_info() -> HttpResponse { - match crate::os::stats::get_os() { + match os::stats::get_os() { Ok(info) => { #[cfg(debug_assertions)] { diff --git a/src/api/mod.rs b/src/api/mod.rs index 11801f1..960c300 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,4 +1,2 @@ pub mod server; -mod endpoints_v1; -mod structs; -mod all_info; \ No newline at end of file +mod endpoints_v1; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 236d956..fe9861c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,4 @@ -mod battery; -mod docking; -mod os; +mod v1; mod version; use version::info::Version; diff --git a/src/battery/mod.rs b/src/v1/all_info/mod.rs similarity index 100% rename from src/battery/mod.rs rename to src/v1/all_info/mod.rs diff --git a/src/api/all_info.rs b/src/v1/all_info/stats.rs similarity index 87% rename from src/api/all_info.rs rename to src/v1/all_info/stats.rs index e155ad3..1e3ebc6 100644 --- a/src/api/all_info.rs +++ b/src/v1/all_info/stats.rs @@ -1,6 +1,6 @@ -use crate::docking; -use crate::battery; -use crate::os; +use crate::v1::docking; +use crate::v1::battery; +use crate::v1::os; use crate::version; use super::structs::Allinfo; diff --git a/src/api/structs.rs b/src/v1/all_info/structs.rs similarity index 89% rename from src/api/structs.rs rename to src/v1/all_info/structs.rs index 5ae1d7b..6e39a11 100644 --- a/src/api/structs.rs +++ b/src/v1/all_info/structs.rs @@ -1,5 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::{os, battery, docking::{self, structs::DockInfo}, version}; +use crate::{v1::{os, battery, docking::{self, structs::DockInfo}}, version}; + #[derive(Deserialize, Serialize, Clone)] pub struct Allinfo { diff --git a/src/docking/mod.rs b/src/v1/battery/mod.rs similarity index 100% rename from src/docking/mod.rs rename to src/v1/battery/mod.rs diff --git a/src/battery/stats.rs b/src/v1/battery/stats.rs similarity index 96% rename from src/battery/stats.rs rename to src/v1/battery/stats.rs index 1a17a8d..0ffb957 100644 --- a/src/battery/stats.rs +++ b/src/v1/battery/stats.rs @@ -1,4 +1,4 @@ -use crate::battery::structs::ChargingStatus; +use crate::v1::battery::structs::ChargingStatus; use super::structs::BatteryInfo; diff --git a/src/battery/structs.rs b/src/v1/battery/structs.rs similarity index 100% rename from src/battery/structs.rs rename to src/v1/battery/structs.rs diff --git a/src/os/mod.rs b/src/v1/docking/mod.rs similarity index 100% rename from src/os/mod.rs rename to src/v1/docking/mod.rs diff --git a/src/docking/stats.rs b/src/v1/docking/stats.rs similarity index 96% rename from src/docking/stats.rs rename to src/v1/docking/stats.rs index acaa84c..6701a7c 100644 --- a/src/docking/stats.rs +++ b/src/v1/docking/stats.rs @@ -3,7 +3,7 @@ use std::{io::BufReader, fs::File}; #[allow(unused_imports)] use std::collections::hash_set; -use crate::{battery::{stats::get_battery_info, structs::ChargingStatus}, USE_FALLBACK_DOCK_DETECTION}; +use crate::{v1::{battery::{stats::get_battery_info, structs::ChargingStatus}}, USE_FALLBACK_DOCK_DETECTION}; use super::structs::{Dock, DockInfo}; diff --git a/src/docking/structs.rs b/src/v1/docking/structs.rs similarity index 100% rename from src/docking/structs.rs rename to src/v1/docking/structs.rs diff --git a/src/v1/mod.rs b/src/v1/mod.rs new file mode 100644 index 0000000..1f4beb0 --- /dev/null +++ b/src/v1/mod.rs @@ -0,0 +1,4 @@ +pub mod battery; +pub mod docking; +pub mod os; +pub mod all_info; \ No newline at end of file diff --git a/src/v1/os/mod.rs b/src/v1/os/mod.rs new file mode 100644 index 0000000..8a30527 --- /dev/null +++ b/src/v1/os/mod.rs @@ -0,0 +1,2 @@ +pub mod stats; +pub mod structs; \ No newline at end of file diff --git a/src/os/stats.rs b/src/v1/os/stats.rs similarity index 100% rename from src/os/stats.rs rename to src/v1/os/stats.rs diff --git a/src/os/structs.rs b/src/v1/os/structs.rs similarity index 100% rename from src/os/structs.rs rename to src/v1/os/structs.rs