Skip to content

Commit

Permalink
feat: add an Open SSH button for SSH on tab header menu. close #643
Browse files Browse the repository at this point in the history
  • Loading branch information
VShawn committed Apr 4, 2024
1 parent 643909d commit 71ecd65
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Shawn.Utils
26 changes: 19 additions & 7 deletions Ui/Model/ProtocolActionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,30 @@ public static List<ProtocolAction> GetActions(this ProtocolBase server, bool for
AppStartupHelper.InstallDesktopShortcutByUlid(server.DisplayName, new[] { server.Id }, iconPath);
}));

if (forTabHeader)

if (server is SSH ssh)
{
if (server is SSH ssh)
actions.Add(new ProtocolAction(IoC.Translate("Open SFTP"), () =>
{
actions.Add(new ProtocolAction(IoC.Translate("Create desktop shortcut"), () =>
var protocolClone = ssh.Clone();
// open SFTP when SSH is connected.
var tmpRunner = ProtocolHelper.GetRunner(IoC.Get<ProtocolConfigurationService>(), protocolClone, SFTP.ProtocolName);
var sftp = new SFTP
{
var iconPath = AppStartupHelper.MakeIcon(server.Id, server.IconImg);
AppStartupHelper.InstallDesktopShortcutByUlid(server.DisplayName, new[] { server.Id }, iconPath);
}));
}
ColorHex = ssh.ColorHex,
IconBase64 = ssh.IconBase64,
DisplayName = ssh.DisplayName + " (SFTP)",
Address = ssh.Address,
Port = ssh.Port,
UserName = ssh.UserName,
Password = ssh.Password,
PrivateKey = ssh.PrivateKey
};
IoC.Get<SessionControlService>().ConnectWithTab(sftp, tmpRunner, "");
}));
}


#endregion Build Actions

return actions;
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/cs-cz.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Použít soukromý klíč</s:String>
<s:String x:Key="Private key">Soukromý klíč</s:String>
<s:String x:Key="Open SFTP when connected">Při připojení otevřít SFTP</s:String>
<s:String x:Key="Open SFTP">Otevřete SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Vzdálená plocha na celou obrazovku</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Vypnout</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Zapnout (jeden monitor)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/de-de.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Benutze privaten Schlüssel</s:String>
<s:String x:Key="Private key">Privater Schlüssel</s:String>
<s:String x:Key="Open SFTP when connected">Öffnen Sie SFTP beim Anschluss</s:String>
<s:String x:Key="Open SFTP">Öffnen Sie SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Vollbild</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Deaktivieren</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Aktivieren (Einzel-Monitor)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/en-us.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Use private key</s:String>
<s:String x:Key="Private key">Private key</s:String>
<s:String x:Key="Open SFTP when connected">Open SFTP when connected</s:String>
<s:String x:Key="Open SFTP">Open SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Full screen remote desktop</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Disable</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Enable (single monitor)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/fr-fr.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">utiliser la clé privée</s:String>
<s:String x:Key="Private key">Clé privée</s:String>
<s:String x:Key="Open SFTP when connected">Ouvrir SFTP lorsqu'il est connecté</s:String>
<s:String x:Key="Open SFTP">Ouvrir SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Plein écran</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Désactiver</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Activer (moniteur unique)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/gl-es.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Usar chave privada</s:String>
<s:String x:Key="Private key">Chave privada</s:String>
<s:String x:Key="Open SFTP when connected">Abrir SFTP cando se conecte</s:String>
<s:String x:Key="Open SFTP">Abre SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Pantalla completa do escritorio remoto</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Deshabilitar</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Habilitar (unha soa pantalla)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/glossary.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Run bat after disconnected;Run bat after disconnected(e.g. run 'C:\CloseSshTunne
Use private key;Use private key;使用私钥连接;Použít soukromý klíč;Benutze privaten Schlüssel;utiliser la clé privée;Usar chave privada;;使用私密金鑰連線;Usar chave privada;Użyj klucza prywatnego;Использовать закрытый ключ
Private key;Private key;私钥;Soukromý klíč;Privater Schlüssel;Clé privée;Chave privada;;私密金鑰;Chave privada;Klucz prywatny;Закрытый ключ
Open SFTP when connected;Open SFTP when connected;同时打开 SFTP;Při připojení otevřít SFTP;Öffnen Sie SFTP beim Anschluss;Ouvrir SFTP lorsqu'il est connecté;Abra o SFTP quando conectado;;同時連線 SFTP;Abrir SFTP cando se conecte;Otwórz SFTP podczas połączenia;Открыть SFTP при подключении
Open SFTP;Open SFTP;打开 SFTP;;;;;;;;;
server_editor_display_full_screen_flag;Full screen remote desktop;全屏模式;Vzdálená plocha na celou obrazovku;Vollbild;Plein écran;Área de trabalho remota em tela cheia;;全螢幕;Pantalla completa do escritorio remoto;Tryb pełnoekranowy;Полноэкранный удаленный рабочий стол
server_editor_display_full_screen_flag_window;Disable;禁用;Vypnout;Deaktivieren;Désactiver;Desativar;;停用;Deshabilitar;Dezaktywuj;Выключить
server_editor_display_full_screen_flag_full_screen;Enable (single monitor);允许(单显示器);Zapnout (jeden monitor);Aktivieren (Einzel-Monitor);Activer (moniteur unique);Ativar (monitor único);;啟用 (單一顯示器);Habilitar (unha soa pantalla);Aktywuj (jeden monitor);Включить (один монитор)
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/glossary_translated_by_google.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Run bat after disconnected;Run bat after disconnected(e.g. run 'C:\CloseSshTunne
Use private key;Use private key;使用私钥连接;Použít soukromý klíč;Benutze privaten Schlüssel;utiliser la clé privée;Usar chave privada;秘密キーを使用する;使用私密金鑰連線;Usar chave privada;Użyj klucza prywatnego;Использовать закрытый ключ
Private key;Private key;私钥;Soukromý klíč;Privater Schlüssel;Clé privée;Chave privada;秘密鍵;私密金鑰;Chave privada;Klucz prywatny;Закрытый ключ
Open SFTP when connected;Open SFTP when connected;同时打开 SFTP;Při připojení otevřít SFTP;Öffnen Sie SFTP beim Anschluss;Ouvrir SFTP lorsqu'il est connecté;Abra o SFTP quando conectado;接続時にSFTPを開く;同時連線 SFTP;Abrir SFTP cando se conecte;Otwórz SFTP podczas połączenia;Открыть SFTP при подключении
Open SFTP;Open SFTP;打开 SFTP;Otevřete SFTP;Öffnen Sie SFTP;Ouvrir SFTP;Abrir SFTP;オープンSFTP;打開SFTP;Abre SFTP;Otwórz SFTP;Открыть SFTP
server_editor_display_full_screen_flag;Full screen remote desktop;全屏模式;Vzdálená plocha na celou obrazovku;Vollbild;Plein écran;Área de trabalho remota em tela cheia;全画面リモートデスクトップ;全螢幕;Pantalla completa do escritorio remoto;Tryb pełnoekranowy;Полноэкранный удаленный рабочий стол
server_editor_display_full_screen_flag_window;Disable;禁用;Vypnout;Deaktivieren;Désactiver;Desativar;無効にする;停用;Deshabilitar;Dezaktywuj;Выключить
server_editor_display_full_screen_flag_full_screen;Enable (single monitor);允许(单显示器);Zapnout (jeden monitor);Aktivieren (Einzel-Monitor);Activer (moniteur unique);Ativar (monitor único);有効にする (シングルモニター);啟用 (單一顯示器);Habilitar (unha soa pantalla);Aktywuj (jeden monitor);Включить (один монитор)
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/ja-jp.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">秘密キーを使用する</s:String>
<s:String x:Key="Private key">秘密鍵</s:String>
<s:String x:Key="Open SFTP when connected">接続時にSFTPを開く</s:String>
<s:String x:Key="Open SFTP">オープンSFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">全画面リモートデスクトップ</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">無効にする</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">有効にする (シングルモニター)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/pl-pl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Użyj klucza prywatnego</s:String>
<s:String x:Key="Private key">Klucz prywatny</s:String>
<s:String x:Key="Open SFTP when connected">Otwórz SFTP podczas połączenia</s:String>
<s:String x:Key="Open SFTP">Otwórz SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Tryb pełnoekranowy</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Dezaktywuj</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Aktywuj (jeden monitor)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/pt-br.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Usar chave privada</s:String>
<s:String x:Key="Private key">Chave privada</s:String>
<s:String x:Key="Open SFTP when connected">Abra o SFTP quando conectado</s:String>
<s:String x:Key="Open SFTP">Abrir SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Área de trabalho remota em tela cheia</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Desativar</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Ativar (monitor único)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/ru-ru.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">Использовать закрытый ключ</s:String>
<s:String x:Key="Private key">Закрытый ключ</s:String>
<s:String x:Key="Open SFTP when connected">Открыть SFTP при подключении</s:String>
<s:String x:Key="Open SFTP">Открыть SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">Полноэкранный удаленный рабочий стол</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">Выключить</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">Включить (один монитор)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/zh-cn.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">使用私钥连接</s:String>
<s:String x:Key="Private key">私钥</s:String>
<s:String x:Key="Open SFTP when connected">同时打开 SFTP</s:String>
<s:String x:Key="Open SFTP">打开 SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">全屏模式</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">禁用</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">允许(单显示器)</s:String>
Expand Down
1 change: 1 addition & 0 deletions Ui/Resources/Languages/zh-tw.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<s:String x:Key="Use private key">使用私密金鑰連線</s:String>
<s:String x:Key="Private key">私密金鑰</s:String>
<s:String x:Key="Open SFTP when connected">同時連線 SFTP</s:String>
<s:String x:Key="Open SFTP">打開SFTP</s:String>
<s:String x:Key="server_editor_display_full_screen_flag">全螢幕</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_window">停用</s:String>
<s:String x:Key="server_editor_display_full_screen_flag_full_screen">啟用 (單一顯示器)</s:String>
Expand Down
2 changes: 1 addition & 1 deletion Ui/Service/SessionControlService_OpenConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private void ConnectWithFullScreen(in ProtocolBase server, in Runner runner)
SimpleLogHelper.Debug($@"Start Conn: {server.DisplayName}({server.GetHashCode()}) by host({host.GetHashCode()}) with full");
}

private string ConnectWithTab(in ProtocolBase protocol, in Runner runner, string assignTabToken)
public string ConnectWithTab(in ProtocolBase protocol, in Runner runner, string assignTabToken)
{
TabWindowView? tab = null;
ProtocolBase p = protocol;
Expand Down

0 comments on commit 71ecd65

Please sign in to comment.