💾 Archived View for lists.flounder.online › patches › threads › 20210320204652.5797-4-johann@qwertqw… captured on 2022-04-28 at 19:24:47. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

[PATCH mygit 4/4] parameterize title and clone url

[PATCH mygit 4/4] parameterize title and clone url

From: johann@qwertqwefsday.eu

Date: Sat, 20 Mar 2021 21:46:52 +0100

Message-Id: 20210320204652.5797-4-johann@qwertqwefsday.eu

To: <~aw/patches@lists.sr.ht>

In-Reply-To: 20210320204652.5797-1-johann@qwertqwefsday.eu

Cc: "Johann150" <johann@qwertqwefsday.eu>

Reply

Export

--------------------------------------

From: Johann150 <johann@qwertqwefsday.eu>

---

mygit.toml | 3 +++

src/main.rs | 2 ++

templates/base.html | 2 +-

templates/repo-navbar.html | 2 +-

4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mygit.toml b/mygit.toml

index 8b25b45..de7cce9 100644

--- a/mygit.toml

+++ b/mygit.toml

@@ -3,4 +3,7 @@ port = 8081

projectroot = "repos"

emoji_favicon = "💻"

site_name = "My git repositories"

+# file to check for in the .git directory to decide wether to publicly show a repo

export_ok = "git-daemon-export-ok"

+# base directory to clone repositories from

+clone_base = "https://git.alexwennerberg.com"

diff --git a/src/main.rs b/src/main.rs

index 6d40372..317f00b 100644

--- a/src/main.rs

+++ b/src/main.rs

@@ -25,6 +25,8 @@ pub struct Config {

site_name: String,

#[serde(default = "defaults::export_ok")]

export_ok: String,

+ #[serde(default = "String::new")]

+ clone_base: String,

}

/// Defaults for the configuration options

diff --git a/templates/base.html b/templates/base.html

index 151515e..637a281 100644

--- a/templates/base.html

+++ b/templates/base.html

@@ -6,7 +6,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=0" />

<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{crate::CONFIG.emoji_favicon}}</text></svg>">

<meta name="description" content="My self-hosted git repositories">

- <title>{% block title %}My Site{% endblock %}</title>

+ <title>{{crate::CONFIG.site_name}}</title>

{% block head %}{% endblock %}

</head>

<body>

diff --git a/templates/repo-navbar.html b/templates/repo-navbar.html

index ddc875a..628dcad 100644

--- a/templates/repo-navbar.html

+++ b/templates/repo-navbar.html

@@ -1,5 +1,5 @@

<h1><a href="/">index</a>/{{repo|repo_name}}</h1>

<div>{{repo|description}}</div>

-<div class="clone-url">git clone git.alexwennerberg.com/repo </div>

+<div class="clone-url">git clone {{crate::CONFIG.clone_base}}/{{repo|repo_name}} </div>

<div class="navbar"><a href="/{{repo|repo_name|urlencode_strict}}">README</a> | <a href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a> | <a href="/{{repo|repo_name|urlencode_strict}}/log">log</a> | <a href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a></div>

<hr class='thin'>

--

2.20.1