diff options
author | FxQnLr <[email protected]> | 2023-11-02 20:57:47 +0100 |
---|---|---|
committer | FxQnLr <[email protected]> | 2023-11-02 20:57:47 +0100 |
commit | 94104b621e2eec44dd90eb22fae2db2ce4938b87 (patch) | |
tree | c357bcaca0681caf9a6742c857bb494dc4315900 /src/routes | |
parent | 5b7302cf9be4e0badd691203e160ca110613e34c (diff) | |
download | webol-94104b621e2eec44dd90eb22fae2db2ce4938b87.tar webol-94104b621e2eec44dd90eb22fae2db2ce4938b87.tar.gz webol-94104b621e2eec44dd90eb22fae2db2ce4938b87.zip |
update dependencies
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/start.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/routes/start.rs b/src/routes/start.rs index 9cd358b..271f924 100644 --- a/src/routes/start.rs +++ b/src/routes/start.rs | |||
@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; | |||
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | use axum::extract::State; | 5 | use axum::extract::State; |
6 | use serde_json::{json, Value}; | 6 | use serde_json::{json, Value}; |
7 | use tracing::{debug, info, warn}; | 7 | use tracing::{debug, info}; |
8 | use uuid::Uuid; | 8 | use uuid::Uuid; |
9 | use crate::auth::auth; | 9 | use crate::auth::auth; |
10 | use crate::config::SETTINGS; | 10 | use crate::config::SETTINGS; |
@@ -16,7 +16,6 @@ use crate::services::ping::PingValue; | |||
16 | #[axum_macros::debug_handler] | 16 | #[axum_macros::debug_handler] |
17 | pub async fn start(State(state): State<Arc<crate::AppState>>, headers: HeaderMap, Json(payload): Json<StartPayload>) -> Result<Json<Value>, WebolError> { | 17 | pub async fn start(State(state): State<Arc<crate::AppState>>, headers: HeaderMap, Json(payload): Json<StartPayload>) -> Result<Json<Value>, WebolError> { |
18 | info!("POST request"); | 18 | info!("POST request"); |
19 | warn!("{:?}", state.ping_map); | ||
20 | let secret = headers.get("authorization"); | 19 | let secret = headers.get("authorization"); |
21 | let authorized = auth(secret).map_err(WebolError::Auth)?; | 20 | let authorized = auth(secret).map_err(WebolError::Auth)?; |
22 | if authorized { | 21 | if authorized { |
@@ -46,7 +45,7 @@ pub async fn start(State(state): State<Arc<crate::AppState>>, headers: HeaderMap | |||
46 | let uuid_gen = Uuid::new_v4().to_string(); | 45 | let uuid_gen = Uuid::new_v4().to_string(); |
47 | let uuid_genc = uuid_gen.clone(); | 46 | let uuid_genc = uuid_gen.clone(); |
48 | tokio::spawn(async move { | 47 | tokio::spawn(async move { |
49 | debug!("Init ping service"); | 48 | debug!("init ping service"); |
50 | state.ping_map.insert(uuid_gen.clone(), PingValue { ip: device.ip.clone(), online: false }); | 49 | state.ping_map.insert(uuid_gen.clone(), PingValue { ip: device.ip.clone(), online: false }); |
51 | 50 | ||
52 | crate::services::ping::spawn(state.ping_send.clone(), device.ip, uuid_gen.clone(), &state.ping_map).await | 51 | crate::services::ping::spawn(state.ping_send.clone(), device.ip, uuid_gen.clone(), &state.ping_map).await |