Compare commits

..

No commits in common. "510bbe738165ce8db077a65ea2574cf85bb6cf22" and "a562c4616c274b929ecff0d35b89f2aee0ab5186" have entirely different histories.

10 changed files with 27 additions and 34 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
/target
Cargo.lock
/.idea/

View File

@ -3,8 +3,8 @@ use std::ops::Add;
use git2::{Commit, ObjectType, Oid, Reference, Repository, Tree};
use crate::gitutils::gitdir::GitDir;
use crate::gitutils::gitfile::GitFile;
use crate::gitdir::GitDir;
use crate::gitfile::GitFile;
#[derive(Debug)]
pub enum GitBrowseEntry<'a> {

View File

@ -3,9 +3,9 @@ use std::ops::Add;
use git2::{ObjectType, Oid, Repository, BranchType};
use crate::git::GitBrowseEntry;
use crate::gitutils::gitcommit::GitRef;
use crate::gitutils::gitdir::GitDir;
use crate::gitutils::gitfile::GitFile;
use crate::gitcommit::GitRef;
use crate::gitdir::GitDir;
use crate::gitfile::GitFile;
use std::path::{PathBuf, Path};
use std::str::FromStr;

View File

@ -1,4 +0,0 @@
pub mod gitdir;
pub mod gitrepo;
pub mod gitcommit;
pub mod gitfile;

View File

@ -7,14 +7,13 @@ use std::process::Stdio;
use actix_files::Files;
use actix_session::{CookieSession, Session};
use actix_web::{App, Error, get, HttpMessage, HttpRequest, HttpResponse, HttpServer, post, Responder};
use actix_web::{App, Error, get, HttpMessage, HttpRequest, HttpResponse, HttpServer, post, Responder, web};
use actix_web::client::PayloadError;
use actix_web::dev::ServiceRequest;
use actix_web::http::{header, StatusCode};
use actix_web::http::header::Header;
use actix_web::http::header::IntoHeaderValue;
use actix_web::middleware::Logger;
use actix_web::web as webx;
use actix_web::web::{Buf, Bytes};
use actix_web_httpauth::extractors::AuthenticationError;
use actix_web_httpauth::extractors::basic::{BasicAuth, Config};
@ -28,25 +27,27 @@ use serde::Deserialize;
use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader};
use tokio::process::{Child, ChildStdout, Command};
use gitutils::gitcommit::GitRef;
use gitutils::gitdir::GitDir;
use gitutils::gitfile::GitFile;
use gitutils::gitrepo::GitRepo;
use gitcommit::GitRef;
use gitdir::GitDir;
use gitrepo::GitRepo;
use crate::git::GitBrowseEntry;
use crate::gitust::Gitust;
use crate::ite::SuperIterator;
use crate::reader::ToStream;
use crate::writer::Writer;
use crate::gitfile::GitFile;
mod git;
mod ite;
mod reader;
mod writer;
mod gitust;
mod gitdir;
mod gitrepo;
mod gitcommit;
mod gitfile;
mod error;
mod web;
mod gitutils;
#[derive(Template)]
#[template(path = "hello.html")]
@ -147,11 +148,9 @@ async fn chunk() -> HttpResponse {
#[get("/git/{owner}/{repo}.git")]
async fn git_main(
webx::Path((ownername, reponame)): webx::Path<(String, String)>,
webx::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : webx::Query<GitWebQ>,
gitust : webx::Data<Gitust>,
auth : Option<BasicAuth>,
//auth : BasicAuth,
web::Path((ownername, reponame)): web::Path<(String, String)>,
web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : web::Query<GitWebQ>,
gitust : web::Data<Gitust>
) -> Result<GitMainTemplate<Vec<Entry>, Vec<(String, String)>>, error::Error> {
let rootname = match pathopt {
None => {"".to_string()}
@ -198,10 +197,10 @@ async fn git_main(
}
//#[get("/git/{owner}/{repo}.git/{path:.*}")]
async fn git_proto(
mut payload : webx::Payload,
webx::Path((owner, reponame, path)): webx::Path<(String, String, String)>,
mut payload : web::Payload,
web::Path((owner, reponame, path)): web::Path<(String, String, String)>,
mut req: HttpRequest,
gitust : webx::Data<Gitust>,
gitust : web::Data<Gitust>,
auth : BasicAuth,
) -> io::Result<HttpResponse>{
//println!("enter git_proto");
@ -295,7 +294,7 @@ async fn manual_hello() -> impl Responder {
}
#[get("/{id}/{name}/index.html")]
async fn index(webx::Path((id, name)): webx::Path<(u32, String)>) -> impl Responder {
async fn index(web::Path((id, name)): web::Path<(u32, String)>) -> impl Responder {
format!("Hello {}! id:{}", name, id)
}
@ -352,14 +351,14 @@ async fn main() -> std::io::Result<()> {
// .route("/", web::get().to(hello_auth))
// )
.service(
webx::resource("/auth")
web::resource("/auth")
.wrap(auth)
.route(webx::get().to(hello_auth))
.route(web::get().to(hello_auth))
)
.service(
webx::resource("/git/{user}/{repo}.git/{path:.*}")
web::resource("/git/{user}/{repo}.git/{path:.*}")
// .wrap(auth)
.route(webx::route().to(git_proto))
.route(web::route().to(git_proto))
)
.service(
Files::new("/static", "static")
@ -367,7 +366,7 @@ async fn main() -> std::io::Result<()> {
.use_etag(true)
// .show_files_listing()
)
.route("/hey", webx::get().to(manual_hello))
.route("/hey", web::get().to(manual_hello))
})
.bind("127.0.0.1:8080")?
.run()

View File

@ -1 +0,0 @@
mod repo;

View File