//! The main file browser use crate::{ git, templ_data::{files::Files, BaseData}, }; use actix_web::{web, HttpRequest, HttpResponse, Result}; use askama::Template; pub async fn render((req, path): (HttpRequest, web::Path)) -> Result { let repo = git::open(); let branch = repo.get_branch("main".into()).unwrap(); // FIXME: this is baaaaad let head = branch.get_head(); let tree = head.get_tree(); debug!("Loading path: `{}`", path); let _yield = tree.load(&path).unwrap(); debug!("{:#?}", _yield); let files = Files { base: BaseData { sitename: "dev.spacekookie.de".into(), ..BaseData::default() }, readme: None, path: "/".into(), } .render() .unwrap(); Ok(HttpResponse::Ok().content_type("text/html").body(files)) }