mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-28 19:52:27 +00:00
NET 7.0 support (#581)
* NET 7.0 support * Bump Pomelo MySql to support EF7 * Its net7.0 time * Trying to resolve dependencies by hand * Fix .NET 7 warnings * Bump InfluxDB version * Fix bad null handling
This commit is contained in:
parent
fe0b0726b5
commit
d16132f67f
22 changed files with 48 additions and 44 deletions
|
@ -3,13 +3,13 @@
|
|||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "6.0.10",
|
||||
"version": "7.0.0",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
},
|
||||
"dotnet-trace": {
|
||||
"version": "6.0.328102",
|
||||
"version": "6.0.351802",
|
||||
"commands": [
|
||||
"dotnet-trace"
|
||||
]
|
||||
|
|
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 6.0
|
||||
- name: Install .NET 7.0
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: "6.0.x"
|
||||
dotnet-version: "7.0.x"
|
||||
|
||||
- name: Compile
|
||||
run: dotnet build -c Debug
|
||||
|
|
|
@ -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/net6.0/LBPUnion.ProjectLighthouse.Servers.API" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.API/bin/Debug/net7.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,7 +15,7 @@
|
|||
<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="net6.0" />
|
||||
<option name="PROJECT_TFM" value="net7.0" />
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
||||
<option name="Build" />
|
||||
|
|
|
@ -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/net6.0/LBPUnion.ProjectLighthouse.Servers.GameServer" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.GameServer/bin/Debug/net7.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,7 +15,7 @@
|
|||
<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="net6.0" />
|
||||
<option name="PROJECT_TFM" value="net7.0" />
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
||||
<option name="Build" />
|
||||
|
|
|
@ -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/net6.0/LBPUnion.ProjectLighthouse.Servers.Website" />
|
||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse.Servers.Website/bin/Debug/net7.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" />
|
||||
|
@ -16,7 +16,7 @@
|
|||
<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="net6.0" />
|
||||
<option name="PROJECT_TFM" value="net7.0" />
|
||||
<method v="2">
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
||||
<option name="Build" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>LBPUnion.ProjectLighthouse.Localization</RootNamespace>
|
||||
|
|
|
@ -75,7 +75,7 @@ public class UserEndpoints : ApiEndpointController
|
|||
!Configuration.ServerConfiguration.Instance.Authentication.RegistrationEnabled)
|
||||
return this.NotFound();
|
||||
|
||||
string authHeader = this.Request.Headers["Authorization"];
|
||||
string? authHeader = this.Request.Headers["Authorization"];
|
||||
if (string.IsNullOrWhiteSpace(authHeader)) return this.NotFound();
|
||||
|
||||
string authToken = authHeader[(authHeader.IndexOf(' ') + 1)..];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.API</AssemblyName>
|
||||
|
|
|
@ -32,7 +32,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 == null)
|
||||
if (!context.Request.Cookies.TryGetValue("MM_AUTH", out string? authCookie))
|
||||
authCookie = string.Empty;
|
||||
string digestPath = context.Request.Path;
|
||||
#if !DEBUG
|
||||
|
@ -120,7 +120,7 @@ public class DigestMiddleware : Middleware
|
|||
context.Response.Headers.Add("X-Digest-A", serverDigest);
|
||||
}
|
||||
|
||||
if (responseBuffer.Length > 1000 && context.Request.Headers.AcceptEncoding.Contains("deflate") && context.Response.ContentType.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");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.GameServer</AssemblyName>
|
||||
|
|
|
@ -19,9 +19,9 @@ public class PasswordResetPage : BaseLayout
|
|||
public async Task<IActionResult> OnPost(string password, string confirmPassword)
|
||||
{
|
||||
User? user;
|
||||
if (Request.Query.ContainsKey("token"))
|
||||
if (this.Request.Query.ContainsKey("token"))
|
||||
{
|
||||
user = await this.Database.UserFromPasswordResetToken(Request.Query["token"][0]);
|
||||
user = await this.Database.UserFromPasswordResetToken(this.Request.Query["token"][0]);
|
||||
if (user == null)
|
||||
{
|
||||
this.Error = "This password reset link either is invalid or has expired. Please try again.";
|
||||
|
|
|
@ -29,7 +29,7 @@ public class RegisterForm : BaseLayout
|
|||
{
|
||||
if (this.Request.Query.ContainsKey("token"))
|
||||
{
|
||||
string token = this.Request.Query["token"];
|
||||
string? token = this.Request.Query["token"];
|
||||
if (!this.Database.IsRegistrationTokenValid(token))
|
||||
return this.StatusCode(403, this.Translate(ErrorStrings.TokenInvalid));
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class RegisterForm : BaseLayout
|
|||
{
|
||||
if (this.Request.Query.ContainsKey("token"))
|
||||
{
|
||||
string token = this.Request.Query["token"];
|
||||
string? token = this.Request.Query["token"];
|
||||
if (!this.Database.IsRegistrationTokenValid(token))
|
||||
return this.StatusCode(403, this.Translate(ErrorStrings.TokenInvalid));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.Website</AssemblyName>
|
||||
|
@ -34,7 +34,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
@ -9,8 +9,8 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
@ -9,8 +9,8 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse.Tests</AssemblyName>
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -452,8 +452,10 @@ public class Database : DbContext
|
|||
|
||||
}
|
||||
|
||||
public async Task<User?> UserFromPasswordResetToken(string resetToken)
|
||||
public async Task<User?> UserFromPasswordResetToken(string? resetToken)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(resetToken)) return null;
|
||||
|
||||
PasswordResetToken? token = await this.PasswordResetTokens.FirstOrDefaultAsync(token => token.ResetToken == resetToken);
|
||||
if (token == null) return null;
|
||||
|
||||
|
@ -466,8 +468,10 @@ public class Database : DbContext
|
|||
return null;
|
||||
}
|
||||
|
||||
public bool IsRegistrationTokenValid(string tokenString)
|
||||
public bool IsRegistrationTokenValid(string? tokenString)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tokenString)) return false;
|
||||
|
||||
RegistrationToken? token = this.RegistrationTokens.FirstOrDefault(t => t.Token == tokenString);
|
||||
if (token == null) return false;
|
||||
|
||||
|
@ -495,8 +499,10 @@ public class Database : DbContext
|
|||
await this.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task RemoveRegistrationToken(string tokenString)
|
||||
public async Task RemoveRegistrationToken(string? tokenString)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tokenString)) return;
|
||||
|
||||
RegistrationToken? token = await this.RegistrationTokens.FirstOrDefaultAsync(t => t.Token == tokenString);
|
||||
if (token == null) return;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public static class RequestExtensions
|
|||
bool gotCaptcha = request.Form.TryGetValue(keyName, out StringValues values);
|
||||
if (!gotCaptcha) return false;
|
||||
|
||||
if (!await verifyCaptcha(values[0])) return false;
|
||||
if (!await verifyCaptcha(values[0] ?? string.Empty)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<AssemblyName>LBPUnion.ProjectLighthouse</AssemblyName>
|
||||
<RootNamespace>LBPUnion.ProjectLighthouse</RootNamespace>
|
||||
<OutputType>Library</OutputType>
|
||||
|
@ -15,13 +15,13 @@
|
|||
<PackageReference Include="Discord.Net.Webhook" Version="3.8.1" />
|
||||
<PackageReference Include="InfluxDB.Client" Version="4.9.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0-alpha.1" />
|
||||
<PackageReference Include="Redis.OM" Version="0.4.0" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
|
|
|
@ -10,9 +10,7 @@ using LBPUnion.ProjectLighthouse.Files;
|
|||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Logging.Loggers;
|
||||
using LBPUnion.ProjectLighthouse.Match.Rooms;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
||||
using LBPUnion.ProjectLighthouse.Startup;
|
||||
using LBPUnion.ProjectLighthouse.StorableLists;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "6.0",
|
||||
"version": "7.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/net6.0/LBPUnion.ProjectLighthouse.Servers."$1".dll
|
||||
dotnet ../project-lighthouse/ProjectLighthouse.Servers."$1"/bin/Release/net7.0/LBPUnion.ProjectLighthouse.Servers."$1".dll
|
||||
|
||||
exit $? # Expose error code from dotnet command
|
Loading…
Add table
Add a link
Reference in a new issue