added key name to page
This commit is contained in:
parent
4ddadfdce9
commit
9b989745e0
2 changed files with 12 additions and 7 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -357,9 +357,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.22"
|
version = "0.4.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
|
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
@ -642,7 +642,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gnupg"
|
name = "gnupg"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.hydrar.de/jmarya/gnupg-rs#e4de0dc5e0c8c3ec4829363cc09b50e8e8b104ef"
|
source = "git+https://git.hydrar.de/jmarya/gnupg-rs#c6938384d522b07c27a0f468e4f0fda737f3b12d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
|
|
|
@ -74,9 +74,12 @@ pub async fn public_key(r: HttpRequest) -> impl Responder {
|
||||||
if pages::func::is_browser(&r) {
|
if pages::func::is_browser(&r) {
|
||||||
let config: &web::Data<config::Config> = r.app_data().unwrap();
|
let config: &web::Data<config::Config> = r.app_data().unwrap();
|
||||||
let host = format!("http://{}", pages::func::get_host(&r));
|
let host = format!("http://{}", pages::func::get_host(&r));
|
||||||
let key = std::io::read_to_string(std::fs::File::open("/config/pub.key").unwrap())
|
let key = std::io::read_to_string(std::fs::File::open("/config/pub.key").unwrap()).unwrap();
|
||||||
.unwrap()
|
|
||||||
.replace("\n", "<br>");
|
let pgp = gnupg::GnuPG::new().unwrap();
|
||||||
|
let key_name = pgp.import_key(&key).unwrap().name;
|
||||||
|
|
||||||
|
let key = key.replace("\n", "<br>");
|
||||||
let resp = format!(
|
let resp = format!(
|
||||||
r#"
|
r#"
|
||||||
<div class="container" style="margin-top: 25px">
|
<div class="container" style="margin-top: 25px">
|
||||||
|
@ -84,7 +87,9 @@ pub async fn public_key(r: HttpRequest) -> impl Responder {
|
||||||
<b>To Import: </b>
|
<b>To Import: </b>
|
||||||
<span style="display: block;font-family: monospace,monospace;margin-top: 10px; font-size: 20px;overflow-wrap: break-word;">
|
<span style="display: block;font-family: monospace,monospace;margin-top: 10px; font-size: 20px;overflow-wrap: break-word;">
|
||||||
curl -sL "{host}/public_key"|gpg --import</span>
|
curl -sL "{host}/public_key"|gpg --import</span>
|
||||||
</div></div>
|
</div>
|
||||||
|
<h4 class="container card" style="padding-top: 10px; padding-bottom: 10px; background: black; margin-bottom: 15px;"> {key_name} </h4>
|
||||||
|
</div>
|
||||||
<div class="container card bg-primary"><p> {key} </p></div>
|
<div class="container card bg-primary"><p> {key} </p></div>
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue