19f9b68c arthurmeltonad9e5164 arthurmelton00c0a257 Arthur Melton0545f2a7 Arthur Meltonef55c0da arthurmelton0545f2a7 Arthur Melton94e2262d arthurmelton532ca616 Arthur Melton616316d3 Arthur Melton47885f67 Arthur Meltonf2f2d97d Arthur Melton01f10fe8 Arthur Melton76d4fa6d Arthur Melton00c0a257 Arthur Meltone4d868e2 Arthur Meltonef55c0da arthurmelton7dbdfabf arthurmelton7dbdfabf arthurmelton00c0a257 Arthur Melton0545f2a7 Arthur Melton00c0a257 Arthur Melton66cb4022 Arthur Melton80cce623 Arthur Melton00c0a257 Arthur Melton76d4fa6d Arthur Melton1268e21e Arthur Melton69345aa0 Arthur Meltonb1605a54 Arthur Meltonb961c5bf Arthur Melton00c0a257 Arthur Melton0545f2a7 Arthur Melton6c6e1160 Arthur Melton7dbdfabf arthurmelton66cb4022 Arthur Melton7dbdfabf arthurmelton80cce623 Arthur Melton5c44f94c Arthur Melton19f9b68c arthurmelton80cce623 Arthur Melton
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
#[macro_use]
extern crate rocket;
mod clone;
mod git;
mod index;
mod repository;
mod utils;
use utils::config;
use rocket::fs::relative;
use std::path::Path;
use crate::repository::log;
use crate::repository::raw;
use crate::repository::summary;
use crate::repository::tree;
use crate::utils::own_pathbuf::PathBufWithDotfiles;
use rocket_dyn_templates::Template;
#[launch]
fn rocket() -> _ {
rocket::build()
.mount(
"/",
routes![
file_server,
robots,
index::index,
summary::repository,
tree::tree_main,
tree::tree,
clone::clone,
raw::raw,
log::log_main,
log::log,
],
)
.attach(Template::fairing())
}
#[get("/static/<path..>")]
async fn file_server(path: PathBufWithDotfiles) -> Option<rocket::fs::NamedFile> {
let path = Path::new(relative!("static")).join(path.get());
rocket::fs::NamedFile::open(path).await.ok()
}
#[get("/robots.txt")]
async fn robots() -> Option<rocket::fs::NamedFile> {
let path = Path::new(relative!("static")).join(Path::new("robots.txt"));
rocket::fs::NamedFile::open(path).await.ok()
}