fixes frontend getting resources from backend

This commit is contained in:
2026-05-07 04:24:04 +00:00
parent 014d258a45
commit 0ff4b86864
3 changed files with 63 additions and 11 deletions

View File

@@ -28,7 +28,11 @@ use std::{
use gix::open;
use tera::Tera;
use crate::backend::git::ToContext;
use crate::backend::{
MINTEE_DIR,
MINTEE_ASSETS,
git::ToContext,
};
#[derive(Debug, Clone)]
/// A revision for which a repository page may be rendered
@@ -134,9 +138,8 @@ impl Page {
pub fn render<W: Write>(
&self, dest: &mut W
) -> Result<(), Box<dyn Error>> {
/* TODO: replace ./assets/ with the actual templates directory,
* i.e. /usr/local/share/mintee/ */
let tera = Tera::new("./assets/templates/**/*")?;
let assets = format!("{}/templates/**/*", MINTEE_ASSETS);
let tera = Tera::new(&assets)?;
let mut page_template = self.kind.to_string();
use PageKind::*;
@@ -145,7 +148,11 @@ impl Page {
todo!()
},
Repo(r) => {
let repo = open(format!("{}/{}", r.entity, r.name))?;
let mut repo_path = PathBuf::from(MINTEE_DIR.to_string());
repo_path.push(r.entity);
repo_path.push(r.name);
let repo = open(repo_path)?;
/* TODO: handle specifying a commit, tag, or branch */
let head_tree = repo.head_tree()?;
let object;