diff --git a/installer.nsi b/installer.nsi index 31c4d0d..fffd9c0 100644 --- a/installer.nsi +++ b/installer.nsi @@ -2,6 +2,7 @@ !define APP_NAME "Cert Tools" !define APP_EXE "cert-tools-ui.exe" +!define MUI_ICON "resources\icon.ico" !define UNINSTALLER_EXE "uninstaller.exe" !define INSTALL_DIR "$LocalAppData\Programs\${APP_NAME}" diff --git a/resources/icon.ico b/resources/icon.ico new file mode 100644 index 0000000..624634b Binary files /dev/null and b/resources/icon.ico differ diff --git a/src/lib.rs b/src/lib.rs index 3381309..d9e254f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,18 +16,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -use std::cmp::Ordering; + +use itertools::Itertools; use openssl::asn1::Asn1Time; use openssl::hash::MessageDigest; use openssl::nid::Nid; use openssl::pkey::{PKey, PKeyRef, Public}; use openssl::x509::X509; +use std::cmp::Ordering; use std::fmt::Display; use std::fs; use std::hash::{Hash, Hasher}; use std::path::Path; use std::time::{SystemTime, UNIX_EPOCH}; -use itertools::Itertools; pub fn hex_encode>(s: T) -> String { s.as_ref() diff --git a/ui/Cargo.toml b/ui/Cargo.toml index 3b53ce1..7bd2235 100644 --- a/ui/Cargo.toml +++ b/ui/Cargo.toml @@ -5,6 +5,10 @@ edition = "2021" [dependencies] cert-tools = { path = "..", version = "*" } -iced = { version = "0.13", features = ["wgpu", "tiny-skia", "tokio", "web-colors"], default-features = false } +iced = { version = "0.13", features = ["wgpu", "tiny-skia", "tokio", "web-colors", "image"], default-features = false } rfd = "0.15" -itertools = "0.14" \ No newline at end of file +itertools = "0.14" +image = {version = "0.25", features = ["ico"], default-features = false } + +[build-dependencies] +winresource = "0.1" \ No newline at end of file diff --git a/ui/build.rs b/ui/build.rs new file mode 100644 index 0000000..bd85825 --- /dev/null +++ b/ui/build.rs @@ -0,0 +1,26 @@ +/* + * This file is part of cert-tools + * + * Copyright (C) 2025 the original author or authors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +fn main() { + if std::env::var_os("CARGO_CFG_WINDOWS").is_some() { + let mut res = winresource::WindowsResource::new(); + res.set_icon("../resources/icon.ico"); + res.compile().unwrap(); + } +} diff --git a/ui/src/main.rs b/ui/src/main.rs index d8545dc..4514c91 100644 --- a/ui/src/main.rs +++ b/ui/src/main.rs @@ -1,3 +1,22 @@ +/* + * This file is part of cert-tools + * + * Copyright (C) 2025 the original author or authors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #![windows_subsystem = "windows"] use cert_tools::{Chain, PrivateKey}; @@ -7,9 +26,10 @@ use iced::widget::{ self, button, column, container, horizontal_rule, horizontal_space, row, text, text_editor, text_input, Container, Scrollable, }; +use iced::window::icon; use iced::{ - alignment, application, clipboard, color, Background, Border, Color, Element, Font, Length, - Pixels, Settings, Size, Task, + alignment, application, clipboard, color, window, Background, Border, Color, Element, Font, + Length, Pixels, Settings, Size, Task, }; use std::fs; use std::path::PathBuf; @@ -21,6 +41,13 @@ fn main() -> iced::Result { default_text_size: Pixels::from(13), ..Settings::default() }) + .window(window::Settings { + icon: match image::load_from_memory(include_bytes!("../../resources/icon.ico")) { + Ok(image) => icon::from_rgba(image.as_bytes().to_vec(), 128, 128).ok(), + _ => None, + }, + ..window::Settings::default() + }) .resizable(false) .window_size(Size::new(1020.0, 800.0)) .run_with(Ui::new)