From 22836e1f3a8519ab05de5c59087b6cc0030c5521 Mon Sep 17 00:00:00 2001 From: hubert Date: Thu, 22 Jul 2021 13:36:48 +0200 Subject: [PATCH] generalise git_main --- src/main.rs | 2 +- src/web/repo.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1203bb0..fd8c409 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,7 +174,7 @@ async fn main() -> std::io::Result<()> { .service(askama) .service( webx::resource("/git/{owner}/{repo}.git") - .route(webx::get().to(repo::git_main)) + .route(webx::get().to(repo::git_main::)) ) .service(hello_session) .service(chunk) diff --git a/src/web/repo.rs b/src/web/repo.rs index 8c872e9..f78f820 100644 --- a/src/web/repo.rs +++ b/src/web/repo.rs @@ -1,3 +1,4 @@ +use crate::auth::AuthValidator; use std::path::Path; use actix_web::web; @@ -56,11 +57,12 @@ pub struct GitWebQ { } //#[get("/git/{owner}/{repo}.git")] -pub async fn git_main( +pub async fn git_main( web::Path((ownername, reponame)): web::Path<(String, String)>, web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : web::Query, gitust : web::Data, auth : Option, + validator : web::Data, //auth : BasicAuth, ) -> Result, Vec<(String, String)>>, error::Error> { // let authtorization = auth.ok_or(error::Error::Unauthorized("safe repo".to_string()))?;