Handle askpass without platform

This commit is contained in:
crschnick 2024-03-24 05:53:45 +00:00
parent d5442e858d
commit 4fdf89b77d
2 changed files with 9 additions and 10 deletions

View file

@ -1,8 +1,5 @@
package io.xpipe.app.exchange;
import io.xpipe.app.core.AppStyle;
import io.xpipe.app.core.AppTheme;
import io.xpipe.app.util.PlatformState;
import io.xpipe.app.util.SecretManager;
import io.xpipe.beacon.BeaconHandler;
import io.xpipe.beacon.exchange.AskpassExchange;
@ -19,13 +16,6 @@ public class AskpassExchangeImpl extends AskpassExchange
return Response.builder().build();
}
if (!PlatformState.initPlatformIfNeeded()) {
return Response.builder().build();
}
AppStyle.init();
AppTheme.init();
var p = found.get();
var secret = p.process(msg.getPrompt());
return Response.builder()

View file

@ -1,6 +1,8 @@
package io.xpipe.app.util;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.AppStyle;
import io.xpipe.app.core.AppTheme;
import io.xpipe.app.core.AppWindowHelper;
import io.xpipe.app.fxcomps.impl.SecretFieldComp;
import io.xpipe.core.util.InPlaceSecretValue;
@ -17,6 +19,13 @@ import javafx.stage.Stage;
public class AskpassAlert {
public static SecretQueryResult queryRaw(String prompt, InPlaceSecretValue secretValue) {
if (!PlatformState.initPlatformIfNeeded()) {
return new SecretQueryResult(null, true);
}
AppStyle.init();
AppTheme.init();
var prop = new SimpleObjectProperty<>(secretValue);
var r = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("askpassAlertTitle"));