diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-04-20 21:53:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 20:53:07 +0000 |
| commit | a21737e2b7f8d1e426726bdd7536033f299d476a (patch) | |
| tree | e940afdff9c145d25d9a2895fd44a77d70719a2e /src/server/handlers | |
| parent | Switch to Warp + SQLx, use async, switch to Rust stable (#36) (diff) | |
| download | atuin-a21737e2b7f8d1e426726bdd7536033f299d476a.zip | |
Use cargo workspaces (#37)
* Switch to Cargo workspaces
Breaking things into "client", "server" and "common" makes managing the
codebase much easier!
client - anything running on a user's machine for adding history
server - handles storing/syncing history and running a HTTP server
common - request/response API definitions, common utils, etc
* Update dockerfile
Diffstat (limited to '')
| -rw-r--r-- | atuin-server/src/handlers/history.rs (renamed from src/server/handlers/history.rs) | 6 | ||||
| -rw-r--r-- | atuin-server/src/handlers/mod.rs (renamed from src/server/handlers/mod.rs) | 0 | ||||
| -rw-r--r-- | atuin-server/src/handlers/user.rs (renamed from src/server/handlers/user.rs) | 11 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/server/handlers/history.rs b/atuin-server/src/handlers/history.rs index 4fd6f03f..1aebdde1 100644 --- a/src/server/handlers/history.rs +++ b/atuin-server/src/handlers/history.rs @@ -2,11 +2,11 @@ use std::convert::Infallible; use warp::{http::StatusCode, reply::json}; -use crate::api::{ +use crate::database::Database; +use crate::models::{NewHistory, User}; +use atuin_common::api::{ AddHistoryRequest, CountResponse, ErrorResponse, SyncHistoryRequest, SyncHistoryResponse, }; -use crate::server::database::Database; -use crate::server::models::{NewHistory, User}; pub async fn count( user: User, diff --git a/src/server/handlers/mod.rs b/atuin-server/src/handlers/mod.rs index 3c20538c..3c20538c 100644 --- a/src/server/handlers/mod.rs +++ b/atuin-server/src/handlers/mod.rs diff --git a/src/server/handlers/user.rs b/atuin-server/src/handlers/user.rs index 782d7dbd..6b142cdc 100644 --- a/src/server/handlers/user.rs +++ b/atuin-server/src/handlers/user.rs @@ -5,13 +5,14 @@ use uuid::Uuid; use warp::http::StatusCode; use warp::reply::json; -use crate::api::{ +use atuin_common::api::{ ErrorResponse, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, UserResponse, }; -use crate::server::database::Database; -use crate::server::models::{NewSession, NewUser}; +use atuin_common::utils::hash_secret; + +use crate::database::Database; +use crate::models::{NewSession, NewUser}; use crate::settings::Settings; -use crate::utils::hash_secret; pub fn verify_str(secret: &str, verify: &str) -> bool { sodiumoxide::init().unwrap(); @@ -52,7 +53,7 @@ pub async fn register( settings: Settings, db: impl Database + Clone + Send + Sync, ) -> Result<Box<dyn warp::Reply>, Infallible> { - if !settings.server.open_registration { + if !settings.open_registration { return Ok(Box::new(ErrorResponse::reply( "this server is not open for registrations", StatusCode::BAD_REQUEST, |
