summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-01 15:55:22 -0700
committeriximeow <me@iximeow.net>2023-07-01 15:55:22 -0700
commite893fac0ed5d85c0d0d0270a0b530d95c8d4baeb (patch)
tree8bfe1d35d0d8eba19d481d3822298a6e3b0d4247 /src
parentc8a10a3bedd6a68408d291d6357b18285597fb35 (diff)
short hashes for og preview
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 3e9f034..b7be4b6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -480,6 +480,7 @@ async fn handle_commit_status(Path(path): Path<(String, String, String)>, State(
eprintln!("path: {}/{}, sha {}", path.0, path.1, path.2);
let remote_path = format!("{}/{}", path.0, path.1);
let sha = path.2;
+ let short_sha = &sha[0..9];
let (commit_id, sha): (u64, String) = if sha.len() >= 7 {
match ctx.dbctx.conn.lock().unwrap()
@@ -544,13 +545,15 @@ async fn handle_commit_status(Path(path): Path<(String, String, String)>, State(
head.push_str("\n");
head.push_str(&format!("<meta property=\"og:type\" content=\"website\">\n"));
head.push_str(&format!("<meta property=\"og:site_name\" content=\"ci.butactuallyin.space\">\n"));
- head.push_str(&format!("<meta property=\"og:url\" content=\"/{}/{}/{}\"\n", &path.0, &path.1, &sha));
+ head.push_str(&format!("<meta property=\"og:url\" content=\"/{}/{}/{}\">\n", &path.0, &path.1, &sha));
+ head.push_str(&format!("<meta property=\"og:title\" contents=\"{}/{} commit {}\">", &path.0, &path.1, &short_sha));
let build_og_description = format!("commit {} of {}/{}, {} after {}",
- sha,
+ short_sha,
path.0, path.1,
status_desc,
display_run_time(&run)
);
+ head.push_str(&format!("<meta name=\"description\" content=\"{}\"\n>", build_og_description));
head.push_str(&format!("<meta property=\"og:description\" content=\"{}\"\n>", build_og_description));
}
head.push_str("</head>\n");