mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-20 03:31:27 +00:00
Merge branch 'develop' into feature/new-hub-keyloading
# Conflicts: # src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java
This commit is contained in:
@@ -83,8 +83,8 @@ public final class OneDriveWindowsLocationPresetsProvider implements LocationPre
|
||||
throw new TimeoutException(cmdDescription + " timed out after " + timeoutSeconds + "s");
|
||||
}
|
||||
if (process.exitValue() != 0) {
|
||||
@SuppressWarnings("resource") var stdout = process.inputReader(StandardCharsets.UTF_8).lines().collect(Collectors.joining("\n"));
|
||||
@SuppressWarnings("resource") var stderr = process.errorReader(StandardCharsets.UTF_8).lines().collect(Collectors.joining("\n"));
|
||||
@SuppressWarnings("resource") var stdout = process.inputReader(StandardCharsets.ISO_8859_1).lines().collect(Collectors.joining("\n"));
|
||||
@SuppressWarnings("resource") var stderr = process.errorReader(StandardCharsets.ISO_8859_1).lines().collect(Collectors.joining("\n"));
|
||||
throw new CommandFailedException(cmdDescription, process.exitValue(), stdout, stderr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ErrorController implements FxController {
|
||||
|
||||
private static final ObjectMapper JSON = new ObjectMapper();
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ErrorController.class);
|
||||
private static final String ERROR_CODES_URL = "https://gist.githubusercontent.com/cryptobot/accba9fb9555e7192271b85606f97230/raw/errorcodes.json";
|
||||
private static final String ERROR_CODES_URL = "https://api.cryptomator.org/desktop/error-codes.json";
|
||||
private static final String SEARCH_URL_FORMAT = "https://github.com/cryptomator/cryptomator/discussions/categories/errors?discussions_q=category:Errors+%s";
|
||||
private static final String REPORT_URL_FORMAT = "https://github.com/cryptomator/cryptomator/discussions/new?category=Errors&title=Error+%s&body=%s";
|
||||
private static final String SEARCH_ERRORCODE_DELIM = " OR ";
|
||||
@@ -65,11 +65,13 @@ public class ErrorController implements FxController {
|
||||
private final Scene previousScene;
|
||||
private final Stage window;
|
||||
private final Environment environment;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
private final BooleanProperty copiedDetails = new SimpleBooleanProperty();
|
||||
private final ObjectProperty<ErrorDiscussion> matchingErrorDiscussion = new SimpleObjectProperty<>();
|
||||
private final BooleanExpression errorSolutionFound = matchingErrorDiscussion.isNotNull();
|
||||
private final BooleanProperty isLoadingHttpResponse = new SimpleBooleanProperty();
|
||||
private final BooleanProperty askedForLookupDatabasePermission = new SimpleBooleanProperty();
|
||||
|
||||
@Inject
|
||||
ErrorController(Application application, @Named("stackTrace") String stackTrace, ErrorCode errorCode, @Nullable Scene previousScene, Stage window, Environment environment, ExecutorService executorService) {
|
||||
@@ -79,15 +81,7 @@ public class ErrorController implements FxController {
|
||||
this.previousScene = previousScene;
|
||||
this.window = window;
|
||||
this.environment = environment;
|
||||
|
||||
isLoadingHttpResponse.set(true);
|
||||
HttpClient httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
|
||||
HttpRequest httpRequest = HttpRequest.newBuilder()//
|
||||
.uri(URI.create(ERROR_CODES_URL))//
|
||||
.build();
|
||||
httpClient.sendAsync(httpRequest, HttpResponse.BodyHandlers.ofInputStream())//
|
||||
.thenAcceptAsync(this::loadHttpResponse, executorService)//
|
||||
.whenCompleteAsync((r, e) -> isLoadingHttpResponse.set(false), Platform::runLater);
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
@FXML
|
||||
@@ -140,6 +134,24 @@ public class ErrorController implements FxController {
|
||||
CompletableFuture.delayedExecutor(2, TimeUnit.SECONDS, Platform::runLater).execute(() -> copiedDetails.set(false));
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void dismiss() {
|
||||
askedForLookupDatabasePermission.set(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void lookUpSolution() {
|
||||
isLoadingHttpResponse.set(true);
|
||||
askedForLookupDatabasePermission.set(true);
|
||||
HttpClient httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
|
||||
HttpRequest httpRequest = HttpRequest.newBuilder()//
|
||||
.uri(URI.create(ERROR_CODES_URL))//
|
||||
.build();
|
||||
httpClient.sendAsync(httpRequest, HttpResponse.BodyHandlers.ofInputStream())//
|
||||
.thenAcceptAsync(this::loadHttpResponse, executorService)//
|
||||
.whenCompleteAsync((r, e) -> isLoadingHttpResponse.set(false), Platform::runLater);
|
||||
}
|
||||
|
||||
private void loadHttpResponse(HttpResponse<InputStream> response) {
|
||||
if (response.statusCode() != 200) {
|
||||
LOG.error("Status code {} when trying to load {} ", response.statusCode(), response.uri());
|
||||
@@ -293,4 +305,12 @@ public class ErrorController implements FxController {
|
||||
return isLoadingHttpResponse.get();
|
||||
}
|
||||
|
||||
public BooleanProperty askedForLookupDatabasePermissionProperty() {
|
||||
return askedForLookupDatabasePermission;
|
||||
}
|
||||
|
||||
public boolean getAskedForLookupDatabasePermission() {
|
||||
return askedForLookupDatabasePermission.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public abstract class UpdateCheckerModule {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UpdateCheckerModule.class);
|
||||
|
||||
private static final URI LATEST_VERSION_URI = URI.create("https://api.cryptomator.org/updates/latestVersion.json");
|
||||
private static final URI LATEST_VERSION_URI = URI.create("https://api.cryptomator.org/desktop/latest-version.json");
|
||||
private static final Duration UPDATE_CHECK_INTERVAL = Duration.hours(3);
|
||||
private static final Duration DISABLED_UPDATE_CHECK_INTERVAL = Duration.hours(100000); // Duration.INDEFINITE leads to overflows...
|
||||
|
||||
|
||||
@@ -102,9 +102,8 @@ public class ReceiveKeyController implements FxController {
|
||||
switch (response.statusCode()) {
|
||||
case 200 -> requestUserKey(response.body());
|
||||
case 402 -> licenseExceeded();
|
||||
case 403 -> accessNotGranted();
|
||||
case 403, 410 -> accessNotGranted(); // or vault has been archived, effectively disallowing access - TODO: add specific dialog?
|
||||
case 404 -> requestLegacyAccessToken();
|
||||
case 410 -> throw new IOException("Vault has been archived."); // TODO add dialog
|
||||
default -> throw new IOException("Unexpected response " + response.statusCode());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@@ -188,9 +187,8 @@ public class ReceiveKeyController implements FxController {
|
||||
switch (response.statusCode()) {
|
||||
case 200 -> receivedLegacyAccessTokenSuccess(response.body());
|
||||
case 402 -> licenseExceeded();
|
||||
case 403 -> accessNotGranted();
|
||||
case 403, 410 -> accessNotGranted(); // or vault has been archived, effectively disallowing access
|
||||
case 404 -> needsLegacyDeviceRegistration();
|
||||
case 410 -> throw new IOException("Vault has been archived."); // TODO add dialog
|
||||
default -> throw new IOException("Unexpected response " + response.statusCode());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user