mirror of
https://github.com/pcvolkmer/cert-tools.git
synced 2025-04-19 17:06:49 +00:00
feat: add copy to clipboard for cert fingerprints
This commit is contained in:
parent
b0ce06515d
commit
944e085a57
@ -181,7 +181,7 @@ impl Ui {
|
||||
};
|
||||
Task::none()
|
||||
}
|
||||
Message::Copy => clipboard::write::<Message>(self.output.text()),
|
||||
Message::CopyValue(value) => clipboard::write::<Message>(value),
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ impl Ui {
|
||||
button("Copy to Clipboard").style(button::secondary)
|
||||
} else {
|
||||
button("Copy to Clipboard")
|
||||
.on_press(Message::Copy)
|
||||
.on_press(Message::CopyValue(self.output.text().trim().to_string()))
|
||||
.style(button::secondary)
|
||||
};
|
||||
let buttons = if self.cert_file.is_some() {
|
||||
@ -342,7 +342,8 @@ impl Ui {
|
||||
if let Some(chain) = &self.chain {
|
||||
for cert in chain.certs() {
|
||||
result = result.push(
|
||||
Container::new(column![
|
||||
Container::new(
|
||||
column![
|
||||
text(cert.name().to_string()).size(18),
|
||||
horizontal_rule(1),
|
||||
row![text("Issuer: ").width(200), text(cert.issuer().to_string())],
|
||||
@ -365,12 +366,28 @@ impl Ui {
|
||||
],
|
||||
row![
|
||||
text("SHA-1-Fingerprint: ").width(200),
|
||||
text(cert.fingerprint().sha1.to_string())
|
||||
],
|
||||
text(cert.fingerprint().sha1.to_string()),
|
||||
horizontal_space(),
|
||||
button("Copy to Clipboard")
|
||||
.style(button::secondary)
|
||||
.padding(1)
|
||||
.on_press(Message::CopyValue(
|
||||
cert.fingerprint().sha1.to_string()
|
||||
)),
|
||||
]
|
||||
.align_y(alignment::Vertical::Center),
|
||||
row![
|
||||
text("SHA-256-Fingerprint: ").width(200),
|
||||
text(cert.fingerprint().sha256.to_string())
|
||||
],
|
||||
text(cert.fingerprint().sha256.to_string()),
|
||||
horizontal_space(),
|
||||
button("Copy to Clipboard")
|
||||
.style(button::secondary)
|
||||
.padding(1)
|
||||
.on_press(Message::CopyValue(
|
||||
cert.fingerprint().sha1.to_string()
|
||||
)),
|
||||
]
|
||||
.align_y(alignment::Vertical::Center),
|
||||
row![
|
||||
text("Subject-Key-Id: ").width(200),
|
||||
text(cert.subject_key_id().to_string())
|
||||
@ -387,7 +404,9 @@ impl Ui {
|
||||
text(cert.dns_names().join(", "))
|
||||
]
|
||||
},
|
||||
])
|
||||
]
|
||||
.spacing(2),
|
||||
)
|
||||
.padding(8)
|
||||
.style(|_| container::Style {
|
||||
background: Some(Background::Color(Color::WHITE)),
|
||||
@ -721,7 +740,7 @@ enum Message {
|
||||
SetKeyFile(Result<PathBuf, Error>),
|
||||
Print,
|
||||
Merge,
|
||||
Copy,
|
||||
CopyValue(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user