mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-18 21:26:02 +00:00
Change text from registration to "naming" and prefill device name
This commit is contained in:
@@ -25,6 +25,9 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
@@ -33,6 +36,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@KeyLoadingScoped
|
||||
@@ -69,6 +73,18 @@ public class RegisterDeviceController implements FxController {
|
||||
this.httpClient = HttpClient.newBuilder().executor(executor).build();
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
deviceNameField.setText(System.getProperty("user.name") + "-" + determineHostname());
|
||||
}
|
||||
|
||||
private String determineHostname() {
|
||||
try {
|
||||
return new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine();
|
||||
} catch (IOException e) {
|
||||
return String.valueOf(ThreadLocalRandom.current().nextInt());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void register() {
|
||||
var keyUri = URI.create(hubConfig.devicesResourceUrl + deviceId);
|
||||
@@ -84,7 +100,7 @@ public class RegisterDeviceController implements FxController {
|
||||
.build();
|
||||
httpClient.sendAsync(request, HttpResponse.BodyHandlers.discarding()) //
|
||||
.handleAsync((response, throwable) -> {
|
||||
if( response != null) {
|
||||
if (response != null) {
|
||||
this.registrationSucceeded(response);
|
||||
} else {
|
||||
this.registrationFailed(throwable);
|
||||
|
||||
@@ -133,16 +133,16 @@ hub.auth.loginLink=Not redirected? Click here to open it.
|
||||
hub.receive.message=Processing response…
|
||||
hub.receive.description=Cryptomator is receiving and processing the response from Hub. Please wait.
|
||||
### Register Device
|
||||
hub.register.message=Register device?
|
||||
hub.register.description=This seems to be the first access from this device to Cryptomator Hub. In order to unlock any vault, you need to choose a name and register it.
|
||||
hub.register.message=Device name required
|
||||
hub.register.description=This seems to be the first Hub access from this device. In order to identify it for access authorization, you need to name this device.
|
||||
hub.register.nameLabel=Device Name
|
||||
hub.register.registerBtn=Register
|
||||
hub.register.registerBtn=Confirm
|
||||
### Registration Success
|
||||
hub.registerSuccess.message=Device registered
|
||||
hub.registerSuccess.message=Device named
|
||||
hub.registerSuccess.description=To access the vault, your device needs to be authorized by the vault owner.
|
||||
### Registration Failed
|
||||
hub.registerFailed.message=Device registration failed
|
||||
hub.registerFailed.description=An error was thrown in the registration process. For more details, look into the application log.
|
||||
hub.registerFailed.message=Device naming failed
|
||||
hub.registerFailed.description=An error was thrown in the naming process. For more details, look into the application log.
|
||||
### Unauthorized
|
||||
hub.unauthorized.message=Access denied
|
||||
hub.unauthorized.description=Your device has not yet been authorized to access this vault. Ask the vault owner to authorize it.
|
||||
|
||||
Reference in New Issue
Block a user