display the commit hash on the footer

This commit is contained in:
blek 2023-10-09 22:46:32 +10:00
parent 7c525808a4
commit f7e69e5067
Signed by: blek
GPG Key ID: 14546221E3595D0C
5 changed files with 68 additions and 3 deletions

59
filed/Cargo.lock generated
View File

@ -32,6 +32,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "anyhow"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]] [[package]]
name = "askama" name = "askama"
version = "0.12.0" version = "0.12.0"
@ -280,6 +286,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
"static_dir",
"tokio", "tokio",
"warp", "warp",
] ]
@ -541,6 +548,29 @@ dependencies = [
"unicode-normalization", "unicode-normalization",
] ]
[[package]]
name = "include_dir"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24b56e147e6187d61e9d0f039f10e070d0c0a887e24fe0bb9ca3f29bfde62cab"
dependencies = [
"include_dir_impl",
"proc-macro-hack",
]
[[package]]
name = "include_dir_impl"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a0c890c85da4bab7bce4204c707396bbd3c6c8a681716a51c8814cfc2b682df"
dependencies = [
"anyhow",
"proc-macro-hack",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.3" version = "1.9.3"
@ -812,6 +842,12 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-hack"
version = "0.5.20+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.67" version = "1.0.67"
@ -1018,6 +1054,23 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
[[package]]
name = "static_dir"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8286dc044d09abcb8bf85440b94f2c41aee322733a58cd195cf830ee660cadf5"
dependencies = [
"headers",
"http",
"hyper",
"include_dir",
"log",
"mime_guess",
"once_cell",
"urlencoding",
"warp",
]
[[package]] [[package]]
name = "sval" name = "sval"
version = "2.9.1" version = "2.9.1"
@ -1307,6 +1360,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "urlencoding"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb"
[[package]] [[package]]
name = "utf-8" name = "utf-8"
version = "0.7.6" version = "0.7.6"

View File

@ -20,5 +20,6 @@ redis = { version = "0.23.3", features = ["tokio"] }
serde = { version = "1.0.188", features = ["derive"] } serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107" serde_json = "1.0.107"
sha2 = "0.10.8" sha2 = "0.10.8"
static_dir = "0.2.0"
tokio = { version = "1.32.0", features = ["rt", "macros", "rt-multi-thread"] } tokio = { version = "1.32.0", features = ["rt", "macros", "rt-multi-thread"] }
warp = "0.3.6" warp = "0.3.6"

View File

@ -70,4 +70,8 @@ impl Env {
pub fn usercontent_dir(self: &Self) -> Box<&Path> { pub fn usercontent_dir(self: &Self) -> Box<&Path> {
Box::new(Path::new(&self.filedir)) Box::new(Path::new(&self.filedir))
} }
pub fn shortcommit(self: &Self) -> String {
let commit = self.last_commit.to_string().clone();
commit.chars().take(6).collect()
}
} }

View File

@ -31,7 +31,7 @@
<tbody> <tbody>
<tr> <tr>
<td> <td>
Made with Rust bleK! File {{ env.shortcommit() }}
</td> </td>
<td> <td>
Released under GPLv3 Released under GPLv3

View File

@ -50,8 +50,9 @@
<input type="checkbox" name="passworded"> <input type="checkbox" name="passworded">
I want to add a password to the file: I want to add a password to the file:
<span style="font-size:80%;display:block;padding:2px 0 0 24px"> <span style="font-size:80%;display:block">
Warning: the file WILL NOT be encrypted.<br/> Warning: the file WILL NOT be encrypted,<br/>
therefore this is not 100% secure.<br/>
<a href="/passworded-files"> <a href="/passworded-files">
Learn more Learn more
</a> </a>