aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_server/handlers/mod.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-09 21:43:23 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-09 21:43:23 +0200
commit3223d93cb3c77ab02aa0a35f2a8314e447cee9a4 (patch)
tree3971a1f37f5fe3cadb747c5229a0d54e868e45e3 /crates/turtle/src/atuin_server/handlers/mod.rs
parentfix(client/sync): Pass through precise error on `SyncError::WrongKey` (diff)
downloadatuin-3223d93cb3c77ab02aa0a35f2a8314e447cee9a4.zip
chore: Separate daemon, client, server, and lib into crates
Diffstat (limited to 'crates/turtle/src/atuin_server/handlers/mod.rs')
-rw-r--r--crates/turtle/src/atuin_server/handlers/mod.rs54
1 files changed, 0 insertions, 54 deletions
diff --git a/crates/turtle/src/atuin_server/handlers/mod.rs b/crates/turtle/src/atuin_server/handlers/mod.rs
deleted file mode 100644
index b73df27b..00000000
--- a/crates/turtle/src/atuin_server/handlers/mod.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use crate::atuin_common::api::{ErrorResponse, IndexResponse};
-use axum::{Json, extract::State, http, response::IntoResponse};
-
-use crate::atuin_server::router::AppState;
-
-pub(crate) mod v0;
-
-const VERSION: &str = env!("CARGO_PKG_VERSION");
-
-pub(crate) async fn index(state: State<AppState>) -> Json<IndexResponse> {
- let homage = r#""Through the fathomless deeps of space swims the star turtle Great A'Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld." -- Sir Terry Pratchett"#;
-
- let version = state
- .settings
- .fake_version
- .clone()
- .unwrap_or_else(|| VERSION.to_string());
-
- Json(IndexResponse {
- homage: homage.to_string(),
- version,
- })
-}
-
-impl IntoResponse for ErrorResponseStatus<'_> {
- fn into_response(self) -> axum::response::Response {
- (self.status, Json(self.error)).into_response()
- }
-}
-
-pub(crate) struct ErrorResponseStatus<'a> {
- pub(crate) error: ErrorResponse<'a>,
- pub(crate) status: http::StatusCode,
-}
-
-pub(crate) trait RespExt<'a> {
- fn with_status(self, status: http::StatusCode) -> ErrorResponseStatus<'a>;
- fn reply(reason: &'a str) -> Self;
-}
-
-impl<'a> RespExt<'a> for ErrorResponse<'a> {
- fn with_status(self, status: http::StatusCode) -> ErrorResponseStatus<'a> {
- ErrorResponseStatus {
- error: self,
- status,
- }
- }
-
- fn reply(reason: &'a str) -> Self {
- Self {
- reason: reason.into(),
- }
- }
-}