12 files changed, 41 insertions(+), 41 deletions(-)
@@ -903,7 +903,7 @@
]
[[package]]
name = "git-rs"
name = "gitrs"
version = "0.1.0"
dependencies = [
"actix-web",
@@ -1,5 +1,5 @@
[package]
name = "git-rs"
name = "gitrs"
version = "0.1.0"
edition = "2024"
@@ -1,4 +1,4 @@
# git-rs
# gitrs
A fast, minimal web interface for self-hosted Git repositories, inspired by `cgit` and written in Rust using Actix Web, `gix` (gitoxide), and Askama templates.
@@ -19,10 +19,10 @@
## Usage
By default, `git-rs` reads bare repositories from `/srv/git` and listens on `127.0.0.1:80`:
By default, `gitrs` reads bare repositories from `/srv/git` and listens on `127.0.0.1:80`:
```sh
git-rs --url 0.0.0.0 --port 80 --repos-dir /srv/git
gitrs --url 0.0.0.0 --port 80 --repos-dir /srv/git
```
### Options
@@ -49,7 +49,7 @@
```sh
# From crates.io
cargo install git-rs
cargo install gitrs
# Or from a local checkout
cargo install --path .
@@ -58,9 +58,9 @@
To install and start the `systemd` service:
```sh
sudo $(which git-rs) --install-service --url 0.0.0.0 --port 80 --repos-dir /srv/git
sudo $(which gitrs) --install-service --url 0.0.0.0 --port 80 --repos-dir /srv/git
sudo systemctl daemon-reload
sudo systemctl enable --now git-rs
sudo systemctl enable --now gitrs
```
## License
@@ -4,11 +4,11 @@
println!("cargo:rerun-if-changed=src");
println!("cargo:rerun-if-changed=templates");
println!("cargo:rerun-if-changed=static");
println!("cargo:rerun-if-changed=git-rs.service");
println!("cargo:rerun-if-changed=gitrs.service");
// When running `cargo install` (release profile) with permissions to write to
// /etc/systemd/system, automatically install git-rs.service.
// /etc/systemd/system, automatically install gitrs.service.
if std::env::var("PROFILE").as_deref() == Ok("release") {
let _ = std::fs::copy("git-rs.service", "/etc/systemd/system/git-rs.service");
let _ = std::fs::copy("gitrs.service", "/etc/systemd/system/gitrs.service");
}
}
@@ -1,16 +1,0 @@
[Unit]
Description=git-rs — Lightweight Git web frontend
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/srv/git
ExecStart=/usr/bin/git-rs --url 0.0.0.0 --port 80 --repos-dir /srv/git
Restart=on-failure
RestartSec=5
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
@@ -1,0 +1,16 @@
[Unit]
Description=gitrs — Lightweight Git web frontend
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/srv/git
ExecStart=/usr/bin/gitrs --url 0.0.0.0 --port 80 --repos-dir /srv/git
Restart=on-failure
RestartSec=5
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
@@ -17,10 +17,10 @@
# Build and deploy ARM64 binary + systemd service to Orange Pi
deploy host="pi": build-arm
ssh {{host}} "systemctl stop git-rs || true"
scp target/{{arm_target}}/release/git-rs {{host}}:/usr/bin/git-rs
# scp git-rs.service {{host}}:/etc/systemd/system/git-rs.service
ssh {{host}} "systemctl daemon-reload && systemctl start git-rs"
ssh {{host}} "systemctl stop gitrs || true"
scp target/{{arm_target}}/release/gitrs {{host}}:/usr/bin/gitrs
# scp gitrs.service {{host}}:/etc/systemd/system/gitrs.service
ssh {{host}} "systemctl daemon-reload && systemctl start gitrs"
# Run locally (e.g. `just run -p 8080 -r ./repos`)
run *args:
@@ -2,10 +2,10 @@
#[derive(Parser)]
#[command(
name = "rsgit",
name = "gitrs",
version,
about = "A lightweight, blazingly fast Git web frontend written in Rust 🦀",
long_about = "rsgit is a minimalist web interface for scouting and browsing local Git repositories, viewing diffs, and managing user patches natively."
long_about = "gitrs is a minimalist web interface for scouting and browsing local Git repositories, viewing diffs, and managing user patches natively."
)]
pub struct Args {
/// The URL where the frontend is hosted (e.g., 127.0.0.1 or 0.0.0.0 for the public)
@@ -20,7 +20,7 @@
#[arg(short, long, value_name = "DIR", default_value = "/srv/git")]
pub repos_dir: String,
/// Install and enable the systemd service (/etc/systemd/system/git-rs.service)
/// Install and enable the systemd service (/etc/systemd/system/gitrs.service)
#[arg(long)]
pub install_service: bool,
}
@@ -54,7 +54,7 @@
let exe = std::env::current_exe()?;
let service = format!(
"[Unit]\n\
Description=git-rs — Lightweight Git web frontend\n\
Description=gitrs — Lightweight Git web frontend\n\
After=network-online.target\n\
Wants=network-online.target\n\
\n\
@@ -75,8 +75,8 @@
repos_dir = args.repos_dir,
);
std::fs::write("/etc/systemd/system/git-rs.service", service)?;
println!("Installed /etc/systemd/system/git-rs.service");
std::fs::write("/etc/systemd/system/gitrs.service", service)?;
println!("Installed /etc/systemd/system/gitrs.service");
Ok(())
}
@@ -123,7 +123,7 @@
#[test]
fn markdown_escapes_attribute_injections_in_media() {
let md = "";
let html = markdown::render(md, "git-rs", "main");
let html = markdown::render(md, "gitrs", "main");
assert!(html.contains(r#"alt="demo & test""#));
assert!(
html.contains(r#"src="https://github.com/user-attachments/assets/1234?a=1&b=2""#)
@@ -5,7 +5,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}rsgit{% endblock %}</title>
<title>{% block title %}gitrs{% endblock %}</title>
<link rel="stylesheet" href="/static/style.css">
<link rel="shortcut icon" href="/static/favicon.ico">
</head>
@@ -23,7 +23,7 @@
<td class="main">y2w8 Repos</td>
</tr>
<tr>
<td class="sub">y2w8 git repositories, powered by rsgit</td>
<td class="sub">y2w8 git repositories, powered by gitrs</td>
</tr>
{% endif %}
{% endmacro %}
@@ -80,7 +80,7 @@
data.extend_from_slice(b"\n");
data.extend_from_slice(diff.output.as_bytes());
writeln!(data, "--\ngit-rs {}", crate_version!())?;
writeln!(data, "--\ngitrs {}", crate_version!())?;
Ok(HttpResponse::Ok().content_type("text").body(data))
}