~/selfhut

5096786018c6ec4ea31062e152a94f197cbc8e44 — Arthur Melton 7dbdfabf 2 years ago
allow donation
M src/repository/log.rs => src/repository/log.rs +3 -1
@@ 27,7 27,8 @@ pub fn tree_main(repo: String) -> Option<Template> {

                commits: get_commits(repo.clone(), 1, None),
                branch: main_branch.clone(),
                current_dir_file: "/",
                current_dir: "/"
                current_dir: "/",
                payment: CONFIG.payment_link.clone()
            }
        ))
}

@@ 46,6 47,7 @@ pub fn tree(repo: String, branch: String, location: PathBufWithDotfiles) -> Opti

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

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

                        None => None
                    },
                    None => None
                }
                },
                payment: CONFIG.payment_link.clone()
            }
        ))
}

M src/repository/tree.rs => src/repository/tree.rs +6 -3
@@ 34,7 34,8 @@ pub fn tree_main(repo: String) -> Option<Template> {

                branch: main_branch.clone(),
                files: files(repo, main_branch, "".to_string()),
                current_dir_file: "/",
                current_dir: "/"
                current_dir: "/",
                payment: CONFIG.payment_link.clone()
            }
        ))
}

@@ 77,7 78,8 @@ pub fn tree(repo: String, branch: String, location: PathBufWithDotfiles) -> Opti

                    current_dir: format!("/{}", location.get().display()),
                    fluid: "true",
                    content,
                    lines
                    lines,
                    payment: CONFIG.payment_link.clone()
                }
            ))
        },

@@ 100,7 102,8 @@ pub fn tree(repo: String, branch: String, location: PathBufWithDotfiles) -> Opti

                    branch: branch.clone(),
                    files: files(repo, branch, location.get().display().to_string()),
                    current_dir_file: format!("/{}/", location.get().display()).replace("//", "/"),
                    current_dir: format!("/{}", location.get().display())
                    current_dir: format!("/{}", location.get().display()),
                    payment: CONFIG.payment_link.clone()
                }
            ))
        }

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

                description: "This is billy and he loves his [website](https://example.com)!!!"
                    .to_string(),
                git_location: dirs::home_dir().unwrap_or(PathBuf::from("/")),
                domain: "127.0.0.1".to_string()
                domain: "127.0.0.1".to_string(),
                payment_link: None,
            };
            config.pop();
            let _ = fs::create_dir_all(config.clone());

@@ 40,4 41,5 @@ pub struct Config {

    pub description: String,
    pub git_location: PathBuf,
    pub domain: String,
    pub payment_link: Option<String>,
}

M static/style.css => static/style.css +4 -0
@@ 7144,6 7144,10 @@ a.text-dark:focus,a.text-dark:hover {

    vertical-align: -.25em
}

.icon-donate {
    color: rgb(204, 105, 157);
}

.navbar {
    flex-wrap: wrap
}

M templates/navbar.html.hbs => templates/navbar.html.hbs +11 -0
@@ 56,6 56,17 @@

        {{/if}}
        " href="/{{repo}}/lists">mailing lists</a>
      </li>
      {{#if payment}}
          <li class="nav-item">
            <a class="nav-link" href="{{payment}}" target="_new">
            <span aria-hidden="true" class="icon icon-donate">
                <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-heart icon-sponsor mr-1 color-fg-sponsors">
                    <path fill-rule="evenodd" d="M4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.565 20.565 0 008 13.393a20.561 20.561 0 003.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.75.75 0 01-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5zM8 14.25l-.345.666-.002-.001-.006-.003-.018-.01a7.643 7.643 0 01-.31-.17 22.075 22.075 0 01-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.08 22.08 0 01-3.744 2.584l-.018.01-.006.003h-.002L8 14.25zm0 0l.345.666a.752.752 0 01-.69 0L8 14.25z"></path>
                </svg>
            </span>
            donate</a>
          </li>
      {{/if}}
    </ul>
  </div>
</div>