mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Rdp rework for other user login
This commit is contained in:
parent
10d5541386
commit
d2f3439961
27 changed files with 139 additions and 0 deletions
|
@ -50,6 +50,10 @@ public interface ExternalRdpClientType extends PrefsChoiceValue {
|
|||
return input;
|
||||
}
|
||||
|
||||
if (input.get("username").isEmpty()) {
|
||||
return input;
|
||||
}
|
||||
|
||||
var pass = configuration.getPassword();
|
||||
if (pass == null) {
|
||||
return input;
|
||||
|
|
93
app/src/main/java/io/xpipe/app/util/AsktextAlert.java
Normal file
93
app/src/main/java/io/xpipe/app/util/AsktextAlert.java
Normal file
|
@ -0,0 +1,93 @@
|
|||
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.window.AppWindowHelper;
|
||||
import io.xpipe.app.fxcomps.impl.TextFieldComp;
|
||||
import javafx.animation.AnimationTimer;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class AsktextAlert {
|
||||
|
||||
public static Optional<String> query(String prompt) {
|
||||
if (!PlatformState.initPlatformIfNeeded()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
AppStyle.init();
|
||||
AppTheme.init();
|
||||
|
||||
var prop = new SimpleObjectProperty<String>();
|
||||
var r = AppWindowHelper.showBlockingAlert(alert -> {
|
||||
alert.setTitle(AppI18n.get("asktextAlertTitle"));
|
||||
alert.setHeaderText(prompt);
|
||||
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||
|
||||
var text = new TextFieldComp(prop, false).createStructure();
|
||||
alert.getDialogPane().setContent(new StackPane(text.get()));
|
||||
var stage = (Stage) alert.getDialogPane().getScene().getWindow();
|
||||
stage.setAlwaysOnTop(true);
|
||||
|
||||
var anim = new AnimationTimer() {
|
||||
|
||||
private long lastRun = 0;
|
||||
private int regainedFocusCount;
|
||||
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
if (!stage.isShowing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (regainedFocusCount >= 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastRun == 0) {
|
||||
lastRun = now;
|
||||
return;
|
||||
}
|
||||
|
||||
long elapsed = (now - lastRun) / 1_000_000;
|
||||
if (elapsed < 500) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hasFocus = stage.isFocused();
|
||||
if (!hasFocus) {
|
||||
regainedFocusCount++;
|
||||
}
|
||||
stage.requestFocus();
|
||||
lastRun = now;
|
||||
}
|
||||
};
|
||||
|
||||
alert.setOnShown(event -> {
|
||||
stage.requestFocus();
|
||||
anim.start();
|
||||
// Wait 1 pulse before focus so that the scene can be assigned to text
|
||||
Platform.runLater(() -> {
|
||||
text.get().requestFocus();
|
||||
text.get().end();
|
||||
});
|
||||
event.consume();
|
||||
});
|
||||
|
||||
alert.setOnHiding(event -> {
|
||||
anim.stop();
|
||||
});
|
||||
})
|
||||
.filter(b -> b.getButtonData().isDefaultButton())
|
||||
.map(t -> {
|
||||
return prop.getValue() != null ? prop.getValue() : null;
|
||||
});
|
||||
return r;
|
||||
}
|
||||
}
|
|
@ -70,6 +70,12 @@ public class RdpConfig {
|
|||
.collect(Collectors.joining("\n"));
|
||||
}
|
||||
|
||||
public RdpConfig withRemoved(String key) {
|
||||
var map = new LinkedHashMap<String, TypedValue>(content);
|
||||
map.remove(key);
|
||||
return new RdpConfig(map);
|
||||
}
|
||||
|
||||
public Optional<TypedValue> get(String key) {
|
||||
return Optional.ofNullable(content.get(key));
|
||||
}
|
||||
|
|
|
@ -522,3 +522,4 @@ green=Grøn
|
|||
yellow=Gul
|
||||
blue=Blå
|
||||
red=Rød
|
||||
asktextAlertTitle=Spørg
|
||||
|
|
|
@ -516,3 +516,4 @@ green=Grün
|
|||
yellow=Gelb
|
||||
blue=Blau
|
||||
red=Rot
|
||||
asktextAlertTitle=Eingabeaufforderung
|
||||
|
|
|
@ -522,3 +522,4 @@ green=Green
|
|||
yellow=Yellow
|
||||
blue=Blue
|
||||
red=Red
|
||||
asktextAlertTitle=Prompt
|
|
@ -503,3 +503,4 @@ green=Verde
|
|||
yellow=Amarillo
|
||||
blue=Azul
|
||||
red=Rojo
|
||||
asktextAlertTitle=Pregunta
|
||||
|
|
|
@ -503,3 +503,4 @@ green=Vert
|
|||
yellow=Jaune
|
||||
blue=Bleu
|
||||
red=Rouge
|
||||
asktextAlertTitle=Invite
|
||||
|
|
|
@ -503,3 +503,4 @@ green=Verde
|
|||
yellow=Giallo
|
||||
blue=Blu
|
||||
red=Rosso
|
||||
asktextAlertTitle=Prompt
|
||||
|
|
|
@ -503,3 +503,4 @@ green=グリーン
|
|||
yellow=黄色
|
||||
blue=ブルー
|
||||
red=赤い
|
||||
asktextAlertTitle=プロンプト
|
||||
|
|
|
@ -503,3 +503,4 @@ green=Groen
|
|||
yellow=Geel
|
||||
blue=Blauw
|
||||
red=Rood
|
||||
asktextAlertTitle=Prompt
|
||||
|
|
|
@ -503,3 +503,4 @@ green=Verde
|
|||
yellow=Amarelo
|
||||
blue=Azul
|
||||
red=Vermelho
|
||||
asktextAlertTitle=Prompt
|
||||
|
|
|
@ -503,3 +503,4 @@ green=Зеленый
|
|||
yellow=Желтый
|
||||
blue=Синий
|
||||
red=Красный
|
||||
asktextAlertTitle=Prompt
|
||||
|
|
|
@ -504,3 +504,4 @@ green=Yeşil
|
|||
yellow=Sarı
|
||||
blue=Mavi
|
||||
red=Kırmızı
|
||||
asktextAlertTitle=İstem
|
||||
|
|
|
@ -503,3 +503,4 @@ green=绿色
|
|||
yellow=黄色
|
||||
blue=蓝色
|
||||
red=红色
|
||||
asktextAlertTitle=提示
|
||||
|
|
|
@ -407,3 +407,5 @@ editConfiguration=Rediger konfiguration
|
|||
viewInDashboard=Visning i dashboard
|
||||
setDefault=Indstil standard
|
||||
removeDefault=Fjern standard
|
||||
connectAsOtherUser=Opret forbindelse som anden bruger
|
||||
provideUsername=Giv et alternativt brugernavn til at logge ind med
|
||||
|
|
|
@ -385,3 +385,5 @@ editConfiguration=Konfiguration bearbeiten
|
|||
viewInDashboard=Ansicht im Dashboard
|
||||
setDefault=Standard einstellen
|
||||
removeDefault=Standard entfernen
|
||||
connectAsOtherUser=Als anderer Benutzer verbinden
|
||||
provideUsername=Einen alternativen Benutzernamen zum Einloggen angeben
|
||||
|
|
|
@ -383,3 +383,5 @@ editConfiguration=Edit configuration
|
|||
viewInDashboard=View in dashboard
|
||||
setDefault=Set default
|
||||
removeDefault=Remove default
|
||||
connectAsOtherUser=Connect as other user
|
||||
provideUsername=Provide alternative username to log in with
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Editar configuración
|
|||
viewInDashboard=Vista en el panel de control
|
||||
setDefault=Establecer por defecto
|
||||
removeDefault=Eliminar por defecto
|
||||
connectAsOtherUser=Conectarse como otro usuario
|
||||
provideUsername=Proporcionar un nombre de usuario alternativo con el que iniciar sesión
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Modifier la configuration
|
|||
viewInDashboard=Vue dans le tableau de bord
|
||||
setDefault=Définir par défaut
|
||||
removeDefault=Supprimer la valeur par défaut
|
||||
connectAsOtherUser=Se connecter en tant qu'autre utilisateur
|
||||
provideUsername=Fournir un autre nom d'utilisateur pour se connecter
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Modifica la configurazione
|
|||
viewInDashboard=Vista nel cruscotto
|
||||
setDefault=Imposta predefinito
|
||||
removeDefault=Rimuovi l'impostazione predefinita
|
||||
connectAsOtherUser=Connettersi come altro utente
|
||||
provideUsername=Fornisce un nome utente alternativo con cui accedere
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=設定を編集する
|
|||
viewInDashboard=ダッシュボードで見る
|
||||
setDefault=デフォルトを設定する
|
||||
removeDefault=デフォルトを削除する
|
||||
connectAsOtherUser=他のユーザーとして接続する
|
||||
provideUsername=別のユーザー名でログインする
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Configuratie bewerken
|
|||
viewInDashboard=Weergave in dashboard
|
||||
setDefault=Standaard instellen
|
||||
removeDefault=Standaard verwijderen
|
||||
connectAsOtherUser=Verbinden als andere gebruiker
|
||||
provideUsername=Geef een alternatieve gebruikersnaam om mee in te loggen
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Edita a configuração
|
|||
viewInDashboard=Ver no painel de controlo
|
||||
setDefault=Definir predefinição
|
||||
removeDefault=Remover predefinição
|
||||
connectAsOtherUser=Liga-te como outro utilizador
|
||||
provideUsername=Fornece um nome de utilizador alternativo para iniciar sessão
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Редактирование конфигурации
|
|||
viewInDashboard=Вид в приборной панели
|
||||
setDefault=Установить по умолчанию
|
||||
removeDefault=Убрать значение по умолчанию
|
||||
connectAsOtherUser=Подключиться как другой пользователь
|
||||
provideUsername=Предоставьте альтернативное имя пользователя для входа в систему
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=Yapılandırmayı düzenle
|
|||
viewInDashboard=Gösterge tablosunda görüntüle
|
||||
setDefault=Varsayılanı ayarla
|
||||
removeDefault=Varsayılanı kaldır
|
||||
connectAsOtherUser=Diğer kullanıcı olarak bağlan
|
||||
provideUsername=Oturum açmak için alternatif kullanıcı adı sağlayın
|
||||
|
|
|
@ -381,3 +381,5 @@ editConfiguration=编辑配置
|
|||
viewInDashboard=在仪表板中查看
|
||||
setDefault=设置默认值
|
||||
removeDefault=删除默认值
|
||||
connectAsOtherUser=以其他用户身份连接
|
||||
provideUsername=提供其他登录用户名
|
||||
|
|
Loading…
Reference in a new issue