mirror of
https://github.com/pcvolkmer/cert-tools.git
synced 2025-04-19 17:06:49 +00:00
chore: use monospace font
This commit is contained in:
parent
599b40e21a
commit
557ca5602d
@ -2,10 +2,9 @@
|
||||
|
||||
use cert_tools::{Chain, PrivateKey};
|
||||
use iced::border::Radius;
|
||||
use iced::widget::text::Shaping;
|
||||
use iced::widget::text_editor::{default, Content, Status};
|
||||
use iced::widget::{
|
||||
button, column, container, horizontal_rule, horizontal_space, row, text, text_editor,
|
||||
self, button, column, container, horizontal_rule, horizontal_space, row, text, text_editor,
|
||||
text_input, Container, Scrollable,
|
||||
};
|
||||
use iced::{
|
||||
@ -23,7 +22,7 @@ fn main() -> iced::Result {
|
||||
..Settings::default()
|
||||
})
|
||||
.resizable(false)
|
||||
.window_size(Size::new(1000.0, 800.0))
|
||||
.window_size(Size::new(1020.0, 800.0))
|
||||
.run_with(Ui::new)
|
||||
}
|
||||
|
||||
@ -403,33 +402,38 @@ impl Ui {
|
||||
let mut result = column![];
|
||||
|
||||
if let Some(chain) = &self.chain {
|
||||
fn monospace_text<'a>(s: String) -> widget::Text<'a> {
|
||||
text(s)
|
||||
.shaping(text::Shaping::Advanced)
|
||||
.font(Font::MONOSPACE)
|
||||
.size(12)
|
||||
}
|
||||
|
||||
for cert in chain.certs() {
|
||||
result = result.push(
|
||||
Container::new(
|
||||
column![
|
||||
text(cert.name().to_string()).size(18),
|
||||
horizontal_rule(1),
|
||||
row![text("Issuer: ").width(200), text(cert.issuer().to_string())],
|
||||
row![text("Issuer: ").width(160), text(cert.issuer().to_string())],
|
||||
row![
|
||||
text("Gültigkeit: ").width(200),
|
||||
text("Gültigkeit: ").width(160),
|
||||
text("Gültig von "),
|
||||
if cert.is_valid_not_before(&SystemTime::now()) {
|
||||
text(cert.not_before().to_string())
|
||||
} else {
|
||||
text(cert.not_before().to_string())
|
||||
.color(color!(0xaa0000))
|
||||
text(cert.not_before().to_string()).color(color!(0xaa0000))
|
||||
},
|
||||
text(" bis "),
|
||||
if cert.is_valid_not_after(&SystemTime::now()) {
|
||||
text(cert.not_after().to_string())
|
||||
} else {
|
||||
text(cert.not_after().to_string())
|
||||
.color(color!(0xaa0000))
|
||||
text(cert.not_after().to_string()).color(color!(0xaa0000))
|
||||
}
|
||||
],
|
||||
row![
|
||||
text("SHA-1-Fingerprint: ").width(200),
|
||||
text(cert.fingerprint().sha1.to_string()),
|
||||
text("SHA-1-Fingerprint: ").width(160),
|
||||
monospace_text(cert.fingerprint().sha1.to_string()),
|
||||
horizontal_space(),
|
||||
button("Copy to Clipboard")
|
||||
.style(button::secondary)
|
||||
@ -440,8 +444,8 @@ impl Ui {
|
||||
]
|
||||
.align_y(alignment::Vertical::Center),
|
||||
row![
|
||||
text("SHA-256-Fingerprint: ").width(200),
|
||||
text(cert.fingerprint().sha256.to_string()),
|
||||
text("SHA-256-Fingerprint: ").width(160),
|
||||
monospace_text(cert.fingerprint().sha256.to_string()),
|
||||
horizontal_space(),
|
||||
button("Copy to Clipboard")
|
||||
.style(button::secondary)
|
||||
@ -452,18 +456,18 @@ impl Ui {
|
||||
]
|
||||
.align_y(alignment::Vertical::Center),
|
||||
row![
|
||||
text("Subject-Key-Id: ").width(200),
|
||||
text(cert.subject_key_id().to_string())
|
||||
text("Subject-Key-Id: ").width(160),
|
||||
monospace_text(cert.subject_key_id().to_string())
|
||||
],
|
||||
row![
|
||||
text("Authority-Key-Id: ").width(200),
|
||||
text(cert.authority_key_id().to_string())
|
||||
text("Authority-Key-Id: ").width(160),
|
||||
monospace_text(cert.authority_key_id().to_string())
|
||||
],
|
||||
if cert.dns_names().is_empty() {
|
||||
row![]
|
||||
} else {
|
||||
row![
|
||||
text("DNS-Names: ").width(200),
|
||||
text("DNS-Names: ").width(160),
|
||||
text(cert.dns_names().join(", "))
|
||||
]
|
||||
},
|
||||
@ -828,7 +832,7 @@ async fn pick_file() -> Result<PathBuf, Error> {
|
||||
async fn export_file() -> Result<PathBuf, Error> {
|
||||
let path = rfd::AsyncFileDialog::new()
|
||||
.set_title("Export file...")
|
||||
.add_filter("PEM-File", &["pem", "crt"])
|
||||
.add_filter("PEM-File", &["crt", "pem"])
|
||||
.save_file()
|
||||
.await
|
||||
.ok_or(Error::Undefined)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user