7dbdfabf arthurmelton7dbdfabf arthurmelton1dc73f56 Arthur Melton7dbdfabf arthurmelton392c317a Arthur Melton7dbdfabf arthurmelton392c317a Arthur Melton1dc73f56 Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton7dbdfabf arthurmelton76d4fa6d Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton7dbdfabf arthurmelton392c317a Arthur Melton0016c2cc arthurmelton392c317a Arthur Melton0016c2cc arthurmelton392c317a Arthur Melton144cd6f8 arthurmelton392c317a Arthur Melton0016c2cc arthurmelton392c317a Arthur Melton468a751a Arthur Melton392c317a Arthur Melton7dbdfabf arthurmelton392c317a Arthur Melton0016c2cc arthurmelton392c317a Arthur Melton76d4fa6d Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton0016c2cc arthurmelton76d4fa6d Arthur Melton0016c2cc arthurmelton76d4fa6d Arthur Melton144cd6f8 arthurmelton76d4fa6d Arthur Melton0016c2cc arthurmelton76d4fa6d Arthur Melton468a751a Arthur Melton392c317a Arthur Melton76d4fa6d Arthur Melton7dbdfabf arthurmelton
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
use rocket_dyn_templates::{context, Template};
use crate::config::CONFIG;
use crate::utils::repo_config::repo_config;
use crate::git::commits::get_commits;
use crate::git::main_branch::main_branch;
use crate::git::file::{files, file};
use crate::PathBufWithDotfiles;
use std::ffi::OsStr;
use syntect::easy::HighlightLines;
use syntect::parsing::SyntaxSet;
use syntect::highlighting::{ThemeSet, Style};
use syntect::util::LinesWithEndings;
use syntect::html::highlighted_html_for_string;
use std::path::Path;
#[get("/<repo>/log", rank=2)]
pub fn tree_main(repo: String) -> Option<Template> {
let main_branch = main_branch(repo.clone())?;
Some(Template::render(
"repository/log",
context! {
title: format!("/ :: {}", repo.clone()),
repo: repo.clone(),
config: repo_config(repo.clone()),
domain: CONFIG.domain.to_string(),
active: "tree",
commits: get_commits(repo.clone(), 1, None),
branch: main_branch.clone(),
current_dir_file: "/",
current_dir: "/",
payment: CONFIG.payment_link.clone()
}
))
}
#[get("/<repo>/log/<branch>/<location..>", rank=2)]
pub fn tree(repo: String, branch: String, location: PathBufWithDotfiles) -> Option<Template> {
Some(Template::render(
"repository/log",
context! {
title: format!("/{} :: {}", location.get().display(), repo.clone()),
repo: repo.clone(),
config: repo_config(repo.clone()),
domain: CONFIG.domain.to_string(),
active: "tree",
commits: get_commits(repo.clone(), 1, None),
branch: branch.clone(),
current_dir_file: format!("/{}/", location.get().display()).replace("//", "/"),
current_dir: format!("/{}", location.get().display()),
payment: CONFIG.payment_link.clone()
}
))
}
}