Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Sep 16, 2024
2 parents d3ce8e6 + 6269df3 commit f59c6cb
Show file tree
Hide file tree
Showing 21 changed files with 753 additions and 42 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build
on:
[push]
push:
pull_request_target:
types: [labeled]
jobs:
build:
name: Build and Test
Expand Down Expand Up @@ -31,4 +33,4 @@ jobs:
with:
prerelease: true
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
generate_release_notes: true
generate_release_notes: true
5 changes: 2 additions & 3 deletions .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
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
- name: Enforce project version ${{ github.event.inputs.tag }}
run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }}
- name: Deploy
Expand All @@ -35,4 +33,5 @@ jobs:
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
3 changes: 1 addition & 2 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ jobs:
distribution: 'zulu'
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
- name: Enforce project version ${{ github.event.release.tag_name }}
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
- name: Deploy
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Linux-specific implemenations of the [integrations-api](https://github.com/crypt

# Config

This project uses the following JVM properties:
This library uses the following JVM properties:
* `cryptomator.integrationsLinux.trayIconsDir` - specifies the directory from which svg images for the tray icon are loaded
* `cryptomator.integrationsLinux.autoStartCmd` - specifies the command used for starting Cryptomator

## Building Requirements

* JDK 22
* Maven 3.9.6
31 changes: 17 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>integrations-linux</artifactId>
<version>1.4.5</version>
<version>1.5.0</version>

<name>integrations-linux</name>
<description>Provides optional Linux services used by Cryptomator</description>
Expand Down Expand Up @@ -40,17 +40,17 @@

<!-- runtime dependencies -->

<api.version>1.3.1</api.version>
<api.version>1.4.0</api.version>
<secret-service.version>2.0.1-alpha</secret-service.version>
<kdewallet.version>1.4.0</kdewallet.version>
<slf4j.version>2.0.13</slf4j.version>
<appindicator.version>1.4.0</appindicator.version>
<slf4j.version>2.0.16</slf4j.version>
<appindicator.version>1.4.1</appindicator.version>

<!-- test dependencies -->
<junit.version>5.10.2</junit.version>
<junit.version>5.10.3</junit.version>

<!-- build plugin dependencies -->
<dependency-check.version>9.1.0</dependency-check.version>
<dependency-check.version>10.0.3</dependency-check.version>
<nexus-staging.version>1.6.8</nexus-staging.version>
</properties>

Expand Down Expand Up @@ -87,6 +87,12 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -102,12 +108,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<id>check-preconditions</id>
Expand Down Expand Up @@ -140,7 +146,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.8.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -242,10 +248,7 @@
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
<signer>bc</signer>
</configuration>
</execution>
</executions>
Expand All @@ -268,7 +271,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import org.cryptomator.integrations.autostart.AutoStartProvider;
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
import org.cryptomator.integrations.quickaccess.QuickAccessService;
import org.cryptomator.integrations.revealpath.RevealPathService;
import org.cryptomator.integrations.tray.TrayMenuController;
import org.cryptomator.linux.autostart.FreedesktopAutoStartService;
import org.cryptomator.linux.keychain.KDEWalletKeychainAccess;
import org.cryptomator.linux.keychain.SecretServiceKeychainAccess;
import org.cryptomator.linux.quickaccess.DolphinPlaces;
import org.cryptomator.linux.quickaccess.NautilusBookmarks;
import org.cryptomator.linux.revealpath.DBusSendRevealPathService;
import org.cryptomator.linux.tray.AppindicatorTrayMenuController;

Expand All @@ -14,9 +19,13 @@
requires org.purejava.kwallet;
requires de.swiesend.secretservice;

provides AutoStartProvider with FreedesktopAutoStartService;
provides KeychainAccessProvider with SecretServiceKeychainAccess, KDEWalletKeychainAccess;
provides RevealPathService with DBusSendRevealPathService;
provides TrayMenuController with AppindicatorTrayMenuController;
provides QuickAccessService with NautilusBookmarks, DolphinPlaces;

opens org.cryptomator.linux.tray to org.cryptomator.integrations.api;
opens org.cryptomator.linux.quickaccess to org.cryptomator.integrations.api;
opens org.cryptomator.linux.autostart to org.cryptomator.integrations.api;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package org.cryptomator.linux.autostart;

import org.cryptomator.integrations.autostart.AutoStartProvider;
import org.cryptomator.integrations.autostart.ToggleAutoStartFailedException;
import org.cryptomator.integrations.common.CheckAvailability;
import org.cryptomator.integrations.common.OperatingSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Objects;

/**
* Enables autostart for Linux desktop environments following the freedesktop standard.
* <p>
* This service is based on <a href=https://specifications.freedesktop.org/autostart-spec/autostart-spec-0.5.html>version 0.5 of the freedesktop autostart-spec</a>.
*/
@CheckAvailability
@OperatingSystem(OperatingSystem.Value.LINUX)
public class FreedesktopAutoStartService implements AutoStartProvider {

private static final Logger LOG = LoggerFactory.getLogger(FreedesktopAutoStartService.class);
private static final String CMD_PROPERTY = "cryptomator.integrationsLinux.autoStartCmd";
private static final String AUTOSTART_FILENAME = "Cryptomator.desktop";
private static final String CONTENT_TEMPLATE = """
[Desktop Entry]
Type=Application
Exec=%s
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Cryptomator
Comment=Created with %s
""";

private final Path autostartFile;
private final String content;
private final boolean hasExecValue;

public FreedesktopAutoStartService() {
var xdgConfigDirString = Objects.requireNonNullElse(System.getenv("XDG_CONFIG_HOME"), System.getProperty("user.home") + "/.config");
this.autostartFile = Path.of(xdgConfigDirString, "autostart", AUTOSTART_FILENAME);

var execValue = System.getProperty(CMD_PROPERTY,"");
this.hasExecValue = !execValue.isBlank();
this.content = CONTENT_TEMPLATE.formatted(execValue, this.getClass().getName());
}

@Override
public synchronized void enable() throws ToggleAutoStartFailedException {
try {
Files.writeString(autostartFile, content, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException e) {
throw new ToggleAutoStartFailedException("Failed to activate Cryptomator autostart for GNOME desktop environment.", e);
}
}

@Override
public synchronized void disable() throws ToggleAutoStartFailedException {
try {
Files.deleteIfExists(autostartFile);
} catch (IOException e) {
throw new ToggleAutoStartFailedException("Failed to deactivate Cryptomator autostart for GNOME desktop environment.", e);
}
}

@Override
public synchronized boolean isEnabled() {
return Files.exists(autostartFile);
}

@CheckAvailability
public boolean isSupported() {
//TODO: might need to research which Desktop Environments support this
return hasExecValue && Files.exists(autostartFile.getParent());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public boolean isLocked() {
}

@Override
public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
public void storePassphrase(String key, String displayName, CharSequence passphrase, boolean ignored) throws KeychainAccessException {
CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
wallet.get().storePassphrase(key, passphrase);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@OperatingSystem(OperatingSystem.Value.LINUX)
public class SecretServiceKeychainAccess implements KeychainAccessProvider {

private static Logger LOG = LoggerFactory.getLogger(SecretServiceKeychainAccess.class);
private static final Logger LOG = LoggerFactory.getLogger(SecretServiceKeychainAccess.class);

private final String LABEL_FOR_SECRET_IN_KEYRING = "Cryptomator";

Expand All @@ -29,8 +29,11 @@ public String displayName() {
public boolean isSupported() {
try {
return SimpleCollection.isAvailable();
} catch (ExceptionInInitializerError e) {
LOG.warn("Initializing secret service keychain access failed", e.getException());
} catch (RuntimeException e) {
LOG.warn("Initializing secret service keychain access failed", e);
return false;
} catch (ExceptionInInitializerError err) {
LOG.warn("Initializing secret service keychain access failed", err.getException());
return false;
}
}
Expand All @@ -45,7 +48,7 @@ public boolean isLocked() {
}

@Override
public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
public void storePassphrase(String key, String displayName, CharSequence passphrase, boolean ignored) throws KeychainAccessException {
try (SimpleCollection keyring = new SimpleCollection()) {
List<String> list = keyring.getItems(createAttributes(key));
if (list == null || list.isEmpty()) {
Expand Down
Loading

0 comments on commit f59c6cb

Please sign in to comment.