Compare commits
3 Commits
e3008262fc
...
9832f30360
Author | SHA1 | Date |
---|---|---|
hubert | 9832f30360 | |
hubert | 22836e1f3a | |
hubert | 90ea298a61 |
|
@ -172,7 +172,10 @@ async fn main() -> std::io::Result<()> {
|
||||||
.service(hello_test)
|
.service(hello_test)
|
||||||
.service(index)
|
.service(index)
|
||||||
.service(askama)
|
.service(askama)
|
||||||
.service(repo::git_main)
|
.service(
|
||||||
|
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)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::auth::AuthValidator;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use actix_web::web;
|
use actix_web::web;
|
||||||
|
@ -55,15 +56,17 @@ pub struct GitWebQ {
|
||||||
branch: Option<String>,
|
branch: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/git/{owner}/{repo}.git")]
|
//#[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::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) => {
|
||||||
|
|
Loading…
Reference in New Issue