From e40154abb78e0979d1e6ddf9010293720c11880a Mon Sep 17 00:00:00 2001 From: Carlos Ortiz Date: Thu, 5 Sep 2024 22:24:18 -0600 Subject: [PATCH] Add environment variables and UI panel final modifiers This commit updates the deployment workflow to use new environment variables for signing the plugin. It also refactors UI code in `JKSView.java` to make some panel fields final and removes redundant labels. The changes streamline the signing process and enhance code clarity. --- .github/workflows/deploy-alpha.yml | 6 +++++- build.gradle.kts | 4 ++-- .../java/com/jmpeax/ssltoolbox/jks/JKSView.java | 14 +++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy-alpha.yml b/.github/workflows/deploy-alpha.yml index 186fc6f..23749cd 100644 --- a/.github/workflows/deploy-alpha.yml +++ b/.github/workflows/deploy-alpha.yml @@ -61,4 +61,8 @@ jobs: run: ./gradlew publishPlugin env: PLUGIN_REPO: ${{ secrets.PLUGIN_REPO }} - PLUGIN_TOKEN: ${{ secrets.PLUGIN_TOKEN }} \ No newline at end of file + CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} + PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} + CHANNEL: alpha \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2ef3a05..24f5d9e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,8 +36,8 @@ tasks { } signPlugin { - certificateChainFile.set(file("chain.crt")) - privateKeyFile.set(file("private.pem")) + certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) + privateKey.set(System.getenv("PRIVATE_KEY")) password.set(System.getenv("PRIVATE_KEY_PASSWORD")) } diff --git a/src/main/java/com/jmpeax/ssltoolbox/jks/JKSView.java b/src/main/java/com/jmpeax/ssltoolbox/jks/JKSView.java index d6e1398..fb9addd 100644 --- a/src/main/java/com/jmpeax/ssltoolbox/jks/JKSView.java +++ b/src/main/java/com/jmpeax/ssltoolbox/jks/JKSView.java @@ -25,8 +25,8 @@ public class JKSView extends JPanel { private JBList list; private PemView pemView; private final VirtualFile file; - private JPanel listPanel; - private JPanel pemViewPanel; + private final JPanel listPanel; + private final JPanel pemViewPanel; private JBPasswordField passwordField; public JKSView(@NotNull VirtualFile file) { @@ -75,9 +75,7 @@ private void loadPemView(X509Certificate certificate) { private JPanel createListPanel() { JPanel panel = new JPanel(new BorderLayout()); - JLabel label = new JLabel("Certificate List", SwingConstants.CENTER); JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); - labelPanel.add(label); panel.add(labelPanel, BorderLayout.NORTH); panel.add(new JScrollPane(list), BorderLayout.CENTER); return panel; @@ -85,9 +83,7 @@ private JPanel createListPanel() { private JPanel createPemViewPanel() { JPanel panel = new JPanel(new BorderLayout()); - JLabel label = new JLabel("Certificate Details"); - panel.add(label, BorderLayout.NORTH); - panel.add(new JPanel(), BorderLayout.CENTER); // Placeholder for PemView + panel.add(new JPanel(), BorderLayout.CENTER); return panel; } @@ -137,8 +133,8 @@ private JPanel createUnlockButton() { var certs = CertificateHelper.getKeyStoreCerts(file.getInputStream(), password); updateView(certs); // Remove the unlock button - //panel.removeAll(); - // panel.add(buildToolBar()); + panel.removeAll(); + panel.add(buildToolBar()); revalidate(); repaint(); } catch (IOException ex) {