Skip to content

Commit cc91793

Browse files
committed
Rebase to main
2 parents a882b9d + 603c973 commit cc91793

27 files changed

+137
-109
lines changed

.github/workflows/qodana-scan-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
Configuration: ${{ matrix.configuration }}
3030
Platform: ${{ matrix.platform }}
3131
DOTNET_INSTALL_DIR: '.\.dotnet'
32-
DOTNET_VERSION: '9.x'
32+
DOTNET_VERSION: '9.0.2xx'
3333
DOTNET_QUALITY: 'ga'
3434
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
3535

.github/workflows/qodana-scan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
Configuration: ${{ matrix.configuration }}
2121
Platform: ${{ matrix.platform }}
2222
DOTNET_INSTALL_DIR: '.\.dotnet'
23-
DOTNET_VERSION: '9.x'
23+
DOTNET_VERSION: '9.0.2xx'
2424
DOTNET_QUALITY: 'ga'
2525
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
2626
permissions:

.github/workflows/vt-scan-releases.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
update_release_body: true
3535
github_token: ${{ secrets.GITHUB_TOKEN }}
3636
files: |
37-
^.*\.[7zZ]$
37+
^.*\.[7][zZ]$
Loading

CollapseLauncher/Classes/Helper/HttpClientBuilder.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using CollapseLauncher.Helper.Update;
1+
using CollapseLauncher.Helper.Update;
22
using Hi3Helper.Shared.Region;
33
using System;
44
using System.Collections.Generic;
55
using System.Net;
66
using System.Net.Http;
77
using System.Net.Security;
88
using System.Runtime.InteropServices;
9-
using System.Threading;
9+
using System.Security;
1010
// ReSharper disable StringLiteralTypo
1111
// ReSharper disable UnusedMember.Global
1212
// ReSharper disable CheckNamespace
@@ -58,7 +58,7 @@ private static string GetDefaultUserAgent()
5858
+ $"WinAppSDK/{LauncherConfig.WindowsAppSdkVersion}";
5959
}
6060

61-
public HttpClientBuilder<THandler> UseExternalProxy(string host, string? username = null, string? password = null)
61+
public HttpClientBuilder<THandler> UseExternalProxy(string host, string? username = null, SecureString? password = null)
6262
{
6363
// Try to create the Uri
6464
if (Uri.TryCreate(host, UriKind.Absolute, out Uri? hostUri))
@@ -70,17 +70,16 @@ public HttpClientBuilder<THandler> UseExternalProxy(string host, string? usernam
7070
IsUseSystemProxy = false;
7171
ExternalProxy = null;
7272
return this;
73-
7473
}
7574

76-
public HttpClientBuilder<THandler> UseExternalProxy(Uri hostUri, string? username = null, string? password = null)
75+
public HttpClientBuilder<THandler> UseExternalProxy(Uri hostUri, string? username = null, SecureString? password = null)
7776
{
7877
IsUseSystemProxy = false;
7978

8079
// Initialize the proxy host
8180
ExternalProxy =
8281
!string.IsNullOrEmpty(username)
83-
&& !string.IsNullOrEmpty(password) ?
82+
&& password != null ?
8483
new WebProxy(hostUri, true, null, new NetworkCredential(username, password))
8584
: new WebProxy(hostUri, true);
8685

@@ -107,7 +106,8 @@ public HttpClientBuilder<THandler> UseLauncherConfig(int maxConnections = MaxCon
107106

108107
if (lIsUseProxy && isHttpProxyUrlValid && lProxyUri != null)
109108
{
110-
UseExternalProxy(lProxyUri, lHttpProxyUsername, lHttpProxyPassword);
109+
using SecureString? proxyPassword = SimpleProtectData.UnprotectStringAsSecureString(lHttpProxyPassword);
110+
UseExternalProxy(lProxyUri, lHttpProxyUsername, proxyPassword);
111111
}
112112

113113
lock (HttpClientBuilderSharedLock)

CollapseLauncher/Classes/Helper/SimpleProtectData.cs

+24
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Hi3Helper.SentryHelper;
33
using System;
44
using System.Buffers.Text;
5+
using System.Security;
56
using System.Security.Cryptography;
67
using System.Text;
78

@@ -106,5 +107,28 @@ internal static class SimpleProtectData
106107
Array.Clear(unprotectedData);
107108
}
108109
}
110+
111+
internal static unsafe SecureString? UnprotectStringAsSecureString(string? input)
112+
{
113+
string? rawString = UnprotectString(input);
114+
115+
if (string.IsNullOrEmpty(rawString))
116+
return null;
117+
118+
int len = rawString.Length;
119+
fixed (char* charB = rawString)
120+
{
121+
try
122+
{
123+
SecureString secureString = new SecureString(charB, rawString.Length);
124+
return secureString;
125+
}
126+
finally
127+
{
128+
for (int i = 0; i < len; i++)
129+
*(charB + i) = '\0';
130+
}
131+
}
132+
}
109133
}
110134
}

CollapseLauncher/Classes/Helper/WindowUtility.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ internal static NotificationService? CurrentToastNotificationService
368368
Guid existingAumidGuidFromShell = TrayIcon.Current.CollapseTaskbar.Id;
369369

370370
// Use custom defined path for the Toast icon
371-
string iconPath = Path.Combine(LauncherConfig.AppAssetsFolder, "CollapseLauncherLogo.png");
371+
string iconPath = Path.Combine(LauncherConfig.AppAssetsFolder, "CollapseLauncherLogoSmall.png");
372372

373373
// Initialize Toast Notification service
374374
CurrentAumidInGuid = field.Initialize(appAumidFromShortcut ?? MainEntryPoint.AppAumid,

CollapseLauncher/CollapseLauncher.csproj

+5-6
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,9 @@
162162
<PackageReference Include="Clowd.Squirrel" Version="2.11.1" Condition="!$(DefineConstants.Contains('USEVELOPACK'))" />
163163
<PackageReference Include="Libsql.Client" Version="0.5.0" />
164164
<!-- Velopacks' outdated dependencies, remove this once they switched to .NET 9 -->
165-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.2" />
165+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.3" />
166166
<!-- Velopacks' outdated dependencies, remove this once they switched to .NET 9 -->
167-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
168-
<PackageReference Include="TurnerSoftware.DinoDNS" Version="0.3.0" />
167+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.3" />
169168
<PackageReference Include="Velopack" Version="0.0.1053" Condition="$(DefineConstants.Contains('USEVELOPACK'))" />
170169

171170
<PackageReference Include="CommunityToolkit.Common" Version="8.4.0" />
@@ -201,9 +200,9 @@
201200
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
202201
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
203202
<PackageReference Include="System.Security.AccessControl" Version="6.0.1" />
204-
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="9.0.2" />
205-
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.2" />
206-
<PackageReference Include="System.Text.Json" Version="9.0.2" />
203+
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="9.0.3" />
204+
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.3" />
205+
<PackageReference Include="System.Text.Json" Version="9.0.3" />
207206
</ItemGroup>
208207

209208
<ItemGroup>

0 commit comments

Comments
 (0)