Compare commits

..

No commits in common. "97ebae11f8955c1cb1ccf5e11cdd5f25c20c6c28" and "dee090ad587494db11c116d9b9e7e03c0b16070b" have entirely different histories.

2 changed files with 3 additions and 30 deletions

View File

@ -14,4 +14,3 @@ actix-files = "0.5.0"
askama = "0.10.5"
askama_actix = "0.11.1"
env_logger = "0.8.4"
serde = "1.0.126"

View File

@ -17,7 +17,6 @@ use env_logger::Env;
use crate::ite::SuperIterator;
use std::ops::Add;
use std::path::{PathBuf, Path};
use serde::Deserialize;
#[derive(Template)]
#[template(path = "hello.html")]
@ -84,24 +83,8 @@ async fn hello_auth(req : HttpRequest) -> impl Responder {
}
}
#[derive(Deserialize)]
struct GitWebQ {
commit: Option<String>,
path: Option<String>,
}
#[get("/git/{owner}/{repo}.git")]
async fn git_main(web::Path((owner, reponame)): web::Path<(String, String)>, web::Query(GitWebQ{commit : commitnameopt, path : pathopt}) : web::Query<GitWebQ>) -> impl Responder {
let commitname = match commitnameopt {
None => {"master".to_string()}
Some(s) => {s}
};
let rootname = match pathopt {
None => {"/".to_string()}
Some(s) => {s}
};
#[get("/git/{owner}/{repo}/{commit}/{path:.*}")]
async fn git_main(web::Path((owner, reponame, commitname, rootname)): web::Path<(String, String, String, String)>) -> impl Responder {
let repo = GitRepo::new();
let path : Vec<(String, String)> = rootname.split("/").map_accum("/git/".to_string() + &owner + "/" + &reponame + "/" + &commitname, |str_ref, b| {
let href = b + "/" + str_ref;
@ -115,10 +98,6 @@ async fn git_main(web::Path((owner, reponame)): web::Path<(String, String)>, web
let user = User { name : "Hubert".to_string()};
GitMainTemplate { repo, browse : browse, root : path, user_opt : Some(user)}
}
//#[get("/git/{owner}/{repo}.git/{path:.*}")]
async fn git_proto(web::Path((owner, reponame)): web::Path<(String, String)>, req: HttpRequest) -> impl Responder{
"not yet implemented"
}
#[post("/echo")]
async fn echo(req_body: String) -> impl Responder {
@ -176,7 +155,6 @@ async fn main() -> std::io::Result<()> {
.service(askama)
.service(git_main)
.service(hello_session)
//.service(git_proto)
// .service(
// web::scope("/auth")
// .wrap(auth)
@ -187,10 +165,6 @@ async fn main() -> std::io::Result<()> {
.wrap(auth)
.route(web::get().to(hello_auth))
)
.service(
web::resource("/git/{user}/{repo}.git/{path:.*}")
.route(web::route().to(git_proto))
)
.service(
Files::new("/static", "static")
.use_last_modified(true)
@ -202,4 +176,4 @@ async fn main() -> std::io::Result<()> {
.bind("127.0.0.1:8080")?
.run()
.await
}
}