From 07f97e9da6a7e1e1275b644cdfe06e96f3082c2f Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 8 Feb 2024 18:25:27 +0100 Subject: [PATCH 01/12] [ci skip] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 99c64f3..399f84a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-linux - 1.4.4 + 1.5.0-SNAPSHOT integrations-linux Provides optional Linux services used by Cryptomator From eba5527b9d2e32f2e23f26bd4c231d00804623a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:43:42 +0100 Subject: [PATCH 02/12] Bump the java-test-dependencies group with 1 update (#67) Bumps the java-test-dependencies group with 1 update: [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5). Updates `org.junit.jupiter:junit-jupiter` from 5.10.1 to 5.10.2 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.10.1...r5.10.2) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter dependency-type: direct:development update-type: version-update:semver-patch dependency-group: java-test-dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 399f84a..3ae8786 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ 2.0.11 - 5.10.1 + 5.10.2 9.0.9 From 0410613b47b7f0f4170aec487a466346a20afc43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:44:04 +0000 Subject: [PATCH 03/12] Bump the java-production-dependencies group with 3 updates (#68) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 3ae8786..6d000f3 100644 --- a/pom.xml +++ b/pom.xml @@ -40,11 +40,11 @@ - 1.3.0 - 2.0.0-alpha + 1.3.1 + 2.0.1-alpha 1.4.0 1.3.6 - 2.0.11 + 2.0.12 5.10.2 From a42508384143a806d2b579b2f563e02ea515fa18 Mon Sep 17 00:00:00 2001 From: Ralph Plawetzki Date: Thu, 29 Feb 2024 19:47:49 +0100 Subject: [PATCH 04/12] Update appindicator based on JDK 22 --- .github/workflows/build.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependency-check.yml | 2 +- .github/workflows/publish-central.yml | 2 +- .github/workflows/publish-github.yml | 2 +- pom.xml | 8 +- .../linux/tray/ActionItemCallback.java | 2 +- .../tray/AppindicatorTrayMenuController.java | 92 +++++++++---------- 8 files changed, 51 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2612eef..c81ae23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 21 + java-version: 22 cache: 'maven' - name: Ensure to use tagged version if: startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e979d17..aeec068 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 21 + java-version: 22 cache: 'maven' - name: Initialize CodeQL uses: github/codeql-action/init@v3 diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index f7872aa..3ace46c 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -14,7 +14,7 @@ jobs: with: runner-os: 'ubuntu-latest' java-distribution: 'temurin' - java-version: 21 + java-version: 22 secrets: nvd-api-key: ${{ secrets.NVD_API_KEY }} slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml index 7e8c25d..746b083 100644 --- a/.github/workflows/publish-central.yml +++ b/.github/workflows/publish-central.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 21 + java-version: 22 cache: 'maven' server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml index 2caf761..56ef8f0 100644 --- a/.github/workflows/publish-github.yml +++ b/.github/workflows/publish-github.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 21 + java-version: 22 cache: 'maven' gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase diff --git a/pom.xml b/pom.xml index 6d000f3..d56da8b 100644 --- a/pom.xml +++ b/pom.xml @@ -36,15 +36,15 @@ UTF-8 - 21 + 22 1.3.1 2.0.1-alpha 1.4.0 - 1.3.6 2.0.12 + 1.4.0 5.10.2 @@ -97,9 +97,6 @@ 3.12.1 ${project.jdk.version} - - --enable-preview - @@ -194,7 +191,6 @@ see - --enable-preview diff --git a/src/main/java/org/cryptomator/linux/tray/ActionItemCallback.java b/src/main/java/org/cryptomator/linux/tray/ActionItemCallback.java index de1f525..d565237 100644 --- a/src/main/java/org/cryptomator/linux/tray/ActionItemCallback.java +++ b/src/main/java/org/cryptomator/linux/tray/ActionItemCallback.java @@ -5,7 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -record ActionItemCallback (ActionItem actionItem) implements GCallback { +record ActionItemCallback (ActionItem actionItem) implements GCallback.Function { private static final Logger LOG = LoggerFactory.getLogger(ActionItemCallback.class); @Override diff --git a/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java b/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java index 1147dc5..9b337fe 100644 --- a/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java +++ b/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java @@ -10,16 +10,18 @@ import org.cryptomator.integrations.tray.TrayMenuController; import org.cryptomator.integrations.tray.TrayMenuException; import org.cryptomator.integrations.tray.TrayMenuItem; +import org.purejava.appindicator.AppIndicator; import org.purejava.appindicator.GCallback; -import org.purejava.appindicator.NativeLibUtilities; +import org.purejava.appindicator.GObject; +import org.purejava.appindicator.Gtk; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; -import static org.purejava.appindicator.app_indicator_h.*; +import static org.purejava.appindicator.app_indicator_h.APP_INDICATOR_CATEGORY_APPLICATION_STATUS; +import static org.purejava.appindicator.app_indicator_h.APP_INDICATOR_STATUS_ACTIVE; @Priority(1000) @CheckAvailability @@ -30,37 +32,35 @@ public class AppindicatorTrayMenuController implements TrayMenuController { private static final Arena ARENA = Arena.global(); private MemorySegment indicator; - private MemorySegment menu = gtk_menu_new(); + private MemorySegment menu = Gtk.newMenu(); @CheckAvailability public static boolean isAvailable() { - return NativeLibUtilities.isLoadedNativeLib(); + return AppIndicator.isLoaded(); } @Override public void showTrayIcon(Consumer iconLoader, Runnable runnable, String s) throws TrayMenuException { TrayIconLoader.FreedesktopIconName callback = this::showTrayIconWithSVG; iconLoader.accept(callback); - gtk_widget_show_all(menu); - app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE()); + Gtk.widgetShowAll(menu); + AppIndicator.setStatus(indicator, APP_INDICATOR_STATUS_ACTIVE()); } - private void showTrayIconWithSVG(String s) { - try (var arena = Arena.ofConfined()) { - var svgSourcePath = System.getProperty(SVG_SOURCE_PROPERTY); - // flatpak - if (svgSourcePath == null) { - indicator = app_indicator_new(arena.allocateUtf8String(APP_INDICATOR_ID), - arena.allocateUtf8String(s), - APP_INDICATOR_CATEGORY_APPLICATION_STATUS()); - // AppImage and ppa - } else { - indicator = app_indicator_new_with_path(arena.allocateUtf8String(APP_INDICATOR_ID), - arena.allocateUtf8String(s), - APP_INDICATOR_CATEGORY_APPLICATION_STATUS(), - // find tray icons theme in mounted AppImage / installed on system by ppa - arena.allocateUtf8String(svgSourcePath)); - } + private void showTrayIconWithSVG(String iconName) { + var svgSourcePath = System.getProperty(SVG_SOURCE_PROPERTY); + // flatpak + if (svgSourcePath == null) { + indicator = AppIndicator.newIndicator(APP_INDICATOR_ID, + iconName, + APP_INDICATOR_CATEGORY_APPLICATION_STATUS()); + // AppImage and ppa + } else { + indicator = AppIndicator.newIndicatorWithPath(APP_INDICATOR_ID, + iconName, + APP_INDICATOR_CATEGORY_APPLICATION_STATUS(), + // find tray icons theme in mounted AppImage / installed on system by ppa + svgSourcePath); } } @@ -70,18 +70,16 @@ public void updateTrayIcon(Consumer iconLoader) { iconLoader.accept(callback); } - private void updateTrayIconWithSVG(String s) { - try (var arena = Arena.ofConfined()) { - app_indicator_set_icon(indicator, arena.allocateUtf8String(s)); - } + private void updateTrayIconWithSVG(String iconName) { + AppIndicator.setIcon(indicator, iconName); } @Override public void updateTrayMenu(List items) throws TrayMenuException { - menu = gtk_menu_new(); + menu = Gtk.newMenu(); addChildren(menu, items); - gtk_widget_show_all(menu); - app_indicator_set_menu(indicator, menu); + Gtk.widgetShowAll(menu); + AppIndicator.setMenu(indicator, menu); } @Override @@ -93,30 +91,26 @@ private void addChildren(MemorySegment menu, List items) { for (var item : items) { switch (item) { case ActionItem a -> { - var gtkMenuItem = gtk_menu_item_new(); - try (var arena = Arena.ofConfined()) { - gtk_menu_item_set_label(gtkMenuItem, arena.allocateUtf8String(a.title())); - g_signal_connect_object(gtkMenuItem, - arena.allocateUtf8String("activate"), - GCallback.allocate(new ActionItemCallback(a), ARENA), - menu, - 0); - } - gtk_menu_shell_append(menu, gtkMenuItem); + var gtkMenuItem = Gtk.newMenuItem(); + Gtk.menuItemSetLabel(gtkMenuItem, a.title()); + GObject.signalConnectObject(gtkMenuItem, + "activate", + GCallback.allocate(new ActionItemCallback(a), ARENA), + menu, + 0); + Gtk.menuShellAppend(menu, gtkMenuItem); } case SeparatorItem _ -> { - var gtkSeparator = gtk_menu_item_new(); - gtk_menu_shell_append(menu, gtkSeparator); + var gtkSeparator = Gtk.newMenuItem(); + Gtk.menuShellAppend(menu, gtkSeparator); } case SubMenuItem s -> { - var gtkMenuItem = gtk_menu_item_new(); - var gtkSubmenu = gtk_menu_new(); - try (var arena = Arena.ofConfined()) { - gtk_menu_item_set_label(gtkMenuItem, arena.allocateUtf8String(s.title())); - } + var gtkMenuItem = Gtk.newMenuItem(); + var gtkSubmenu = Gtk.newMenu(); + Gtk.menuItemSetLabel(gtkMenuItem, s.title()); addChildren(gtkSubmenu, s.items()); - gtk_menu_item_set_submenu(gtkMenuItem, gtkSubmenu); - gtk_menu_shell_append(menu, gtkMenuItem); + Gtk.menuItemSetSubmenu(gtkMenuItem, gtkSubmenu); + Gtk.menuShellAppend(menu, gtkMenuItem); } } } From 4ae3eebab17370897c9a61431a3889fc02a8fd17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:16:06 +0000 Subject: [PATCH 05/12] Bump the github-actions group with 1 update (#72) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2612eef..12abf2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: name: artifacts path: target/*.jar - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: prerelease: true From 78e11e9db1da91db2f9a2c7788d21ecf88467225 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:18:56 +0000 Subject: [PATCH 06/12] Bump the maven-build-plugins group with 3 updates (#70) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 6d000f3..f6f00ca 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 5.10.2 - 9.0.9 + 9.1.0 1.6.8 @@ -94,7 +94,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 ${project.jdk.version} @@ -237,7 +237,7 @@ maven-gpg-plugin - 3.1.0 + 3.2.2 sign-artifacts From 037be96b34e1222b83416ec8daf2433978488c36 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 18 Apr 2024 09:59:56 +0200 Subject: [PATCH 07/12] prevent leaking of NVD API key into logs --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 537fe8d..9ac44b6 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,7 @@ true true suppression.xml - ${env.NVD_API_KEY} + NVD_API_KEY From 4b8f08f59ca90d021768105fbaffa9abaa3eaf53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 10:45:20 +0000 Subject: [PATCH 08/12] Bump the maven-build-plugins group with 3 updates (#73) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9ac44b6..1511fa4 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ maven-source-plugin - 3.3.0 + 3.3.1 attach-sources @@ -233,7 +233,7 @@ maven-gpg-plugin - 3.2.2 + 3.2.4 sign-artifacts @@ -294,7 +294,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.1.1 + 3.1.2 From 06bdf2bfaf5a7aff3fe7d7737f3f97ccf17c6447 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 10:45:56 +0000 Subject: [PATCH 09/12] Bump org.slf4j:slf4j-api in the java-production-dependencies group (#74) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1511fa4..7b008e6 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ 1.3.1 2.0.1-alpha 1.4.0 - 2.0.12 + 2.0.13 1.4.0 From 08f0bf25225cb1a5e58b5bec4a650063889b2430 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 14 May 2024 16:36:28 +0200 Subject: [PATCH 10/12] add checks before accessing instance variables in public methods (#75) --- .../linux/tray/AppindicatorTrayMenuController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java b/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java index 9b337fe..ea37e2f 100644 --- a/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java +++ b/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java @@ -10,6 +10,7 @@ import org.cryptomator.integrations.tray.TrayMenuController; import org.cryptomator.integrations.tray.TrayMenuException; import org.cryptomator.integrations.tray.TrayMenuItem; +import org.cryptomator.linux.util.CheckUtil; import org.purejava.appindicator.AppIndicator; import org.purejava.appindicator.GCallback; import org.purejava.appindicator.GObject; @@ -32,7 +33,7 @@ public class AppindicatorTrayMenuController implements TrayMenuController { private static final Arena ARENA = Arena.global(); private MemorySegment indicator; - private MemorySegment menu = Gtk.newMenu(); + private MemorySegment menu; @CheckAvailability public static boolean isAvailable() { @@ -41,6 +42,7 @@ public static boolean isAvailable() { @Override public void showTrayIcon(Consumer iconLoader, Runnable runnable, String s) throws TrayMenuException { + menu = Gtk.newMenu(); TrayIconLoader.FreedesktopIconName callback = this::showTrayIconWithSVG; iconLoader.accept(callback); Gtk.widgetShowAll(menu); @@ -71,11 +73,13 @@ public void updateTrayIcon(Consumer iconLoader) { } private void updateTrayIconWithSVG(String iconName) { + CheckUtil.checkState(indicator != null, "Appindicator is not setup. Call showTrayIcon(...) first."); AppIndicator.setIcon(indicator, iconName); } @Override public void updateTrayMenu(List items) throws TrayMenuException { + CheckUtil.checkState(indicator != null, "Appindicator is not setup. Call showTrayIcon(...) first."); menu = Gtk.newMenu(); addChildren(menu, items); Gtk.widgetShowAll(menu); From 7dfdf25af675cb99d8effd7b06cd087b5f84b9ff Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 14 May 2024 16:44:37 +0200 Subject: [PATCH 11/12] [ci skip] update ide files --- .idea/misc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index ae1fcde..3bcfa17 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file From 3c5b2d516a1727068a2de211dd0379d65bba1fec Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 14 May 2024 16:45:05 +0200 Subject: [PATCH 12/12] prepare 1.4.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7b008e6..c0a9068 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-linux - 1.5.0-SNAPSHOT + 1.4.5 integrations-linux Provides optional Linux services used by Cryptomator