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