aboutsummaryrefslogtreecommitdiffstats
path: root/gitolfs3-server
diff options
context:
space:
mode:
Diffstat (limited to 'gitolfs3-server')
-rw-r--r--gitolfs3-server/Cargo.toml14
-rw-r--r--gitolfs3-server/src/api.rs9
-rw-r--r--gitolfs3-server/src/authz.rs4
-rw-r--r--gitolfs3-server/src/config.rs2
-rw-r--r--gitolfs3-server/src/handler.rs16
-rw-r--r--gitolfs3-server/src/main.rs4
6 files changed, 23 insertions, 26 deletions
diff --git a/gitolfs3-server/Cargo.toml b/gitolfs3-server/Cargo.toml
index efea78b..5908770 100644
--- a/gitolfs3-server/Cargo.toml
+++ b/gitolfs3-server/Cargo.toml
@@ -1,20 +1,20 @@
1[package] 1[package]
2name = "gitolfs3-server" 2name = "gitolfs3-server"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2024"
5license = "MIT" 5license = "MIT"
6 6
7[dependencies] 7[dependencies]
8aws-config = { version = "1.1.2" } 8aws-config = "1.6"
9aws-sdk-s3 = "1.12.0" 9aws-sdk-s3 = "1.82"
10axum = "0.7" 10axum = "0.8"
11base64 = "0.21" 11base64 = "0.22"
12chrono = { version = "0.4", features = ["serde"] } 12chrono = { version = "0.4", features = ["serde"] }
13gitolfs3-common = { path = "../gitolfs3-common" } 13gitolfs3-common = { path = "../gitolfs3-common" }
14mime = "0.3" 14mime = "0.3"
15serde = { version = "1", features = ["derive"] } 15serde = { version = "1", features = ["derive"] }
16serde_json = "1" 16serde_json = "1"
17tokio = { version = "1.35", features = ["full"] } 17tokio = { version = "1.44", features = ["full"] }
18tokio-util = "0.7" 18tokio-util = "0.7"
19tower = "0.4" 19tower = "0.5"
20tracing-subscriber = { version = "0.3", features = ["env-filter"] } 20tracing-subscriber = { version = "0.3", features = ["env-filter"] }
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 @@
1use std::collections::HashMap; 1use std::collections::HashMap;
2 2
3use axum::{ 3use 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};
10use chrono::{DateTime, Utc}; 9use chrono::{DateTime, Utc};
11use gitolfs3_common::{Oid, Operation}; 10use gitolfs3_common::{Oid, Operation};
12use serde::{de::DeserializeOwned, Deserialize, Serialize}; 11use 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]
80impl<T, S> FromRequest<S> for GitLfsJson<T> 78impl<T, S> FromRequest<S> for GitLfsJson<T>
81where 79where
82 T: DeserializeOwned, 80 T: DeserializeOwned,
@@ -122,7 +120,6 @@ impl IntoResponse for RepositoryNameRejection {
122 } 120 }
123} 121}
124 122
125#[async_trait]
126impl<S: Send + Sync> FromRequestParts<S> for RepositoryName { 123impl<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
3use axum::http; 3use axum::http;
4use chrono::{DateTime, Utc}; 4use chrono::{DateTime, Utc};
5use gitolfs3_common::{generate_tag, Claims, Digest, Oid, Operation, SpecificClaims}; 5use gitolfs3_common::{Claims, Digest, Oid, Operation, SpecificClaims, generate_tag};
6 6
7use crate::{ 7use 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 @@
1use std::collections::HashSet; 1use std::collections::HashSet;
2 2
3use gitolfs3_common::{load_key, Key}; 3use gitolfs3_common::{Key, load_key};
4 4
5pub struct Config { 5pub 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
3use aws_sdk_s3::{error::SdkError, operation::head_object::HeadObjectOutput}; 3use aws_sdk_s3::{error::SdkError, operation::head_object::HeadObjectOutput};
4use axum::{ 4use 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};
10use base64::{prelude::BASE64_STANDARD, Engine}; 10use base64::{Engine, prelude::BASE64_STANDARD};
11use chrono::Utc; 11use chrono::Utc;
12use gitolfs3_common::{generate_tag, Claims, HexByte, Oid, Operation, SpecificClaims}; 12use gitolfs3_common::{Claims, HexByte, Oid, Operation, SpecificClaims, generate_tag};
13use serde::{de, Deserialize}; 13use serde::{Deserialize, de};
14use tokio::sync::Mutex; 14use tokio::sync::Mutex;
15 15
16use crate::{ 16use 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;
9use dlimit::DownloadLimiter; 9use dlimit::DownloadLimiter;
10 10
11use axum::{ 11use 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};
17use handler::{handle_batch, handle_obj_download, AppState}; 17use handler::{AppState, handle_batch, handle_obj_download};
18use std::{process::ExitCode, sync::Arc}; 18use std::{process::ExitCode, sync::Arc};
19use tokio::net::TcpListener; 19use tokio::net::TcpListener;
20use tower::Layer; 20use tower::Layer;