Merge branch 'develop' into release/1.6.0

This commit is contained in:
Armin Schrenk 2021-10-08 16:35:19 +02:00
commit e436ce372d
No known key found for this signature in database
GPG Key ID: 8F2992163CBBA7FC
11 changed files with 115 additions and 44 deletions

View File

@ -2,9 +2,11 @@ name: Build
on:
push:
pull_request_target:
types: [labeled]
env:
JAVA_VERSION: 16
JAVA_VERSION: 17
defaults:
run:
@ -17,19 +19,16 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
cache: 'maven'
- name: Build and Test
run: mvn -B clean install jacoco:report -Pcoverage,dependency-check
- name: Upload code coverage report
id: codacyCoverageReporter
if: "github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'pr:safe')"
run: bash <(curl -Ls https://coverage.codacy.com/get.sh)
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

26
.github/workflows/pullrequest.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Pull Request
on:
pull_request:
env:
JAVA_VERSION: 17
defaults:
run:
shell: bash
jobs:
test:
name: Compile and Test
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
- name: Build and Test
run: mvn -B clean install jacoco:report -Pcoverage,dependency-check

View File

@ -13,7 +13,7 @@ on:
- '[0-9]+.[0-9]+.[0-9]+-*'
env:
JAVA_VERSION: 16
JAVA_VERSION: 17
defaults:
run:

2
.idea/misc.xml generated
View File

@ -8,7 +8,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="16" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -72,7 +72,7 @@ For more information on the security details visit [cryptomator.org](https://doc
### Dependencies
* JDK 16 (e.g. adoptopenjdk)
* JDK 17 (e.g. temurin)
* Maven 3
* Optional: OS-dependent build tools for native packaging (see [Windows](https://github.com/cryptomator/cryptomator-win), [OS X](https://github.com/cryptomator/cryptomator-osx), [Linux](https://github.com/cryptomator/builder-containers))

View File

@ -2,7 +2,7 @@ Source: cryptomator
Maintainer: Cryptobot <releases@cryptomator.org>
Section: utils
Priority: optional
Build-Depends: debhelper (>=10), openjdk-16-jdk
Build-Depends: debhelper (>=10), openjdk-17-jdk
Standards-Version: 4.5.0
Homepage: https://cryptomator.org
Vcs-Git: https://github.com/cryptomator/cryptomator.git

View File

@ -21,7 +21,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.jdk.version>16</project.jdk.version>
<project.jdk.version>17</project.jdk.version>
<!-- Group IDs of jars that need to stay on the class path for now -->
<nonModularGroupIds>com.github.serceman,com.github.jnr,org.ow2.asm,net.java.dev.jna,org.apache.jackrabbit,org.apache.httpcomponents,de.swiesend,org.purejava,com.github.hypfvieh</nonModularGroupIds>

View File

@ -6,6 +6,7 @@ import dagger.Provides;
import dagger.multibindings.IntoMap;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
import org.cryptomator.ui.common.ErrorComponent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.FxControllerKey;
import org.cryptomator.ui.common.FxmlFile;
@ -19,16 +20,18 @@ import org.cryptomator.ui.stats.VaultStatisticsComponent;
import org.cryptomator.ui.vaultoptions.VaultOptionsComponent;
import org.cryptomator.ui.wrongfilealert.WrongFileAlertComponent;
import javax.inject.Named;
import javax.inject.Provider;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import java.util.Map;
import java.util.ResourceBundle;
@Module(subcomponents = {AddVaultWizardComponent.class, HealthCheckComponent.class, MigrationComponent.class, RemoveVaultComponent.class, VaultOptionsComponent.class, VaultStatisticsComponent.class, WrongFileAlertComponent.class})
@Module(subcomponents = {AddVaultWizardComponent.class, HealthCheckComponent.class, MigrationComponent.class, RemoveVaultComponent.class, VaultOptionsComponent.class, VaultStatisticsComponent.class, WrongFileAlertComponent.class, ErrorComponent.class})
abstract class MainWindowModule {
@Provides
@ -55,6 +58,17 @@ abstract class MainWindowModule {
return stage;
}
@Provides
@MainWindowScoped
@Named("errorWindow")
static Stage provideErrorStage(@MainWindow Stage window, StageFactory factory, ResourceBundle resourceBundle) {
Stage stage = factory.create(StageStyle.DECORATED);
stage.setTitle(resourceBundle.getString("main.vaultDetail.error.windowTitle"));
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(window);
return stage;
}
@Provides
@FxmlScene(FxmlFile.MAIN_WINDOW)
@MainWindowScoped

View File

@ -2,45 +2,46 @@ package org.cryptomator.ui.mainwindow;
import com.tobiasdiez.easybind.EasyBind;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.common.vaults.VaultListManager;
import org.cryptomator.ui.common.ErrorComponent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.removevault.RemoveVaultComponent;
import javax.inject.Inject;
import javax.inject.Named;
import javafx.beans.binding.Binding;
import javafx.beans.property.ObjectProperty;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import javafx.fxml.FXML;
import javafx.stage.Stage;
@MainWindowScoped
public class VaultDetailUnknownErrorController implements FxController {
private final Binding<String> stackTrace;
private final ObjectProperty<Vault> vault;
private final ErrorComponent.Builder errorComponentBuilder;
private final Stage errorWindow;
private final RemoveVaultComponent.Builder removeVault;
@Inject
public VaultDetailUnknownErrorController(ObjectProperty<Vault> vault) {
this.stackTrace = EasyBind.select(vault) //
.selectObject(Vault::lastKnownExceptionProperty) //
.map(this::provideStackTrace);
public VaultDetailUnknownErrorController(ObjectProperty<Vault> vault, ErrorComponent.Builder errorComponentBuilder, @Named("errorWindow") Stage errorWindow, RemoveVaultComponent.Builder removeVault) {
this.vault = vault;
this.errorComponentBuilder = errorComponentBuilder;
this.errorWindow = errorWindow;
this.removeVault = removeVault;
}
private String provideStackTrace(Throwable cause) {
// TODO deduplicate ErrorModule.java
if (cause != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
cause.printStackTrace(new PrintStream(baos));
return baos.toString(StandardCharsets.UTF_8);
} else {
return "";
}
@FXML
public void showError() {
errorComponentBuilder.window(errorWindow).cause(vault.get().getLastKnownException()).build().showErrorScene();
}
/* Getter/Setter */
public Binding<String> stackTraceProperty() {
return stackTrace;
@FXML
public void reload() {
VaultListManager.redetermineVaultState(vault.get());
}
public String getStackTrace() {
return stackTrace.getValue();
@FXML
void didClickRemoveVault() {
removeVault.vault(vault.get()).build().showRemoveVault();
}
}

View File

@ -1,15 +1,42 @@
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<VBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.mainwindow.VaultDetailUnknownErrorController"
alignment="CENTER"
spacing="24">
alignment="TOP_CENTER"
spacing="9">
<children>
<Label text="%generic.error.title" wrapText="true"/>
<Label text="%generic.error.instruction" wrapText="true"/>
<TextArea VBox.vgrow="ALWAYS" text="${controller.stackTrace}" prefRowCount="5" editable="false"/>
<StackPane VBox.vgrow="NEVER">
<Circle styleClass="glyph-icon-primary" radius="48"/>
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="FILE" glyphSize="48"/>
<FontAwesome5IconView styleClass="glyph-icon-primary" glyph="TIMES" glyphSize="24">
<StackPane.margin>
<Insets top="12"/>
</StackPane.margin>
</FontAwesome5IconView>
</StackPane>
<Label text="%main.vaultDetail.error.info" wrapText="true"/>
<VBox spacing="6" alignment="BASELINE_CENTER" VBox.vgrow="NEVER">
<Button styleClass="" text="Show Error Details" onAction="#showError">
<graphic>
<FontAwesome5IconView glyph="INFO"/>
</graphic>
</Button>
<Button text="%main.vaultDetail.error.reload" minWidth="120" onAction="#reload">
<graphic>
<FontAwesome5IconView glyph="REDO"/>
</graphic>
</Button>
<Button text="%main.vaultDetail.missing.remove" minWidth="120" onAction="#didClickRemoveVault">
<graphic>
<FontAwesome5IconView glyph="TRASH"/>
</graphic>
</Button>
</VBox>
</children>
</VBox>

View File

@ -300,6 +300,10 @@ main.vaultDetail.missing.changeLocation=Change Vault Location…
### Needs Migration
main.vaultDetail.migrateButton=Upgrade Vault
main.vaultDetail.migratePrompt=Your vault needs to be upgraded to a new format, before you can access it
### Error
main.vaultDetail.error.info=An error occurred loading the vault from disk.
main.vaultDetail.error.reload=Reload
main.vaultDetail.error.windowTitle=Error loading vault
# Wrong File Alert
wrongFileAlert.title=How to Encrypt Files