Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET ⑨ (strongest version) #3244

Merged
merged 22 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ dotnet_style_qualification_for_property = false:warning
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = always:warning

[ArchiSteamFarm/**.cs]
# ASF project includes plugin system, therefore CA1515 typically doesn't make sense there
dotnet_diagnostic.CA1515.severity = silent

###############################
# JetBrains, IntelliJ/Rider #
###############################
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SDK_VERSION: 8.0
DOTNET_SDK_VERSION: 9.0

permissions: {}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_SDK_VERSION: 8.0
DOTNET_SDK_VERSION: 9.0
NODE_JS_VERSION: 'lts/*'
PLUGINS_BUNDLED: ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
PLUGINS_INCLUDED: ArchiSteamFarm.OfficialPlugins.Monitoring # Apart from declaring them here, there is certain amount of hardcoding needed below for uploading
Expand Down
2 changes: 0 additions & 2 deletions ArchiSteamFarm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,6 @@ private static async Task<bool> InitGlobalDatabaseAndServices() {
}
}

WebBrowser.Init();

return true;
}

Expand Down
4 changes: 1 addition & 3 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3430,9 +3430,7 @@ private async void OnPersonaState(SteamFriends.PersonaStateCallback callback) {
string? avatarHash = null;

if ((callback.AvatarHash?.Length > 0) && callback.AvatarHash.Any(static singleByte => singleByte > 0)) {
#pragma warning disable CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
avatarHash = Convert.ToHexString(callback.AvatarHash).ToLowerInvariant();
#pragma warning restore CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
avatarHash = Convert.ToHexStringLower(callback.AvatarHash);

if (string.IsNullOrEmpty(avatarHash) || avatarHash.All(static singleChar => singleChar == '0')) {
avatarHash = null;
Expand Down
4 changes: 1 addition & 3 deletions ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1995,9 +1995,7 @@ internal async Task<bool> Init(ulong steamID, EUniverse universe, string accessT

Initialized = false;

#pragma warning disable CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
string sessionID = Convert.ToHexString(RandomNumberGenerator.GetBytes(SessionIDLength / 2)).ToLowerInvariant();
#pragma warning restore CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
string sessionID = Convert.ToHexStringLower(RandomNumberGenerator.GetBytes(SessionIDLength / 2));

WebBrowser.CookieContainer.Add(new Cookie("sessionid", sessionID, "/", $".{SteamCheckoutURL.Host}"));
WebBrowser.CookieContainer.Add(new Cookie("sessionid", sessionID, "/", $".{SteamCommunityURL.Host}"));
Expand Down
14 changes: 0 additions & 14 deletions ArchiSteamFarm/Web/WebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -682,20 +682,6 @@ public HttpClient GenerateDisposableHttpClient(bool extendedTimeout = false) {
return null;
}

internal static void Init() {
// Set max connection limit from default of 2 to desired value
ServicePointManager.DefaultConnectionLimit = MaxConnections;

// Set max idle time from default of 100 seconds (100 * 1000) to desired value
ServicePointManager.MaxServicePointIdleTime = MaxIdleTime * 1000;

// Don't use Expect100Continue, we're sure about our POSTs, save some TCP packets
ServicePointManager.Expect100Continue = false;

// Reuse ports if possible
ServicePointManager.ReusePort = true;
JustArchi marked this conversation as resolved.
Show resolved Hide resolved
}

private async Task<HttpResponseMessage?> InternalGet(Uri request, IReadOnlyCollection<KeyValuePair<string, string>>? headers = null, Uri? referer = null, ERequestOptions requestOptions = ERequestOptions.None, HttpCompletionOption httpCompletionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default) {
ArgumentNullException.ThrowIfNull(request);

Expand Down
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<RepositoryUrl>$(PackageProjectUrl).git</RepositoryUrl>
<RollForward>LatestMajor</RollForward>
<RuntimeIdentifiers>linux-arm;linux-arm64;linux-x64;osx-arm64;osx-x64;win-arm64;win-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>

Expand Down Expand Up @@ -84,5 +84,8 @@
<StackTraceSupport>false</StackTraceSupport>
<UseNativeHttpHandler>true</UseNativeHttpHandler>
<TrimMode>partial</TrimMode>

<!-- TODO: Perhaps can be removed with stable release of .NET 9 -->
<_DefaultValueAttributeSupport>true</_DefaultValueAttributeSupport>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN <<EOF
npm run deploy --no-progress
EOF

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0${IMAGESUFFIX} AS build-dotnet
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0${IMAGESUFFIX} AS build-dotnet
ARG CONFIGURATION=Release
ARG TARGETARCH
ARG TARGETOS
Expand Down Expand Up @@ -76,7 +76,7 @@ RUN --mount=type=secret,id=ASF_PRIVATE_SNK --mount=type=secret,id=STEAM_TOKEN_DU
done
EOF

FROM mcr.microsoft.com/dotnet/aspnet:8.0${IMAGESUFFIX} AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0${IMAGESUFFIX} AS runtime
ENV ASF_PATH=/app
ENV ASF_USER=asf
ENV ASPNETCORE_URLS=
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.Service
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN <<EOF
npm run deploy --no-progress
EOF

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0${IMAGESUFFIX} AS build-dotnet
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0${IMAGESUFFIX} AS build-dotnet
ARG CONFIGURATION=Release
ARG TARGETARCH
ARG TARGETOS
Expand Down Expand Up @@ -76,7 +76,7 @@ RUN --mount=type=secret,id=ASF_PRIVATE_SNK --mount=type=secret,id=STEAM_TOKEN_DU
done
EOF

FROM mcr.microsoft.com/dotnet/runtime-deps:8.0${IMAGESUFFIX} AS runtime
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0${IMAGESUFFIX} AS runtime
ENV ASF_PATH=/app
ENV ASF_USER=asf
ENV ASPNETCORE_URLS=
Expand Down
Loading