added key name to page
This commit is contained in:
parent
4ddadfdce9
commit
9b989745e0
2 changed files with 12 additions and 7 deletions
|
@ -74,9 +74,12 @@ pub async fn public_key(r: HttpRequest) -> impl Responder {
|
|||
if pages::func::is_browser(&r) {
|
||||
let config: &web::Data<config::Config> = r.app_data().unwrap();
|
||||
let host = format!("http://{}", pages::func::get_host(&r));
|
||||
let key = std::io::read_to_string(std::fs::File::open("/config/pub.key").unwrap())
|
||||
.unwrap()
|
||||
.replace("\n", "<br>");
|
||||
let key = std::io::read_to_string(std::fs::File::open("/config/pub.key").unwrap()).unwrap();
|
||||
|
||||
let pgp = gnupg::GnuPG::new().unwrap();
|
||||
let key_name = pgp.import_key(&key).unwrap().name;
|
||||
|
||||
let key = key.replace("\n", "<br>");
|
||||
let resp = format!(
|
||||
r#"
|
||||
<div class="container" style="margin-top: 25px">
|
||||
|
@ -84,7 +87,9 @@ pub async fn public_key(r: HttpRequest) -> impl Responder {
|
|||
<b>To Import: </b>
|
||||
<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>
|
||||
</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>
|
||||
"#
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue