mirror of
https://github.com/Dangoware/confetti-box.git
synced 2025-06-22 22:53:02 -05:00
Made opengraph info page redirect
This commit is contained in:
parent
4f39f6b081
commit
3c04b72cd8
4 changed files with 40 additions and 28 deletions
|
@ -10,6 +10,9 @@ build = "build.rs"
|
|||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
git_tag = ["vergen-gix"]
|
||||
|
||||
[dependencies]
|
||||
blake3 = { version = "1.5", features = ["mmap", "rayon", "serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
@ -29,4 +32,4 @@ uuid = { version = "1.11", features = ["serde", "v4"] }
|
|||
|
||||
|
||||
[build-dependencies]
|
||||
vergen-gix = { version = "1.0", features = ["build", "cargo", "rustc", "si"] }
|
||||
vergen-gix = { version = "1.0", features = ["build", "cargo", "rustc", "si"], optional = true }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder, RustcBuilder, SysinfoBuilder};
|
||||
|
||||
fn main() {
|
||||
let build = BuildBuilder::all_build().unwrap();
|
||||
let cargo = CargoBuilder::all_cargo().unwrap();
|
||||
let gitcl = GixBuilder::all_git().unwrap();
|
||||
let rustc = RustcBuilder::all_rustc().unwrap();
|
||||
let si = SysinfoBuilder::all_sysinfo().unwrap();
|
||||
#[cfg(feature = "git_tag")]
|
||||
{
|
||||
let build = vergen_gix::BuildBuilder::all_build().unwrap();
|
||||
let cargo = vergen_gix::CargoBuilder::all_cargo().unwrap();
|
||||
let gitcl = vergen_gix::GixBuilder::all_git().unwrap();
|
||||
let rustc = vergen_gix::RustcBuilder::all_rustc().unwrap();
|
||||
let si = vergen_gix::SysinfoBuilder::all_sysinfo().unwrap();
|
||||
|
||||
Emitter::default()
|
||||
vergen_gix::Emitter::default()
|
||||
.add_instructions(&build)
|
||||
.unwrap()
|
||||
.add_instructions(&cargo)
|
||||
|
@ -20,4 +20,5 @@ fn main() {
|
|||
.unwrap()
|
||||
.emit()
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,11 @@ pub async fn file_info_opengraph(
|
|||
|
||||
let title = entry.name().clone() + " - " + &size + " - " + &expiry;
|
||||
|
||||
let url = uri!(lookup_mmid_name(
|
||||
mmid.to_string(),
|
||||
entry.name()
|
||||
)).to_string();
|
||||
|
||||
Some(html! {
|
||||
(DOCTYPE)
|
||||
meta charset="UTF-8";
|
||||
|
@ -68,6 +73,12 @@ pub async fn file_info_opengraph(
|
|||
meta property="og:title" content=(title);
|
||||
meta property="twitter:title" content=(title);
|
||||
meta property="og:description" content={"Size: " (size) ", expires in " (expiry)};
|
||||
|
||||
body {
|
||||
script {
|
||||
"window.location.href = '" (url) "';"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,10 @@ pub fn head(page_title: &str) -> Markup {
|
|||
}
|
||||
|
||||
pub fn footer() -> Markup {
|
||||
let hash = match option_env!("VERGEN_GIT_SHA") {
|
||||
Some(hash) => &hash[0..7],
|
||||
None => "",
|
||||
};
|
||||
let hash = option_env!("VERGEN_GIT_SHA").map(|h| &h[0..7]);
|
||||
|
||||
let pkg_version = env!("CARGO_PKG_VERSION");
|
||||
let hash_link = "https://github.com/Dangoware/confetti-box/commit/".to_string() + hash;
|
||||
let build_date = option_env!("VERGEN_BUILD_DATE").unwrap_or_default();
|
||||
|
||||
html! {
|
||||
footer {
|
||||
|
@ -36,8 +33,8 @@ pub fn footer() -> Markup {
|
|||
}
|
||||
p.version { "Running Confetti-Box v" (pkg_version) " " }
|
||||
|
||||
@if !hash.is_empty() {
|
||||
p.version style="font-size: 0.8em" { "(" a style="font-family:'Fira Code'" href=(hash_link) {(hash)} " - " (env!("VERGEN_BUILD_DATE")) ")" }
|
||||
@if let Some(h) = hash {
|
||||
p.version style="font-size: 0.8em" { "(" a style="font-family:'Fira Code'" href={"https://github.com/Dangoware/confetti-box/commit/" (h)} {(h)} " - " (build_date) ")" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue