From d2bf726fc429702c90759fbd6dda56a0e10cf7bb Mon Sep 17 00:00:00 2001 From: Bailey Townsend Date: Fri, 5 Sep 2025 23:03:20 -0500 Subject: [PATCH] little more clean up --- src/main.rs | 6 ++++-- src/middleware.rs | 2 -- src/xrpc/com_atproto_server.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2381dc5..7429e46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ use std::path::Path; use std::time::Duration; use std::{env, net::SocketAddr}; use tower_governor::GovernorLayer; -use tower_governor::governor::{GovernorConfig, GovernorConfigBuilder}; +use tower_governor::governor::GovernorConfigBuilder; use tower_http::compression::CompressionLayer; use tower_http::cors::{Any, CorsLayer}; use tracing::log; @@ -97,7 +97,9 @@ async fn main() -> Result<(), Box> { "Error loading pds.env file (ignore if you loaded your variables in the environment somehow else): {e}" ); } - let pds_root = env::var("PDS_DATA_DIRECTORY")?; + + let pds_root = + env::var("PDS_DATA_DIRECTORY").expect("PDS_DATA_DIRECTORY is not set in your pds.env file"); let account_db_url = format!("{pds_root}/account.sqlite"); let account_options = SqliteConnectOptions::new() diff --git a/src/middleware.rs b/src/middleware.rs index 4b8044a..b69c4ce 100644 --- a/src/middleware.rs +++ b/src/middleware.rs @@ -1,6 +1,5 @@ use crate::helpers::json_error_response; use axum::extract::Request; -use axum::http::header::AUTHORIZATION; use axum::http::{HeaderMap, StatusCode}; use axum::middleware::Next; use axum::response::IntoResponse; @@ -73,7 +72,6 @@ pub async fn extract_did(mut req: Request, next: Next) -> impl IntoResponse { .expect("Error creating an error response"); } let token = token.expect("Already checked for error,"); - // Not going to worry about expiration since it still goes to the PDS req.extensions_mut() .insert(Did(Some(token.claims().custom.sub.clone()))); } diff --git a/src/xrpc/com_atproto_server.rs b/src/xrpc/com_atproto_server.rs index de6a898..38a072b 100644 --- a/src/xrpc/com_atproto_server.rs +++ b/src/xrpc/com_atproto_server.rs @@ -10,8 +10,6 @@ use axum::response::{IntoResponse, Response}; use axum::{Extension, Json, debug_handler, extract, extract::Request}; use serde::{Deserialize, Serialize}; use serde_json; -use sqlx::Error; -use sqlx::sqlite::SqliteQueryResult; use tracing::log; #[derive(Serialize, Deserialize, Debug, Clone)] @@ -289,6 +287,8 @@ pub async fn create_account( State(state): State, mut req: Request, ) -> Result, StatusCode> { + //TODO if I add the block of only accounts authenticated just take the body as json here and grab the lxm token. No middle ware is needed + let uri = format!( "{}{}", state.pds_base_url, "/xrpc/com.atproto.server.createAccount" -- 2.51.2