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 cert_tools::{Chain, PrivateKey};
|
||||||
use iced::border::Radius;
|
use iced::border::Radius;
|
||||||
use iced::widget::text::Shaping;
|
|
||||||
use iced::widget::text_editor::{default, Content, Status};
|
use iced::widget::text_editor::{default, Content, Status};
|
||||||
use iced::widget::{
|
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,
|
text_input, Container, Scrollable,
|
||||||
};
|
};
|
||||||
use iced::{
|
use iced::{
|
||||||
@ -23,7 +22,7 @@ fn main() -> iced::Result {
|
|||||||
..Settings::default()
|
..Settings::default()
|
||||||
})
|
})
|
||||||
.resizable(false)
|
.resizable(false)
|
||||||
.window_size(Size::new(1000.0, 800.0))
|
.window_size(Size::new(1020.0, 800.0))
|
||||||
.run_with(Ui::new)
|
.run_with(Ui::new)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,33 +402,38 @@ impl Ui {
|
|||||||
let mut result = column![];
|
let mut result = column![];
|
||||||
|
|
||||||
if let Some(chain) = &self.chain {
|
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() {
|
for cert in chain.certs() {
|
||||||
result = result.push(
|
result = result.push(
|
||||||
Container::new(
|
Container::new(
|
||||||
column![
|
column![
|
||||||
text(cert.name().to_string()).size(18),
|
text(cert.name().to_string()).size(18),
|
||||||
horizontal_rule(1),
|
horizontal_rule(1),
|
||||||
row![text("Issuer: ").width(200), text(cert.issuer().to_string())],
|
row![text("Issuer: ").width(160), text(cert.issuer().to_string())],
|
||||||
row![
|
row![
|
||||||
text("Gültigkeit: ").width(200),
|
text("Gültigkeit: ").width(160),
|
||||||
text("Gültig von "),
|
text("Gültig von "),
|
||||||
if cert.is_valid_not_before(&SystemTime::now()) {
|
if cert.is_valid_not_before(&SystemTime::now()) {
|
||||||
text(cert.not_before().to_string())
|
text(cert.not_before().to_string())
|
||||||
} else {
|
} else {
|
||||||
text(cert.not_before().to_string())
|
text(cert.not_before().to_string()).color(color!(0xaa0000))
|
||||||
.color(color!(0xaa0000))
|
|
||||||
},
|
},
|
||||||
text(" bis "),
|
text(" bis "),
|
||||||
if cert.is_valid_not_after(&SystemTime::now()) {
|
if cert.is_valid_not_after(&SystemTime::now()) {
|
||||||
text(cert.not_after().to_string())
|
text(cert.not_after().to_string())
|
||||||
} else {
|
} else {
|
||||||
text(cert.not_after().to_string())
|
text(cert.not_after().to_string()).color(color!(0xaa0000))
|
||||||
.color(color!(0xaa0000))
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
row![
|
row![
|
||||||
text("SHA-1-Fingerprint: ").width(200),
|
text("SHA-1-Fingerprint: ").width(160),
|
||||||
text(cert.fingerprint().sha1.to_string()),
|
monospace_text(cert.fingerprint().sha1.to_string()),
|
||||||
horizontal_space(),
|
horizontal_space(),
|
||||||
button("Copy to Clipboard")
|
button("Copy to Clipboard")
|
||||||
.style(button::secondary)
|
.style(button::secondary)
|
||||||
@ -440,8 +444,8 @@ impl Ui {
|
|||||||
]
|
]
|
||||||
.align_y(alignment::Vertical::Center),
|
.align_y(alignment::Vertical::Center),
|
||||||
row![
|
row![
|
||||||
text("SHA-256-Fingerprint: ").width(200),
|
text("SHA-256-Fingerprint: ").width(160),
|
||||||
text(cert.fingerprint().sha256.to_string()),
|
monospace_text(cert.fingerprint().sha256.to_string()),
|
||||||
horizontal_space(),
|
horizontal_space(),
|
||||||
button("Copy to Clipboard")
|
button("Copy to Clipboard")
|
||||||
.style(button::secondary)
|
.style(button::secondary)
|
||||||
@ -452,18 +456,18 @@ impl Ui {
|
|||||||
]
|
]
|
||||||
.align_y(alignment::Vertical::Center),
|
.align_y(alignment::Vertical::Center),
|
||||||
row![
|
row![
|
||||||
text("Subject-Key-Id: ").width(200),
|
text("Subject-Key-Id: ").width(160),
|
||||||
text(cert.subject_key_id().to_string())
|
monospace_text(cert.subject_key_id().to_string())
|
||||||
],
|
],
|
||||||
row![
|
row![
|
||||||
text("Authority-Key-Id: ").width(200),
|
text("Authority-Key-Id: ").width(160),
|
||||||
text(cert.authority_key_id().to_string())
|
monospace_text(cert.authority_key_id().to_string())
|
||||||
],
|
],
|
||||||
if cert.dns_names().is_empty() {
|
if cert.dns_names().is_empty() {
|
||||||
row![]
|
row![]
|
||||||
} else {
|
} else {
|
||||||
row![
|
row![
|
||||||
text("DNS-Names: ").width(200),
|
text("DNS-Names: ").width(160),
|
||||||
text(cert.dns_names().join(", "))
|
text(cert.dns_names().join(", "))
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -828,7 +832,7 @@ async fn pick_file() -> Result<PathBuf, Error> {
|
|||||||
async fn export_file() -> Result<PathBuf, Error> {
|
async fn export_file() -> Result<PathBuf, Error> {
|
||||||
let path = rfd::AsyncFileDialog::new()
|
let path = rfd::AsyncFileDialog::new()
|
||||||
.set_title("Export file...")
|
.set_title("Export file...")
|
||||||
.add_filter("PEM-File", &["pem", "crt"])
|
.add_filter("PEM-File", &["crt", "pem"])
|
||||||
.save_file()
|
.save_file()
|
||||||
.await
|
.await
|
||||||
.ok_or(Error::Undefined)?;
|
.ok_or(Error::Undefined)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user