diff options
Diffstat (limited to 'gitolfs3-server/src')
-rw-r--r-- | gitolfs3-server/src/api.rs | 9 | ||||
-rw-r--r-- | gitolfs3-server/src/authz.rs | 4 | ||||
-rw-r--r-- | gitolfs3-server/src/config.rs | 2 | ||||
-rw-r--r-- | gitolfs3-server/src/handler.rs | 16 | ||||
-rw-r--r-- | gitolfs3-server/src/main.rs | 4 |
5 files changed, 16 insertions, 19 deletions
diff --git a/gitolfs3-server/src/api.rs b/gitolfs3-server/src/api.rs index d71d188..e1a2983 100644 --- a/gitolfs3-server/src/api.rs +++ b/gitolfs3-server/src/api.rs | |||
@@ -1,15 +1,14 @@ | |||
1 | use std::collections::HashMap; | 1 | use std::collections::HashMap; |
2 | 2 | ||
3 | use axum::{ | 3 | use axum::{ |
4 | async_trait, | 4 | Extension, Json, |
5 | extract::{rejection, FromRequest, FromRequestParts, Request}, | 5 | extract::{FromRequest, FromRequestParts, Request, rejection}, |
6 | http, | 6 | http, |
7 | response::{IntoResponse, Response}, | 7 | response::{IntoResponse, Response}, |
8 | Extension, Json, | ||
9 | }; | 8 | }; |
10 | use chrono::{DateTime, Utc}; | 9 | use chrono::{DateTime, Utc}; |
11 | use gitolfs3_common::{Oid, Operation}; | 10 | use gitolfs3_common::{Oid, Operation}; |
12 | use serde::{de::DeserializeOwned, Deserialize, Serialize}; | 11 | use serde::{Deserialize, Serialize, de::DeserializeOwned}; |
13 | 12 | ||
14 | // ----------------------- Generic facilities ---------------------- | 13 | // ----------------------- Generic facilities ---------------------- |
15 | 14 | ||
@@ -76,7 +75,6 @@ fn has_git_lfs_json_content_type(req: &Request) -> bool { | |||
76 | is_git_lfs_json_mimetype(content_type) | 75 | is_git_lfs_json_mimetype(content_type) |
77 | } | 76 | } |
78 | 77 | ||
79 | #[async_trait] | ||
80 | impl<T, S> FromRequest<S> for GitLfsJson<T> | 78 | impl<T, S> FromRequest<S> for GitLfsJson<T> |
81 | where | 79 | where |
82 | T: DeserializeOwned, | 80 | T: DeserializeOwned, |
@@ -122,7 +120,6 @@ impl IntoResponse for RepositoryNameRejection { | |||
122 | } | 120 | } |
123 | } | 121 | } |
124 | 122 | ||
125 | #[async_trait] | ||
126 | impl<S: Send + Sync> FromRequestParts<S> for RepositoryName { | 123 | impl<S: Send + Sync> FromRequestParts<S> for RepositoryName { |
127 | type Rejection = RepositoryNameRejection; | 124 | type Rejection = RepositoryNameRejection; |
128 | 125 | ||
diff --git a/gitolfs3-server/src/authz.rs b/gitolfs3-server/src/authz.rs index 8a5f21f..c4cb6df 100644 --- a/gitolfs3-server/src/authz.rs +++ b/gitolfs3-server/src/authz.rs | |||
@@ -2,10 +2,10 @@ use std::collections::HashSet; | |||
2 | 2 | ||
3 | use axum::http; | 3 | use axum::http; |
4 | use chrono::{DateTime, Utc}; | 4 | use chrono::{DateTime, Utc}; |
5 | use gitolfs3_common::{generate_tag, Claims, Digest, Oid, Operation, SpecificClaims}; | 5 | use gitolfs3_common::{Claims, Digest, Oid, Operation, SpecificClaims, generate_tag}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | api::{make_error_resp, GitLfsErrorResponse, REPO_NOT_FOUND}, | 8 | api::{GitLfsErrorResponse, REPO_NOT_FOUND, make_error_resp}, |
9 | config::AuthorizationConfig, | 9 | config::AuthorizationConfig, |
10 | }; | 10 | }; |
11 | 11 | ||
diff --git a/gitolfs3-server/src/config.rs b/gitolfs3-server/src/config.rs index c6a51a5..7adc9f0 100644 --- a/gitolfs3-server/src/config.rs +++ b/gitolfs3-server/src/config.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::collections::HashSet; | 1 | use std::collections::HashSet; |
2 | 2 | ||
3 | use gitolfs3_common::{load_key, Key}; | 3 | use gitolfs3_common::{Key, load_key}; |
4 | 4 | ||
5 | pub struct Config { | 5 | pub struct Config { |
6 | pub listen_addr: (String, u16), | 6 | pub listen_addr: (String, u16), |
diff --git a/gitolfs3-server/src/handler.rs b/gitolfs3-server/src/handler.rs index 64d5492..be39721 100644 --- a/gitolfs3-server/src/handler.rs +++ b/gitolfs3-server/src/handler.rs | |||
@@ -2,24 +2,24 @@ use std::{collections::HashMap, sync::Arc}; | |||
2 | 2 | ||
3 | use aws_sdk_s3::{error::SdkError, operation::head_object::HeadObjectOutput}; | 3 | use aws_sdk_s3::{error::SdkError, operation::head_object::HeadObjectOutput}; |
4 | use axum::{ | 4 | use axum::{ |
5 | Json, | ||
5 | extract::{Path, State}, | 6 | extract::{Path, State}, |
6 | http, | 7 | http, |
7 | response::{IntoResponse, Response}, | 8 | response::{IntoResponse, Response}, |
8 | Json, | ||
9 | }; | 9 | }; |
10 | use base64::{prelude::BASE64_STANDARD, Engine}; | 10 | use base64::{Engine, prelude::BASE64_STANDARD}; |
11 | use chrono::Utc; | 11 | use chrono::Utc; |
12 | use gitolfs3_common::{generate_tag, Claims, HexByte, Oid, Operation, SpecificClaims}; | 12 | use gitolfs3_common::{Claims, HexByte, Oid, Operation, SpecificClaims, generate_tag}; |
13 | use serde::{de, Deserialize}; | 13 | use serde::{Deserialize, de}; |
14 | use tokio::sync::Mutex; | 14 | use tokio::sync::Mutex; |
15 | 15 | ||
16 | use crate::{ | 16 | use crate::{ |
17 | api::{ | 17 | api::{ |
18 | is_git_lfs_json_mimetype, make_error_resp, BatchRequest, BatchRequestObject, BatchResponse, | 18 | BatchRequest, BatchRequestObject, BatchResponse, BatchResponseObject, |
19 | BatchResponseObject, BatchResponseObjectAction, BatchResponseObjectActions, GitLfsJson, | 19 | BatchResponseObjectAction, BatchResponseObjectActions, GitLfsJson, HashAlgo, LFS_MIME, |
20 | HashAlgo, RepositoryName, TransferAdapter, LFS_MIME, REPO_NOT_FOUND, | 20 | REPO_NOT_FOUND, RepositoryName, TransferAdapter, is_git_lfs_json_mimetype, make_error_resp, |
21 | }, | 21 | }, |
22 | authz::{authorize_batch, authorize_get, Trusted}, | 22 | authz::{Trusted, authorize_batch, authorize_get}, |
23 | config::AuthorizationConfig, | 23 | config::AuthorizationConfig, |
24 | dlimit::DownloadLimiter, | 24 | dlimit::DownloadLimiter, |
25 | }; | 25 | }; |
diff --git a/gitolfs3-server/src/main.rs b/gitolfs3-server/src/main.rs index 46e840a..0067996 100644 --- a/gitolfs3-server/src/main.rs +++ b/gitolfs3-server/src/main.rs | |||
@@ -9,12 +9,12 @@ use config::Config; | |||
9 | use dlimit::DownloadLimiter; | 9 | use dlimit::DownloadLimiter; |
10 | 10 | ||
11 | use axum::{ | 11 | use axum::{ |
12 | Router, ServiceExt, | ||
12 | extract::OriginalUri, | 13 | extract::OriginalUri, |
13 | http::{self, Uri}, | 14 | http::{self, Uri}, |
14 | routing::{get, post}, | 15 | routing::{get, post}, |
15 | Router, ServiceExt, | ||
16 | }; | 16 | }; |
17 | use handler::{handle_batch, handle_obj_download, AppState}; | 17 | use handler::{AppState, handle_batch, handle_obj_download}; |
18 | use std::{process::ExitCode, sync::Arc}; | 18 | use std::{process::ExitCode, sync::Arc}; |
19 | use tokio::net::TcpListener; | 19 | use tokio::net::TcpListener; |
20 | use tower::Layer; | 20 | use tower::Layer; |