mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-04-19 19:14:51 +00:00
Update to .NET 8 and C# 12 (#952)
* Initial SDK and dependency bumps * Bump Pomelo.EntityFrameworkCore.MySql to 8.0.0-beta.2 Should fix the MissingMethodException error in unit tests * Update CI workflow to use .NET 8 * Apply suggested change from compile time warnings * Fix digest tests * Bump dependencies once more * Update xunit * Remove obsolete ISystemClock from TokenAuthHandler * Update dependencies * Add digest debug preprocessors back * Maybe don't break #966 * Bump EF Driver and update various NET7 references * Fix warnings in digest middleware tests --------- Co-authored-by: Slendy <josh@slendy.pw>
This commit is contained in:
parent
a2eaedc85b
commit
01e6fa191a
20 changed files with 104 additions and 110 deletions
|
@ -1 +1,3 @@
|
|||
**/data
|
||||
**/bin
|
||||
**/obj
|
||||
|
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -34,10 +34,10 @@ jobs:
|
|||
if: ${{ matrix.os.database }}
|
||||
run: mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -h 127.0.0.1 -e "CREATE DATABASE ${{ env.DB_DATABASE }};";
|
||||
|
||||
- name: Install .NET 7.0
|
||||
- name: Install .NET 8.0
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: "7.0.x"
|
||||
dotnet-version: "8.0.x"
|
||||
|
||||
- name: Compile
|
||||
run: |
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Development Databases" type="docker-deploy" factoryName="docker-compose.yml"
|
||||
server-name="Docker">
|
||||
<deployment type="docker-compose.yml">
|
||||
<settings>
|
||||
<option name="envFilePath" value=""/>
|
||||
<option name="sourceFilePath" value="docker-compose.yml"/>
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isPublishEnabled="true"/>
|
||||
<method v="2"/>
|
||||
</configuration>
|
||||
</component>
|
|
@ -1,6 +1,6 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Lighthouse API" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.API/bin/Debug/net7.0/LBPUnion.ProjectLighthouse.Servers.API" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.API/bin/Debug/net8.0/LBPUnion.ProjectLighthouse.Servers.API" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
|
@ -15,9 +15,8 @@
|
|||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value="net7.0" />
|
||||
<option name="PROJECT_TFM" value="net8.0" />
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Lighthouse Gameserver" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.GameServer/bin/Debug/net7.0/LBPUnion.ProjectLighthouse.Servers.GameServer" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.GameServer/bin/Debug/net8.0/LBPUnion.ProjectLighthouse.Servers.GameServer" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
|
@ -15,9 +15,8 @@
|
|||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value="net7.0" />
|
||||
<option name="PROJECT_TFM" value="net8.0" />
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
|
@ -1,6 +1,6 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Lighthouse Website" type="DotNetProject" factoryName=".NET Project">
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.Website/bin/Debug/net7.0/LBPUnion.ProjectLighthouse.Servers.Website" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.Website/bin/Debug/net8.0/LBPUnion.ProjectLighthouse.Servers.Website" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
|
@ -15,9 +15,8 @@
|
|||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
|
||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||
<option name="PROJECT_TFM" value="net7.0" />
|
||||
<option name="PROJECT_TFM" value="net8.0" />
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Build stage
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
||||
WORKDIR /ProjectLighthouse
|
||||
COPY *.sln ./
|
||||
COPY **/*.csproj ./
|
||||
|
@ -13,10 +13,10 @@ RUN dotnet sln list | grep ".csproj" \
|
|||
RUN dotnet restore
|
||||
|
||||
COPY . .
|
||||
RUN dotnet publish -c Release --property:OutputPath=/ProjectLighthouse/publish/ --no-restore
|
||||
RUN dotnet publish -c Release --property:OutputPath=/ProjectLighthouse/out/ --no-restore
|
||||
|
||||
# Final running container
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS final
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final
|
||||
|
||||
# Add non-root user
|
||||
RUN addgroup -S lighthouse --gid 1001 && \
|
||||
|
@ -29,7 +29,7 @@ apk add --no-cache icu-libs su-exec tzdata
|
|||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
||||
|
||||
# Copy build files
|
||||
COPY --from=build /ProjectLighthouse/publish /lighthouse/app
|
||||
COPY --from=build /ProjectLighthouse/out/publish /lighthouse/app
|
||||
COPY --from=build /ProjectLighthouse/ProjectLighthouse/StaticFiles /lighthouse/temp/StaticFiles
|
||||
COPY --from=build /ProjectLighthouse/scripts-and-tools/docker-entrypoint.sh /lighthouse
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>LBPUnion.ProjectLighthouse.Localization</RootNamespace>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.API</AssemblyName>
|
||||
|
|
|
@ -33,8 +33,7 @@ public class DigestMiddleware : Middleware
|
|||
public override async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
// Client digest check.
|
||||
if (!context.Request.Cookies.TryGetValue("MM_AUTH", out string? authCookie))
|
||||
authCookie = string.Empty;
|
||||
if (!context.Request.Cookies.TryGetValue("MM_AUTH", out string? authCookie)) authCookie = string.Empty;
|
||||
string digestPath = context.Request.Path;
|
||||
#if !DEBUG
|
||||
const string url = "/LITTLEBIGPLANETPS3_XML";
|
||||
|
@ -55,8 +54,11 @@ public class DigestMiddleware : Middleware
|
|||
excludeBodyFromDigest = true;
|
||||
}
|
||||
|
||||
string clientRequestDigest = CryptoHelper.ComputeDigest
|
||||
(digestPath, authCookie, bodyBytes, ServerConfiguration.Instance.DigestKey.PrimaryDigestKey, excludeBodyFromDigest);
|
||||
string clientRequestDigest = CryptoHelper.ComputeDigest(digestPath,
|
||||
authCookie,
|
||||
bodyBytes,
|
||||
ServerConfiguration.Instance.DigestKey.PrimaryDigestKey,
|
||||
excludeBodyFromDigest);
|
||||
|
||||
// Check the digest we've just calculated against the digest header if the game set the header. They should match.
|
||||
if (context.Request.Headers.TryGetValue(digestHeaderKey, out StringValues sentDigest))
|
||||
|
@ -66,8 +68,11 @@ public class DigestMiddleware : Middleware
|
|||
// If we got here, the normal ServerDigestKey failed to validate. Lets try again with the alternate digest key.
|
||||
usedAlternateDigestKey = true;
|
||||
|
||||
clientRequestDigest = CryptoHelper.ComputeDigest
|
||||
(digestPath, authCookie, bodyBytes, ServerConfiguration.Instance.DigestKey.AlternateDigestKey, excludeBodyFromDigest);
|
||||
clientRequestDigest = CryptoHelper.ComputeDigest(digestPath,
|
||||
authCookie,
|
||||
bodyBytes,
|
||||
ServerConfiguration.Instance.DigestKey.AlternateDigestKey,
|
||||
excludeBodyFromDigest);
|
||||
if (clientRequestDigest != sentDigest)
|
||||
{
|
||||
#if DEBUG
|
||||
|
@ -82,6 +87,7 @@ public class DigestMiddleware : Middleware
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
// The game doesn't start sending digests until after the announcement so if it's not one of those requests
|
||||
// and it doesn't include a digest we need to reject the request
|
||||
|
@ -92,7 +98,7 @@ public class DigestMiddleware : Middleware
|
|||
}
|
||||
#endif
|
||||
|
||||
context.Response.Headers.Add("X-Digest-B", clientRequestDigest);
|
||||
context.Response.Headers.Append("X-Digest-B", clientRequestDigest);
|
||||
context.Request.Body.Position = 0;
|
||||
}
|
||||
|
||||
|
@ -104,10 +110,12 @@ public class DigestMiddleware : Middleware
|
|||
await this.next(context); // Handle the request so we can get the server digest hash
|
||||
responseBuffer.Position = 0;
|
||||
|
||||
if (responseBuffer.Length > 1000 && context.Request.Headers.AcceptEncoding.Contains("deflate") && (context.Response.ContentType ?? string.Empty).Contains("text/xml"))
|
||||
if (responseBuffer.Length > 1000 &&
|
||||
context.Request.Headers.AcceptEncoding.Contains("deflate") &&
|
||||
(context.Response.ContentType ?? string.Empty).Contains("text/xml"))
|
||||
{
|
||||
context.Response.Headers.Add("X-Original-Content-Length", responseBuffer.Length.ToString());
|
||||
context.Response.Headers.Add("Vary", "Accept-Encoding");
|
||||
context.Response.Headers.Append("X-Original-Content-Length", responseBuffer.Length.ToString());
|
||||
context.Response.Headers.Append("Vary", "Accept-Encoding");
|
||||
MemoryStream resultStream = new();
|
||||
const int defaultCompressionLevel = 6;
|
||||
await using ZOutputStreamLeaveOpen stream = new(resultStream, defaultCompressionLevel);
|
||||
|
@ -115,8 +123,8 @@ public class DigestMiddleware : Middleware
|
|||
stream.Finish();
|
||||
|
||||
resultStream.Position = 0;
|
||||
context.Response.Headers.Add("Content-Length", resultStream.Length.ToString());
|
||||
context.Response.Headers.Add("Content-Encoding", "deflate");
|
||||
context.Response.Headers.Append("Content-Length", resultStream.Length.ToString());
|
||||
context.Response.Headers.Append("Content-Encoding", "deflate");
|
||||
responseBuffer.SetLength(0);
|
||||
await resultStream.CopyToAsync(responseBuffer);
|
||||
}
|
||||
|
@ -125,7 +133,7 @@ public class DigestMiddleware : Middleware
|
|||
string headerName = !context.Response.Headers.ContentLength.HasValue
|
||||
? "Content-Length"
|
||||
: "X-Original-Content-Length";
|
||||
context.Response.Headers.Add(headerName, responseBuffer.Length.ToString());
|
||||
context.Response.Headers.Append(headerName, responseBuffer.Length.ToString());
|
||||
}
|
||||
|
||||
// Compute the server digest hash.
|
||||
|
@ -138,8 +146,9 @@ public class DigestMiddleware : Middleware
|
|||
: ServerConfiguration.Instance.DigestKey.PrimaryDigestKey;
|
||||
|
||||
// Compute the digest for the response.
|
||||
string serverDigest = CryptoHelper.ComputeDigest(context.Request.Path, authCookie, responseBuffer.ToArray(), digestKey);
|
||||
context.Response.Headers.Add("X-Digest-A", serverDigest);
|
||||
string serverDigest =
|
||||
CryptoHelper.ComputeDigest(context.Request.Path, authCookie, responseBuffer.ToArray(), digestKey);
|
||||
context.Response.Headers.Append("X-Digest-A", serverDigest);
|
||||
}
|
||||
|
||||
// Copy the buffered response to the actual response stream.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.GameServer</AssemblyName>
|
||||
|
|
|
@ -17,10 +17,8 @@ public class TokenAuthHandler : AuthenticationHandler<AuthenticationSchemeOption
|
|||
(
|
||||
IOptionsMonitor<AuthenticationSchemeOptions> options,
|
||||
UrlEncoder encoder,
|
||||
ISystemClock clock,
|
||||
DatabaseContext database
|
||||
// I said I don't want any damn vegetables (logs)
|
||||
) : base(options, new NullLoggerFactory(), encoder, clock)
|
||||
) : base(options, new NullLoggerFactory(), encoder)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.Website</AssemblyName>
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.6.6" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -145,8 +145,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "df619790a2579a077eae4a6b6864966ff4768723";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
}
|
||||
|
@ -182,8 +182,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "9243acecfa83ac25bdfefe97f5681b439c003f1e";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"]);
|
||||
}
|
||||
|
@ -219,8 +219,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "0a06d25662c2d3bab2a767c0c504898df2385e62";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
}
|
||||
|
@ -257,8 +257,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "df619790a2579a077eae4a6b6864966ff4768723";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
}
|
||||
|
@ -295,8 +295,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "3105059f9283773f7982a4d79455bcc97c330f10";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
}
|
||||
|
@ -333,8 +333,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "3105059f9283773f7982a4d79455bcc97c330f10";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
}
|
||||
|
@ -371,8 +371,8 @@ public class DigestMiddlewareTests
|
|||
const string expectedClientDigest = "2e54cd2bc69ff8c1ff85dd3b4f62e0a0e27d9e23";
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
}
|
||||
|
@ -414,18 +414,19 @@ public class DigestMiddlewareTests
|
|||
const string expectedServerDigest = "404e589cafbff7886fe9fc5ee8a5454b57d9cb50";
|
||||
const string expectedClientDigest = "80714c0936408855d86d47a650320f91895812d0";
|
||||
const string expectedContentLen = "2000";
|
||||
const string expectedContentEncoding = "deflate";
|
||||
const string expectedCompressedContentLen = "23";
|
||||
const string expectedData = "783F4B4C1C053F60143F3F51300A463F500700643F3F";
|
||||
const string expectedData = "783F4B4C1C053F60143F3F51300A463F500700643F3F3F";
|
||||
|
||||
context.Response.Body.Position = 0;
|
||||
string output = await new StreamReader(context.Response.Body).ReadToEndAsync();
|
||||
string outputBytes = Convert.ToHexString(Encoding.ASCII.GetBytes(output));
|
||||
|
||||
Assert.Equal(expectedCode, context.Response.StatusCode);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-A"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Digest-B"]);
|
||||
Assert.NotEmpty(context.Response.Headers["Content-Encoding"]);
|
||||
Assert.NotEmpty(context.Response.Headers["X-Original-Content-Length"]);
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-A", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Digest-B", out _));
|
||||
Assert.True(context.Response.Headers.TryGetValue("X-Original-Content-Length", out _));
|
||||
Assert.Equal(expectedContentEncoding, context.Response.Headers.ContentEncoding);
|
||||
Assert.Equal(expectedServerDigest, context.Response.Headers["X-Digest-A"][0]);
|
||||
Assert.Equal(expectedClientDigest, context.Response.Headers["X-Digest-B"][0]);
|
||||
Assert.Equal(expectedContentLen, context.Response.Headers["X-Original-Content-Length"][0]);
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.14.1" />
|
||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="118.0.5993.7000" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.17.0" />
|
||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="121.0.6167.8500" />
|
||||
<PackageReference Include="xunit" Version="2.6.6" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Tests</AssemblyName>
|
||||
|
||||
|
@ -13,15 +13,15 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.6.6" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
@ -29,8 +29,8 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Moq" Version="4.20.69" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.13" />
|
||||
<PackageReference Include="Moq" Version="4.20.70" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse</AssemblyName>
|
||||
<RootNamespace>LBPUnion.ProjectLighthouse</RootNamespace>
|
||||
<OutputType>Library</OutputType>
|
||||
|
@ -15,20 +15,20 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pfim" Version="0.11.2" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" />
|
||||
<PackageReference Include="Discord.Net.Webhook" Version="3.12.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.13">
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.2" />
|
||||
<PackageReference Include="Discord.Net.Webhook" Version="3.13.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
|
||||
<PackageReference Include="Redis.OM" Version="0.5.4" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0" />
|
||||
<PackageReference Include="Redis.OM" Version="0.6.1" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="13.7.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="15.1.0" />
|
||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.2.1" />
|
||||
<PackageReference Include="DistributedLock.MySql" Version="1.0.1" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "7.0.0",
|
||||
"version": "8.0.0",
|
||||
"rollForward": "latestMajor",
|
||||
"allowPrerelease": true
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ cd "$HOME"/data || (echo "Data directory not found, pls create one~" && exit 1)
|
|||
echo "Running..."
|
||||
|
||||
# Normally this requires ASPNETCORE_URLS but we override that in the configuration
|
||||
dotnet ../project-lighthouse/ProjectLighthouse.Servers."$1"/bin/Release/net7.0/LBPUnion.ProjectLighthouse.Servers."$1".dll
|
||||
dotnet ../project-lighthouse/ProjectLighthouse.Servers."$1"/bin/Release/net8.0/LBPUnion.ProjectLighthouse.Servers."$1".dll
|
||||
|
||||
exit $? # Expose error code from dotnet command
|
Loading…
Add table
Reference in a new issue