Add clone URL display
Adapted from https://git.holly.sh/sparkle-git.git/commit/?id=3f19c49c63ed70bd50001f07c180d1b4595737dc
Diff
Cargo.lock | 16 ++++++----------
src/database/indexer.rs | 1 +
templates/repo/summary.html | 24 ++++++++++++++++++++++++
src/database/schema/mod.rs | 2 +-
src/database/schema/repository.rs | 4 ++++
src/methods/repo/summary.rs | 7 ++++++-
6 files changed, 41 insertions(+), 13 deletions(-)
@@ -154,7 +154,7 @@
"rustversion",
"serde",
"serde_urlencoded",
"sync_wrapper 1.0.1",
"sync_wrapper",
"tokio",
"tower",
"tower-layer",
@@ -176,7 +176,7 @@
"mime",
"pin-project-lite",
"rustversion",
"sync_wrapper 1.0.1",
"sync_wrapper",
"tower-layer",
"tower-service",
]
@@ -2892,12 +2892,6 @@
[[package]]
name = "sync_wrapper"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "sync_wrapper"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
@@ -3128,14 +3122,14 @@
[[package]]
name = "tower"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f"
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
"futures-core",
"futures-util",
"pin-project-lite",
"sync_wrapper 0.1.2",
"sync_wrapper",
"tokio",
"tower-layer",
"tower-service",
@@ -93,6 +93,7 @@
(r.unix_timestamp(), r.offset().whole_seconds())
},
default_branch: find_default_branch(&git_repository).ok().flatten(),
exported: repository_path.join("git-daemon-export-ok").exists(),
}
.insert(db, relative);
@@ -61,6 +61,30 @@
</tr>
</tbody>
{%- endif %}
{% if exported %}
<tbody>
<tr class="separator">
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="no-background">
<th>Clone</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td colspan="4">
<a rel="vcs-git" href="/{{ repo.display() }}" title="{{ repo.display() }} Git repository">
https://{{ host }}/{{ repo.display() }}
</a>
</td>
</tr>
</tbody>
{%- endif %}
</table>
</div>
{% endblock %}
@@ -9,4 +9,4 @@
pub type Yoked<T> = Yoke<T, Box<[u8]>>;
pub const SCHEMA_VERSION: &str = "2";
pub const SCHEMA_VERSION: &str = "3";
@@ -28,6 +28,10 @@
pub last_modified: (i64, i32),
pub default_branch: Option<String>,
pub exported: bool,
}
pub type YokedRepository = Yoked<&'static <Repository as Archive>::Archived>;
@@ -1,8 +1,8 @@
use std::{collections::BTreeMap, sync::Arc};
use anyhow::Context;
use askama::Template;
use axum::{response::IntoResponse, Extension};
use axum::{extract::Host, response::IntoResponse, Extension};
use rkyv::string::ArchivedString;
use crate::{
@@ -21,11 +21,14 @@
refs: Refs,
commit_list: Vec<YokedCommit>,
branch: Option<Arc<str>>,
exported: bool,
host: String,
}
pub async fn handle(
Extension(repo): Extension<Repository>,
Extension(db): Extension<Arc<rocksdb::DB>>,
Host(host): Host,
) -> Result<impl IntoResponse> {
tokio::task::spawn_blocking(move || {
let repository = crate::database::schema::repository::Repository::open(&db, &*repo)?
@@ -57,6 +60,8 @@
refs: Refs { heads, tags },
commit_list: commits,
branch: None,
exported: repository.get().exported,
host,
}))
})
.await