~/selfhut

0016c2cc68468a3e869ec7dc49adf97b603da8fe — arthurmelton 8811ff71 2 years ago
clippy
M src/git/blame.rs => src/git/blame.rs +3 -3
@@ 4,13 4,13 @@ use serde_derive::Serialize;


use std::path::Path;

pub fn blame<'a>(repo: String, branch: String, path: String) -> Option<Vec<Blame>> {
    if branch.contains(":") {
pub fn blame(repo: String, branch: String, path: String) -> Option<Vec<Blame>> {
    if branch.contains(':') {
        return None;
    }
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    let repo_clone = repo.clone();
    let repo_clone = repo;
    let repo = git2::Repository::open(repo_path).ok()?;
    let blame = repo.blame_file(Path::new(&path), None).ok()?;
    let mut blames = Vec::new();

M src/git/branches.rs => src/git/branches.rs +13 -20
@@ 7,27 7,20 @@ pub fn branches(repo_name: String) -> Option<Vec<Branch>> {

    repo_path.push(format!("{}.git", repo_name));
    let repo = git2::Repository::open(repo_path).ok()?;
    let mut branches = Vec::new();
    for i in repo.branches(Some(git2::BranchType::Local)).ok()? {
        match i {
            Ok(x) => match x.0.name() {
                Ok(name) => match name {
                    Some(name) => branches.push(Branch {
                        branch: name.to_string(),
                        commit: match get_commits(
                            repo_name.clone(),
                            1,
                            Some(name.to_string()),
                            None,
                        ) {
                            Some(x) => x.first().cloned(),
                            None => None,
                        },
                    }),
                    None => {}
    for i in (repo.branches(Some(git2::BranchType::Local)).ok()?).flatten() {
        if let Ok(Some(name)) = i.0.name() {
            branches.push(Branch {
                branch: name.to_string(),
                commit: match get_commits(
                    repo_name.clone(),
                    1,
                    Some(name.to_string()),
                    None,
                ) {
                    Some(x) => x.first().cloned(),
                    None => None,
                },
                Err(_) => {}
            },
            Err(_) => {}
            })
        }
    }
    Some(branches)

M src/git/commits.rs => src/git/commits.rs +41 -47
@@ 49,55 49,49 @@ pub fn get_commits(

    while i < ammount && commit.is_some() && commit.as_ref().unwrap().is_ok() {
        let commit_rev = commit.unwrap().unwrap();
        let repo_commit = repo.find_commit(commit_rev);
        match repo_commit {
            Ok(repo_commit) => {
                let mut allowed = true;
                if path.is_some() {
                    let path_value = path.as_ref().unwrap();
                    match diffs(repo_commit.clone(), &repo) {
                        Some(diff) => {
                            let files = diff
                                .deltas()
                                .map(|i| i.new_file().path())
                                .filter(|i| i.is_some())
                                .map(|i| i.unwrap().to_string_lossy())
                                .filter(|i| i.starts_with(path_value))
                                .count();
                            allowed = files > 0;
                        }
                        None => {}
                    }
                }
                if allowed {
                    let time =
                        Duration::seconds(repo_commit.time().seconds() - Utc::now().timestamp());
                    commits.push(Commits {
                        commit_hash: commit_rev.to_string(),
                        commit: repo_commit.message().unwrap_or("").to_string(),
                        commitie: repo_commit
                            .committer()
                            .name()
                            .unwrap_or("Unknown")
                            .to_string(),
                        commit_hash_short: commit_rev.to_string()[..8].to_string(),
                        time_utc: {
                            let date = chrono::naive::NaiveDateTime::from_timestamp(
                                Utc::now().timestamp() + time.num_seconds(),
                                0,
                            );
                            format!(
                                "{} {} UTC",
                                date.date().format("%Y-%m-%d"),
                                date.time().format("%H:%M:%S")
                            )
                        },
                        time_relitive: HumanTime::from(time).to_string(),
                        commit_body: repo_commit.body().unwrap_or("").to_string(),
                    });
                    i += 1;
        if let Ok(repo_commit) = repo_commit {
            let mut allowed = true;
            if path.is_some() {
                let path_value = path.as_ref().unwrap();
                if let Some(diff) = diffs(repo_commit.clone(), &repo) {
                    let files = diff
                        .deltas()
                        .map(|i| i.new_file().path())
                        .filter(|i| i.is_some())
                        .map(|i| i.unwrap().to_string_lossy())
                        .filter(|i| i.starts_with(path_value))
                        .count();
                    allowed = files > 0;
                }
            }
            Err(_) => {}
            if allowed {
                let time =
                    Duration::seconds(repo_commit.time().seconds() - Utc::now().timestamp());
                commits.push(Commits {
                    commit_hash: commit_rev.to_string(),
                    commit: repo_commit.message().unwrap_or("").to_string(),
                    commitie: repo_commit
                        .committer()
                        .name()
                        .unwrap_or("Unknown")
                        .to_string(),
                    commit_hash_short: commit_rev.to_string()[..8].to_string(),
                    time_utc: {
                        let date = chrono::naive::NaiveDateTime::from_timestamp(
                            Utc::now().timestamp() + time.num_seconds(),
                            0,
                        );
                        format!(
                            "{} {} UTC",
                            date.date().format("%Y-%m-%d"),
                            date.time().format("%H:%M:%S")
                        )
                    },
                    time_relitive: HumanTime::from(time).to_string(),
                    commit_body: repo_commit.body().unwrap_or("").to_string(),
                });
                i += 1;
            }
        }
        commit = revwalk.next();
    }

M src/git/file.rs => src/git/file.rs +4 -5
@@ 6,7 6,7 @@ use serde_derive::Serialize;

use std::path::PathBuf;

pub fn files(repo: String, branch: String, path: String) -> Option<Vec<File>> {
    if branch.contains(":") {
    if branch.contains(':') {
        return None;
    }
    let mut repo_path = CONFIG.git_location.clone();

@@ 44,7 44,7 @@ pub fn files(repo: String, branch: String, path: String) -> Option<Vec<File>> {

}

pub fn file(repo: String, branch: String, path: String) -> Option<(File, Option<String>, Vec<u8>)> {
    if branch.contains(":") {
    if branch.contains(':') {
        return None;
    }
    let mut repo_path = CONFIG.git_location.clone();

@@ 75,9 75,7 @@ pub fn file(repo: String, branch: String, path: String) -> Option<(File, Option<

            };
            return Some((file, content, blob.content().iter().map(|x| *x).collect()));
        }
        _ => {
            return None;
        }
        _ => None
    }
}


@@ 91,6 89,7 @@ pub struct File {

}

#[derive(Serialize)]
#[allow(non_camel_case_types)]
pub enum FileType {
    blob,
    tree,

M src/git/get_all.rs => src/git/get_all.rs +2 -2
@@ 2,12 2,12 @@ use crate::config::CONFIG;

use git2::ObjectType;

pub fn files(repo: String, branch: String, path: String) -> Option<Vec<String>> {
    if branch.contains(":") {
    if branch.contains(':') {
        return None;
    }
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    let repo_clone = repo.clone();
    let repo_clone = repo;
    let repo = git2::Repository::open(repo_path).ok()?;
    let obj = repo.revparse_single(&format!("{}:{}", branch, path)).ok()?;
    let mut returns = Vec::new();

M src/git/main_branch.rs => src/git/main_branch.rs +1 -0
@@ 4,6 4,7 @@ pub fn main_branch(repo_name: String) -> Option<String> {

    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo_name));
    let repo = git2::Repository::open(repo_path).ok()?;
    #[allow(clippy::let_and_return)]
    let x = Some(
        repo.branches(Some(git2::BranchType::Local))
            .ok()?

M src/git/repos.rs => src/git/repos.rs +6 -9
@@ 6,24 6,22 @@ use std::fs;

pub fn get_repos() -> Option<Vec<Repo>> {
    let home = CONFIG.git_location.clone();
    Some(sort_modified(
        fs::read_dir(home.clone())
        fs::read_dir(home)
            .ok()?
            .filter(|path| path.is_ok())
            .map(|path| path.unwrap())
            .filter_map(|path| path.ok())
            .filter(|path| path.file_type().is_ok())
            .filter(|path| path.file_type().unwrap().is_dir())
            .filter(|path| path.metadata().is_ok())
            .filter(|path| path.metadata().unwrap().modified().is_ok())
            .map(|path| path.file_name().into_string())
            .filter(|path| path.is_ok())
            .map(|path| path.unwrap())
            .filter(|path| !path.starts_with("."))
            .filter_map(|path| path.ok())
            .filter(|path| !path.starts_with('.'))
            .filter(|path| path.ends_with(".git"))
            .map(|path| {
                let name = path[0..path.len() - 4].to_string();
                Repo {
                    name: name.clone(),
                    description: repo_config(name).description.unwrap_or("".to_string()),
                    description: repo_config(name).description.unwrap_or_default(),
                }
            })
            .collect::<Vec<Repo>>(),

@@ 36,8 34,7 @@ pub struct Repo {

    pub description: String,
}

fn sort_modified(repos: Vec<Repo>) -> Vec<Repo> {
    let mut repos = repos.clone();
fn sort_modified(mut repos: Vec<Repo>) -> Vec<Repo> {
    let home = CONFIG.git_location.clone();
    repos.sort_by(|a, b| {
        let mut a_loc = home.clone();

M src/git/tag.rs => src/git/tag.rs +5 -7
@@ 17,19 17,17 @@ pub fn get_tag(

    let _ = repo.tag_foreach(|x, y| {
        if (name.is_some() && name.as_ref().unwrap().as_bytes() == &y[10..]) || name.is_none() {
            if i >= after && (total < amount + after || i < amount - after) {
                match get_commits(repo_name.clone(), 1, Some(x.to_string()), None) {
                    Some(z) => match z.first() {
                        Some(z) => tags.push(Tags {
                if let Some(z) = get_commits(repo_name.clone(), 1, Some(x.to_string()), None) {
                    if let Some(z) = z.first() {
                        tags.push(Tags {
                            commit: z.clone(),
                            body: match repo.find_tag(x) {
                                Ok(x) => x.message().unwrap_or("").to_string(),
                                Err(_) => "".to_string(),
                            },
                            name: std::str::from_utf8(&y[10..]).unwrap_or("").to_string(),
                        }),
                        None => {}
                    },
                    None => {}
                        })
                    }
                }
            }
            if i < after + 1 {

M src/index.rs => src/index.rs +4 -4
@@ 15,13 15,13 @@ pub fn index(page: Option<usize>, search: Option<String>) -> Option<Template> {

        repos = repos
            .iter()
            .filter(|repo| {
                repo.name.contains(&*search.as_ref().unwrap())
                    || repo.description.contains(&*search.as_ref().unwrap())
                repo.name.contains(search.as_ref().unwrap())
                    || repo.description.contains(search.as_ref().unwrap())
            })
            .map(|repo| repo.clone())
            .collect::<Vec<Repo>>();
    }
    let total_page = if repos.len() > 0 {
    let total_page = if !repos.is_empty() {
        (repos.len() - 1) / PAGE_REPO_COUNT + 1
    } else {
        1

@@ 38,7 38,7 @@ pub fn index(page: Option<usize>, search: Option<String>) -> Option<Template> {

            user: CONFIG.name.clone(),
            description: md_to_html(&CONFIG.description.clone()),
            repos: repos[(page-1)*PAGE_REPO_COUNT..last_item].to_vec(),
            search: search.unwrap_or("".to_string()),
            search: search.unwrap_or_default(),
            page,
            total_page,
            page_inc: page+1,

M src/main.rs => src/main.rs +1 -0
@@ 1,3 1,4 @@

#![allow(clippy::map_clone)] 
#[macro_use]
extern crate rocket;
mod clone;

M src/repository/archive.rs => src/repository/archive.rs +2 -2
@@ 21,7 21,7 @@ pub fn archive(repo: String, oid: String) -> ByteStream![Vec<u8>] {

fn get_tar(repo: String, oid: String, path: String) -> Option<Vec<u8>> {
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    let repo_clone = repo.clone();
    let repo_clone = repo;
    let repo = git2::Repository::open(repo_path).unwrap();
    let obj = repo.revparse_single(&format!("{}:{}", oid, path)).ok()?;
    let blob = obj.as_blob()?;

@@ 35,5 35,5 @@ fn get_tar(repo: String, oid: String, path: String) -> Option<Vec<u8>> {

        blob.content(),
    )
    .unwrap();
    Some(ar.into_inner().ok()?)
    ar.into_inner().ok()
}

M src/repository/blame.rs => src/repository/blame.rs +4 -7
@@ 46,17 46,14 @@ pub fn blames(repo: String, branch: String, location: PathBufWithDotfiles) -> Op

    Some(Template::render(
        "repository/blame",
        context! {
            title: format!("/{} :: {}", location.get().display(), repo.clone()),
            title: format!("/{} :: {}", location.get().display(), repo),
            repo: repo.clone(),
            config: repo_config(repo.clone()),
            domain: CONFIG.domain.to_string(),
            user: CONFIG.name.to_string(),
            active: "tree",
            commit: match get_commits(repo.clone(), 1, Some(branch.clone()), Some(format!("{}", location.get().display()).replace("//", "/"))) {
                Some(x) => match x.clone().get(0) {
                    Some(x) => Some(x.clone()),
                    None => None
                }
            commit: match get_commits(repo, 1, Some(branch.clone()), Some(format!("{}", location.get().display()).replace("//", "/"))) {
                Some(x) => x.get(0).map(|x| x.clone()),
                None => None
            },
            files: file,

@@ 64,7 61,7 @@ pub fn blames(repo: String, branch: String, location: PathBufWithDotfiles) -> Op

            lines,
            fluid: "true",
            blame: blames,
            branch: branch.clone(),
            branch,
            current_dir_file: format!("/{}/", location.get().display()).replace("//", "/"),
            current_dir: format!("/{}", location.get().display()),
            payment: CONFIG.payment_link.clone(),

M src/repository/commit.rs => src/repository/commit.rs +8 -16
@@ 15,7 15,7 @@ use rocket_dyn_templates::{context, Template};

pub fn commit(repo: String, oid: String) -> Option<Template> {
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    let repo_clone = repo.clone();
    let repo_clone = repo;
    let repo = git2::Repository::open(repo_path).ok()?;
    let commit = repo.find_commit(git2::Oid::from_str(&oid).ok()?).ok()?;
    let diff = diffs(commit.clone(), &repo)?;

@@ 23,7 23,7 @@ pub fn commit(repo: String, oid: String) -> Option<Template> {

    Some(Template::render(
        "repository/commit",
        context! {
            title: format!("{} :: {}", oid, repo_clone.clone()),
            title: format!("{} :: {}", oid, repo_clone),
            repo: repo_clone.clone(),
            config: repo_config(repo_clone.clone()),
            domain: CONFIG.domain.to_string(),

@@ 31,20 31,14 @@ pub fn commit(repo: String, oid: String) -> Option<Template> {

            active: "log",
            payment: CONFIG.payment_link.clone(),
            mailing_list: CONFIG.mailing_list.clone(),
            commit: match get_commits(repo_clone.clone(), 1, Some(oid.clone()), None) {
                Some(x) => match x.clone().get(0) {
                    Some(x) => Some(x.clone()),
                    None => None
                }
            commit: match get_commits(repo_clone.clone(), 1, Some(oid), None) {
                Some(x) => x.get(0).map(|x| x.clone()),
                None => None
            },
            parent: match commit.parent_id(0) {
                Ok(parent) => {
                    match get_commits(repo_clone.clone(), 1, Some(parent.to_string()), None) {
                        Some(x) => match x.first() {
                            Some(x) => Some(x.clone()),
                            None => None
                        },
                    match get_commits(repo_clone, 1, Some(parent.to_string()), None) {
                        Some(x) => x.first().map(|x| x.clone()),
                        None => None
                    }
                },

@@ 55,8 49,7 @@ pub fn commit(repo: String, oid: String) -> Option<Template> {

            deletions: stats.deletions(),
            files: {
                let mut items = Vec::new();
                let mut x = 0;
                for i in diff.deltas() {
                for (x, i) in diff.deltas().enumerate() {
                    let patch = git2::Patch::from_diff(&diff, x).ok()??;
                    let hunk_n = patch.num_hunks();
                    let mut hunks = Vec::new();

@@ 112,7 105,6 @@ pub fn commit(repo: String, oid: String) -> Option<Template> {

                        deletions: patch.line_stats().ok()?.2,
                        hunks
                    });
                    x+=1;
                }
                items
            },

@@ 124,7 116,7 @@ pub fn commit(repo: String, oid: String) -> Option<Template> {

pub fn patch(repo: String, oid: String) -> Option<String> {
    let mut repo_path = CONFIG.git_location.clone();
    repo_path.push(format!("{}.git", repo));
    let _repo_clone = repo.clone();
    let _repo_clone = repo;
    let repo = git2::Repository::open(repo_path).ok()?;
    let commit = repo.find_commit(git2::Oid::from_str(&oid).ok()?).ok()?;
    let _diff = diffs(commit, &repo)?;

M src/repository/log.rs => src/repository/log.rs +7 -7
@@ 32,14 32,14 @@ pub fn log_main(repo: String, from: Option<String>) -> Option<Template> {

    Some(Template::render(
        "repository/log",
        context! {
            title: format!("/ :: {}", repo.clone()),
            title: format!("/ :: {}", repo),
            repo: repo.clone(),
            config: repo_config(repo.clone()),
            config: repo_config(repo),
            domain: CONFIG.domain.to_string(),
            user: CONFIG.name.to_string(),
            active: "log",
            commits,
            branch: main_branch.clone(),
            branch: main_branch,
            current_dir_file: "/",
            current_dir: "/",
            payment: CONFIG.payment_link.clone(),

@@ 59,7 59,7 @@ pub fn log(

    let commits = get_commits(
        repo.clone(),
        21,
        Some(from.unwrap_or(branch.clone())),
        Some(from.unwrap_or_else(|| branch.clone())),
        Some(format!("{}", location.get().display()).replace("//", "/")),
    );
    let last_commit = match commits {

@@ 84,14 84,14 @@ pub fn log(

    Some(Template::render(
        "repository/log",
        context! {
            title: format!("/{} :: {}", location.get().display(), repo.clone()),
            title: format!("/{} :: {}", location.get().display(), repo),
            repo: repo.clone(),
            config: repo_config(repo.clone()),
            config: repo_config(repo),
            domain: CONFIG.domain.to_string(),
            user: CONFIG.name.to_string(),
            active: "log",
            commits,
            branch: branch.clone(),
            branch,
            current_dir_file: format!("/{}/", location.get().display()).replace("//", "/"),
            current_dir: format!("/{}", location.get().display()),
            payment: CONFIG.payment_link.clone(),

M src/repository/raw.rs => src/repository/raw.rs +2 -2
@@ 4,8 4,8 @@ use crate::PathBufWithDotfiles;

#[get("/<repo>/blob/<branch>/<location..>", rank = 2)]
pub fn raw(repo: String, branch: String, location: PathBufWithDotfiles) -> Option<Vec<u8>> {
    match file(
        repo.clone(),
        branch.clone(),
        repo,
        branch,
        location.get().display().to_string(),
    ) {
        Some(file) => Some(file.2),

M src/repository/refs.rs => src/repository/refs.rs +5 -8
@@ 9,14 9,11 @@ use rocket_dyn_templates::{context, Template};

pub fn refs(repo: String, page: Option<usize>) -> Option<Template> {
    let mut tags = get_tag(repo.clone(), 10, (page.unwrap_or(1) - 1) * 10, None);
    let mut pages = 1;
    match tags {
        Some(ref mut x) => pages = x.1 / 10 + 1,
        None => {}
    }
    if let Some(ref mut x) = tags { pages = x.1 / 10 + 1 }
    Some(Template::render(
        "repository/refs",
        context! {
            title: format!("/ :: {}", repo.clone()),
            title: format!("/ :: {}", repo),
            repo: repo.clone(),
            config: repo_config(repo.clone()),
            domain: CONFIG.domain.to_string(),

@@ 26,7 23,7 @@ pub fn refs(repo: String, page: Option<usize>) -> Option<Template> {

            current_dir: "/",
            payment: CONFIG.payment_link.clone(),
            mailing_list: CONFIG.mailing_list.clone(),
            branch: branches(repo.clone()),
            branch: branches(repo),
            tag: tags,
            page_dec: page.unwrap_or(1)-1,
            page_inc: page.unwrap_or(1)+1,

@@ 43,9 40,9 @@ pub fn refs_id(repo: String, name: String) -> Option<Template> {

    Some(Template::render(
        "repository/ref",
        context! {
            title: format!("/ :: {}", repo.clone()),
            title: format!("/ :: {}", repo),
            repo: repo.clone(),
            config: repo_config(repo.clone()),
            config: repo_config(repo),
            domain: CONFIG.domain.to_string(),
            active: "refs",
            current_dir_file: "/",

M src/repository/summary.rs => src/repository/summary.rs +2 -5
@@ 24,11 24,8 @@ pub fn repository(repo: String) -> Option<Template> {

            active: "summary",
            preview: get_commits(repo.clone(), 3, None, None),
            main_branch,
            tag: match get_tag(repo.clone(), 1, 0, None) {
                Some(x) => match x.0.get(0) {
                    Some(x) => Some(x.clone()),
                    None => None
                },
            tag: match get_tag(repo, 1, 0, None) {
                Some(x) => x.0.get(0).map(|x| x.clone()),
                None => None
            },
            payment: CONFIG.payment_link.clone(),

M src/repository/tree.rs => src/repository/tree.rs +8 -17
@@ 19,17 19,14 @@ pub fn tree_main(repo: String) -> Option<Template> {

    Some(Template::render(
        "repository/tree",
        context! {
            title: format!("/ :: {}", repo.clone()),
            title: format!("/ :: {}", repo),
            repo: repo.clone(),
            config: repo_config(repo.clone()),
            domain: CONFIG.domain.to_string(),
            user: CONFIG.name.to_string(),
            active: "tree",
            commit: match get_commits(repo.clone(), 1, None, None) {
                Some(x) => match x.get(0) {
                    Some(x) => Some(x.clone()),
                    None => None
                }
                Some(x) => x.get(0).map(|x| x.clone()),
                None => None
            },
            branch: main_branch.clone(),

@@ 73,20 70,17 @@ pub fn tree(repo: String, branch: String, location: PathBufWithDotfiles) -> Opti

            Some(Template::render(
                "repository/file",
                context! {
                    title: format!("/{} :: {}", location.get().display(), repo.clone()),
                    title: format!("/{} :: {}", location.get().display(), repo),
                    repo: repo.clone(),
                    config: repo_config(repo.clone()),
                    domain: CONFIG.domain.to_string(),
                    user: CONFIG.name.to_string(),
                    active: "tree",
                    commit: match get_commits(repo.clone(), 1, Some(branch.clone()), Some(format!("{}", location.get().display()).replace("//", "/"))) {
                        Some(x) => match x.clone().get(0) {
                            Some(x) => Some(x.clone()),
                            None => None
                        }
                    commit: match get_commits(repo, 1, Some(branch.clone()), Some(format!("{}", location.get().display()).replace("//", "/"))) {
                        Some(x) => x.get(0).map(|x| x.clone()),
                        None => None
                    },
                    branch: branch.clone(),
                    branch,
                    files: file,
                    current_dir_file: format!("/{}/", location.get().display()).replace("//", "/"),
                    current_dir: format!("/{}", location.get().display()),

@@ 101,17 95,14 @@ pub fn tree(repo: String, branch: String, location: PathBufWithDotfiles) -> Opti

        None => Some(Template::render(
            "repository/tree",
            context! {
                title: format!("/{} :: {}", location.get().display(), repo.clone()),
                title: format!("/{} :: {}", location.get().display(), repo),
                repo: repo.clone(),
                config: repo_config(repo.clone()),
                domain: CONFIG.domain.to_string(),
                user: CONFIG.name.to_string(),
                active: "tree",
                commit: match get_commits(repo.clone(), 1, Some(branch.clone()), Some(format!("{}", location.get().display()).replace("//", "/"))) {
                    Some(x) => match x.clone().get(0) {
                        Some(x) => Some(x.clone()),
                        None => None
                    }
                    Some(x) => x.get(0).map(|x| x.clone()),
                    None => None
                },
                branch: branch.clone(),

M src/utils/config.rs => src/utils/config.rs +1 -1
@@ 18,7 18,7 @@ lazy_static! {

                name: "Example User".to_string(),
                description: "This is billy and he loves his [website](https://example.com)!!!"
                    .to_string(),
                git_location: dirs::home_dir().unwrap_or(PathBuf::from("/")),
                git_location: dirs::home_dir().unwrap_or_else(|| PathBuf::from("/")),
                domain: "127.0.0.1".to_string(),
                payment_link: None,
                mailing_list: None,

M src/utils/repo_config.rs => src/utils/repo_config.rs +3 -3
@@ 3,9 3,9 @@ use crate::git::main_branch::main_branch;

use serde_derive::{Deserialize, Serialize};

pub fn repo_config(repo: String) -> RepoConfig {
    let main_branch = main_branch(repo.clone()).unwrap_or("".to_string());
    let content = match file(repo.clone(), main_branch.clone(), "repo.toml".to_string()) {
        Some(file) => file.1.unwrap_or("".to_string()),
    let main_branch = main_branch(repo.clone()).unwrap_or_default();
    let content = match file(repo, main_branch, "repo.toml".to_string()) {
        Some(file) => file.1.unwrap_or_default(),
        None => "".to_string(),
    };
    match toml::from_str(&content) {