Compare commits

..

No commits in common. "9832f30360a98ce36dbc5190c8d1d9302c76186f" and "e3008262fcd3a9e90d2adff127b1806742fa7b7e" have entirely different histories.

2 changed files with 3 additions and 9 deletions

View File

@ -172,10 +172,7 @@ async fn main() -> std::io::Result<()> {
.service(hello_test) .service(hello_test)
.service(index) .service(index)
.service(askama) .service(askama)
.service( .service(repo::git_main)
webx::resource("/git/{owner}/{repo}.git")
.route(webx::get().to(repo::git_main::<auth::TestValidator>))
)
.service(hello_session) .service(hello_session)
.service(chunk) .service(chunk)
//.service(git_proto) //.service(git_proto)

View File

@ -1,4 +1,3 @@
use crate::auth::AuthValidator;
use std::path::Path; use std::path::Path;
use actix_web::web; use actix_web::web;
@ -56,17 +55,15 @@ pub struct GitWebQ {
branch: Option<String>, branch: Option<String>,
} }
//#[get("/git/{owner}/{repo}.git")] #[get("/git/{owner}/{repo}.git")]
pub async fn git_main<T : AuthValidator>( pub async fn git_main(
web::Path((ownername, reponame)): web::Path<(String, String)>, web::Path((ownername, reponame)): web::Path<(String, String)>,
web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : web::Query<GitWebQ>, web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : web::Query<GitWebQ>,
gitust : web::Data<Gitust>, gitust : web::Data<Gitust>,
auth : Option<basic::BasicAuth>, auth : Option<basic::BasicAuth>,
validator : web::Data<T>,
//auth : BasicAuth, //auth : BasicAuth,
) -> Result<GitMainTemplate<Vec<Entry>, Vec<(String, String)>>, error::Error> { ) -> Result<GitMainTemplate<Vec<Entry>, Vec<(String, String)>>, error::Error> {
// let authtorization = auth.ok_or(error::Error::Unauthorized("safe repo".to_string()))?; // let authtorization = auth.ok_or(error::Error::Unauthorized("safe repo".to_string()))?;
//let authorization = auth.and_then(|cred| validator.check_basic(&cred)).ok_or(error::Error::Unauthorized("safe repo".to_string()))?;
let rootname = match pathopt { let rootname = match pathopt {
None => {"".to_string()} None => {"".to_string()}
Some(s) => { Some(s) => {