~/selfhut

selfhut/src/clone.rs -rw-r--r-- 428 B
5c92aea0 — Arthur Melton undo that change 2 years ago

            
7dbdfabf arthurmelton
00c0a257 Arthur Melton
616316d3 Arthur Melton
00c0a257 Arthur Melton
7dbdfabf arthurmelton
7dbdfabf arthurmelton





1
2
3
4
5
6
7
8
9
10
11
12
13
use rocket::fs::NamedFile;
use crate::config::CONFIG;
use crate::PathBufWithDotfiles;
use std::path::Path;

#[get("/<repo>/<path..>", rank=3)]
pub async fn clone(repo: String, path: PathBufWithDotfiles) -> Option<NamedFile> {
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    repo_path.push(".git");
    repo_path.push(path.get());
    NamedFile::open(repo_path).await.ok()
}