This commit is contained in:
Sebastian Stenzel
2023-10-19 10:00:14 +02:00
parent 34c17be474
commit 468eed58d5
2 changed files with 4 additions and 5 deletions

View File

@@ -115,7 +115,7 @@ public abstract class HubKeyLoadingModule {
@Provides
@FxmlScene(FxmlFile.HUB_LEGACY_REGISTER_DEVICE)
@KeyLoadingScoped
static Scene provideHubRegisterDeviceScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
static Scene provideHubLegacyRegisterDeviceScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
return fxmlLoaders.createScene(FxmlFile.HUB_LEGACY_REGISTER_DEVICE);
}
@@ -136,7 +136,7 @@ public abstract class HubKeyLoadingModule {
@Provides
@FxmlScene(FxmlFile.HUB_SETUP_DEVICE)
@KeyLoadingScoped
static Scene provideHubSetupDeviceScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
static Scene provideHubRegisterDeviceScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
return fxmlLoaders.createScene(FxmlFile.HUB_SETUP_DEVICE);
}
@@ -170,7 +170,7 @@ public abstract class HubKeyLoadingModule {
@Binds
@IntoMap
@FxControllerKey(RegisterDeviceController.class)
abstract FxController bindSetupDeviceController(RegisterDeviceController controller);
abstract FxController bindRegisterDeviceController(RegisterDeviceController controller);
@Binds
@IntoMap

View File

@@ -109,7 +109,6 @@ public class RegisterDeviceController implements FxController {
workInProgress.set(true);
var apiRootUrl = hubConfig.getApiBaseUrl();
var deviceKey = deviceKeyPair.getPublic().getEncoded();
var userReq = HttpRequest.newBuilder(apiRootUrl.resolve("users/me")) //
.GET() //
@@ -135,7 +134,7 @@ public class RegisterDeviceController implements FxController {
}
}).thenCompose(jwe -> {
var now = Instant.now().toString();
var dto = new CreateDeviceDto(deviceId, deviceNameField.getText(), BaseEncoding.base64().encode(deviceKey), "DESKTOP", jwe.serialize(), now);
var dto = new CreateDeviceDto(deviceId, deviceNameField.getText(), BaseEncoding.base64().encode(deviceKeyPair.getPublic().getEncoded()), "DESKTOP", jwe.serialize(), now);
var json = toJson(dto);
var deviceUri = apiRootUrl.resolve("devices/" + deviceId);
var putDeviceReq = HttpRequest.newBuilder(deviceUri) //