aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-06-22 06:23:04 +0200
committerKatharina Fey <kookie@spacekookie.de>2020-06-22 06:23:04 +0200
commite30713b84bc9e66f7a8e8d2f51e953472cac28e4 (patch)
tree3098b1c77a978dcad0c828f57386d1c8999aa26b /src/main.rs
parent84a9a0ccee713e26a28ff5e54ea3776085d93b5f (diff)
Committing all the libgit2 progress before throwing it away
I don't think libgit2 is the way forward to make any of this work. There's so much work involved in parsing the git k-v store, and the library itself is essentially of zero help for most of the heavy lifting.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 6d0ef79..7e589ec 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,22 +1,36 @@
+mod git;
mod pages;
mod repo;
-// mod router;
-mod types;
+mod templ_data;
use actix_files as fs;
-use actix_web::{web, App, HttpServer};
+use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
use std::io;
use std::path::PathBuf;
#[actix_rt::main]
async fn main() -> io::Result<()> {
- std::env::set_var("RUST_LOG", "actix_web=info");
+ std::env::set_var("RUST_LOG", "actix_server=info,octopus=debug");
env_logger::init();
let root = PathBuf::new();
+ let repo = git::repo::Repo::new(".");
+ let commits = git::log::create_commit_log(
+ "84a9a0ccee713e26a28ff5e54ea3776085d93b5f".into(),
+ &repo.inner,
+ );
+
HttpServer::new(move || {
App::new()
.service(fs::Files::new("/static", root.join("static")))
+ // This is a bit of a hack so that people don't get the
+ // 404 on the root page. Especially as long as octopus
+ // doesn't have the account overview yet!
+ .service(web::resource("/").route(web::get().to(|_: HttpRequest| {
+ HttpResponse::PermanentRedirect()
+ .header("Location", "octopus")
+ .finish()
+ })))
.service(web::resource("/{repo}").route(web::get().to(pages::repo::about)))
.service(web::resource("/{repo}/details").route(web::get().to(pages::repo::details)))
.default_service(web::resource("").route(web::get().to(pages::p404)))