Skip to content

Commit 41d48be

Browse files
committed
feat: Add character set translation option to Kitty #436
1 parent e4a78cd commit 41d48be

File tree

8 files changed

+312
-219
lines changed

8 files changed

+312
-219
lines changed

.github/workflows/build-on-dev-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- uses: actions/upload-artifact@v3
9696
with:
9797
name: 1Remote-${{env.BuildVersion}}-net4.8(not recommended)
98-
path: Ui/bin/ReleaseNet48/net48
98+
path: Ui/bin/Release/net4.8-windows/publish
9999

100100
# Publish the application Net6.0
101101
- name: Publish the application
@@ -109,7 +109,7 @@ jobs:
109109
outputs:
110110
BuildVersion: ${{env.BuildVersion}}
111111
PreRelease: ${{env.PreRelease}}
112-
#artifact_net48: 1Remote-${{env.BuildVersion}}-net4.8(not recommended)
112+
artifact_net48: 1Remote-${{env.BuildVersion}}-net4.8(not recommended)
113113
artifact_net6x: 1Remote-${{env.BuildVersion}}-net6-x64
114114

115115
# publish stable build, run only tag is not empty

Installer/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Identity
1313
Name="16536Shawn.V.Workshop.PRemoteM"
1414
Publisher="CN=72AC6E85-B8C4-48F8-A07B-9A985863E628"
15-
Version="1.0.78.0" />
15+
Version="1.0.77.0" />
1616

1717
<Properties>
1818
<DisplayName>1Remote</DisplayName>

Ui/Model/ProtocolRunner/Default/KittyRunner.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Collections.ObjectModel;
34
using System.IO;
45
using System.Linq;
@@ -18,6 +19,45 @@ public class KittyRunner : InternalDefaultRunner
1819
public KittyRunner(string ownerProtocolName) : base(ownerProtocolName)
1920
{
2021
base.Name = Name;
22+
CodePages = new List<string>
23+
{
24+
"UTF-8",
25+
"ISO-8859-1:1998 (Latin-1, West Europe)",
26+
"ISO-8859-2:1999 (Latin-2, East Europe)",
27+
"ISO-8859-3:1999 (Latin-3, South Europe)",
28+
"ISO-8859-4:1998 (Latin-4, North Europe)",
29+
"ISO-8859-5:1999 (Latin/Cyrillic)",
30+
"ISO-8859-6:1999 (Latin/Arabic)",
31+
"ISO-8859-7:1987 (Latin/Greek)",
32+
"ISO-8859-8:1999 (Latin/Hebrew)",
33+
"ISO-8859-9:1999 (Latin-5, Turkish)",
34+
"ISO-8859-10:1998 (Latin-6, Nordic)",
35+
"ISO-8859-11:2001 (Latin/Thai)",
36+
"ISO-8859-13:1998 (Latin-7, Baltic)",
37+
"ISO-8859-14:1998 (Latin-8, Celtic)",
38+
"ISO-8859-15:1999 (Latin-9, \"euro\")",
39+
"ISO-8859-16:2001 (Latin-10, Balkan)",
40+
"KOI8-U",
41+
"KOI8-R",
42+
"HP-ROMAN8",
43+
"VSCII",
44+
"DEC-MCS",
45+
"Win1250 (Central European)",
46+
"Win1251 (Cyrillic)",
47+
"Win1252 (Western)",
48+
"Win1253 (Greek)",
49+
"Win1254 (Turkish)",
50+
"Win1255 (Hebrew)",
51+
"Win1256 (Arabic)",
52+
"Win1257 (Baltic)",
53+
"Win1258 (Vietnamese)",
54+
"CP437",
55+
"CP620 (Mazovia)",
56+
"CP819",
57+
"CP852",
58+
"CP878",
59+
"Use font encoding",
60+
};
2161
}
2262

2363
private int _puttyFontSize = 14;
@@ -42,7 +82,29 @@ public string PuttyThemeName
4282
[JsonIgnore]
4383
public ObservableCollection<string> PuttyThemeNames => new ObservableCollection<string>(PuttyThemes.Themes.Keys);
4484

85+
[JsonIgnore]
86+
public List<string> CodePages { get; }
4587

88+
private string _lineCodePage = "UTF-8";
89+
public string LineCodePage
90+
{
91+
get => _lineCodePage;
92+
set => SetAndNotifyIfChanged(ref _lineCodePage, value);
93+
}
94+
95+
public string GetLineCodePageForIni()
96+
{
97+
// { "UTF-8", "UTF-8" },
98+
// { "ISO-8859-1:1998 (Latin-1, West Europe)", "ISO-8859-1%3A1998%20(Latin-1,%20West%20Europe)" },
99+
// { "ISO-8859-5:1999 (Latin/Cyrillic)", "ISO-8859-5%3A1999%20(Latin%2FCyrillic)" },
100+
// { "ISO-8859-15:1999 (Latin-9, \"euro\")", "ISO-8859-15%3A1999%20(Latin-9,%20%22euro%22)" },
101+
// { "CP437", "CP437" },
102+
return _lineCodePage.Trim()
103+
.Replace(" ", "%20")
104+
.Replace("\"", "%22")
105+
.Replace("/", "%2F")
106+
.Replace(":", "%3A");
107+
}
46108

47109
private string _puttyExePath = "";
48110
public string PuttyExePath

Ui/Service/SessionControlService_OpenConnection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ private async void Connect(ProtocolBase protocol, string fromView, string assign
192192
{
193193
var vmServer = _appData.GetItemById(protocol.DataSource?.DataSourceName ?? "", protocol.Id);
194194
vmServer?.UpdateConnectTime();
195-
IoC.Get<TaskTrayService>().ReloadTaskTrayContextMenuIfConnectionStart();
195+
if (IoC.Get<ConfigurationService>().General.ShowRecentlySessionInTray)
196+
IoC.Get<TaskTrayService>().ReloadTaskTrayContextMenu();
196197
}
197198
#endregion
198199

Ui/Ui.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108
<PropertyGroup Condition="'$(Configuration)'=='StoreRelease'">
109109
<DefineConstants>TRACE;FOR_MICROSOFT_STORE_ONLY;</DefineConstants>
110-
<Optimize>False</Optimize>
110+
<Optimize>True</Optimize>
111111
</PropertyGroup>
112112

113113
<ItemGroup>
@@ -490,11 +490,11 @@
490490
</ItemGroup>
491491

492492
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
493-
<Exec Command="powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_APP_CENTER_SECRET===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\APP_CENTER_SECRET_1REMOTE.txt&quot;&#xD;&#xA;powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_SALT===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\Salt.txt&quot;" />
493+
<Exec Command="powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_APP_CENTER_SECRET===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\APP_CENTER_SECRET_1REMOTE.txt&quot;&#xD;&#xA;powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_SALT===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\Salt.txt&quot;&#xD;&#xA;powershell.exe ..\scripts\Set-BuildDate.ps1 -filePath .\Ui\AppVersion.cs" />
494494
</Target>
495495

496496
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
497-
<Exec Command="powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_APP_CENTER_SECRET===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\APP_CENTER_SECRET_1REMOTE.txt&quot; -isRevert&#xD;&#xA;powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_SALT===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\Salt.txt&quot; -isRevert" />
497+
<Exec Command="powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_APP_CENTER_SECRET===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\APP_CENTER_SECRET_1REMOTE.txt&quot; -isRevert&#xD;&#xA;powershell.exe ..\scripts\Set-Secret.ps1 -filePath .\Ui\Assert.cs -Pattern &quot;===REPLACE_ME_WITH_SALT===&quot; -localSecretFilePath &quot;C:\1Remote_Secret\Salt.txt&quot; -isRevert&#xD;&#xA;powershell.exe ..\scripts\Set-BuildDate.ps1 -filePath .\Ui\AppVersion.cs -isRevert" />
498498
</Target>
499499

500500
<ItemGroup>

Ui/Utils/KiTTY/IKittyConnectable.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ public static void ConfigKitty(this IKittyConnectable iKittyConnectable, string
4242
WriteKiTTYDefaultConfig(kittyRunner.PuttyExePath);
4343

4444
// create session config
45-
var puttyOption = new KittyConfig(sessionName, iKittyConnectable.ExternalKittySessionConfigPath);
45+
var puttyOption = new KittyConfig(sessionName);
46+
47+
puttyOption.Set(EnumKittyConfigKey.LineCodePage, kittyRunner.GetLineCodePageForIni());
48+
49+
puttyOption.ApplyOverwriteSession(iKittyConnectable.ExternalKittySessionConfigPath);
50+
51+
4652
if (iKittyConnectable is SSH server)
4753
{
4854
if (!string.IsNullOrEmpty(sshPrivateKeyPath))

0 commit comments

Comments
 (0)