generalise git_main
This commit is contained in:
parent
90ea298a61
commit
22836e1f3a
|
@ -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::<auth::TestValidator>))
|
||||
)
|
||||
.service(hello_session)
|
||||
.service(chunk)
|
||||
|
|
|
@ -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<T : AuthValidator>(
|
||||
web::Path((ownername, reponame)): web::Path<(String, String)>,
|
||||
web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : web::Query<GitWebQ>,
|
||||
gitust : web::Data<Gitust>,
|
||||
auth : Option<basic::BasicAuth>,
|
||||
validator : web::Data<T>,
|
||||
//auth : BasicAuth,
|
||||
) -> Result<GitMainTemplate<Vec<Entry>, Vec<(String, String)>>, error::Error> {
|
||||
// let authtorization = auth.ok_or(error::Error::Unauthorized("safe repo".to_string()))?;
|
||||
|
|
Loading…
Reference in New Issue