~/selfhut

5c44f94c608dcf1ac418ae27c0591398450f0e6f — Arthur Melton ac5fb3ff 2 years ago
rename to selfhut
4 files changed, 10 insertions(+), 10 deletions(-)

M Cargo.toml
M README.md
M src/main.rs
M src/utils/config.rs
M Cargo.toml => Cargo.toml +1 -1
@@ 1,5 1,5 @@

[package]
name = "git"
name = "selfhut"
version = "0.1.0"
edition = "2021"


M README.md => README.md +6 -6
@@ 1,4 1,4 @@

# [git.arthurmelton.com](https://git.arthurmelton.com)
# [Selfhut](https://git.arthurmelton.com)

This is my git site, it took insperation from [Sourcehut](https://sourcehut.org/).
Its not a fork but its practecly a remake, just for my use case. Please support

@@ 17,12 17,12 @@ To install you will need:

Once you have these just run these steps.

```sh
git clone https://git.arthurmelton.com/git.arthurmelton.com
cd git.arthurmelton.com
git clone https://git.arthurmelton.com/selfhut
cd selfhut
cargo build --release
```

The binary executable will be at `./target/release/git`, you can just run this
The binary executable will be at `./target/release/selfhut`, you can just run this
and your server should stort working!

## Hosting

@@ 30,9 30,9 @@ and your server should stort working!

Simpily run the binary and a website is going to be hosted at port 8000. I would
also recoment using something like nginx to change the port and to do caching. If 
you want to change the config (this would make sense because at default it only
has a example user), edit the file in `$(XDG_CONFIG_HOME)/git-server/git-server.toml`
has a example user), edit the file in `$(XDG_CONFIG_HOME)/selfhut/selfhut.toml`
to your liking. To add a `favicon.ico` you need to add it to 
`$(XDG_CONFIG_HOME)/git-server/favicon.ico`. 
`$(XDG_CONFIG_HOME)/selfhut/favicon.ico`. 

## Config


M src/main.rs => src/main.rs +1 -1
@@ 65,7 65,7 @@ async fn robots() -> Option<rocket::fs::NamedFile> {

#[get("/favicon.ico")]
async fn favicon() -> Option<rocket::fs::NamedFile> {
    let mut path = dirs::config_dir().expect("Could not get the config directory");
    path.push("git-server");
    path.push("selfhut");
    path.push("favicon.ico"); 
    rocket::fs::NamedFile::open(path).await.ok()
}

M src/utils/config.rs => src/utils/config.rs +2 -2
@@ 5,8 5,8 @@ use std::{fs, path::PathBuf};

lazy_static! {
    pub static ref CONFIG: Config = {
        let mut config = dirs::config_dir().expect("Could not get the config directory");
        config.push("git-server");
        config.push("git-server.toml");
        config.push("selfhut");
        config.push("selfhut.toml");
        if config.exists() {
            let config: Config = toml::from_str(&String::from_utf8_lossy(
                &fs::read(config.as_path()).expect("Failed to read the config file"),