Skip to content
Open
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
2 changes: 1 addition & 1 deletion .Tests/XUnit.Tests/EloTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static void TestTeamEloBalancing(int gamesPerIteration, int playersPerTea
}
}

private static readonly Random r = new Random();
private static readonly Random r = new();

private static int[] GetShuffledIndices(int count)
{
Expand Down
10 changes: 5 additions & 5 deletions .Tests/XUnit.Tests/XUnit.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
### From: https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
### Last sync: 120b944
### Last sync: bf1f642
### Disabled: IDE0073
; EditorConfig to support per-solution formatting.
; Use the EditorConfig VS add-in to make this work.
; http://editorconfig.org/
;
; Here are some resources for what's supported for .NET/C#
; https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
; https://learn.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
; https://learn.microsoft.com/visualstudio/ide/editorconfig-code-style-settings-reference
;
; Be **careful** editing this because some of the rules don't support adding a severity level
; For instance if you change to `dotnet_sort_system_directives_first = true:warning` (adding `:warning`)
Expand Down Expand Up @@ -131,7 +131,7 @@ dotnet_diagnostic.CA1725.severity = suggestion
dotnet_diagnostic.CA1802.severity = warning

# CA1805: Do not initialize unnecessarily
dotnet_diagnostic.CA1805.severity = suggestion # PR#233: Changed to suggestion
dotnet_diagnostic.CA1805.severity = warning

# CA1810: Do not initialize unnecessarily
dotnet_diagnostic.CA1810.severity = warning
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
build-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build Docker Image
run: docker build --pull -t ${{ env.IMAGE_NAME }} -f ./UT4MasterServer/Dockerfile .
- name: Clean Up
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker_build_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build Frontend Docker Image
run: docker build --pull -t ${{ env.IMAGE_NAME }} -f ./UT4MasterServer.Web/.docker/Development.Dockerfile ./UT4MasterServer.Web/
- name: Clean Up
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: lts/*
- run: npm install --ignore-scripts
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ If you want to play, go to https://ut4.timiimit.com/

There is not much documentation on how to get started. I will create issues that need resolving as time goes on, but there are also a bunch of `// TODO` comments which tell what is still missing.

### Required packages for running with Visual Studio 2022
### Required packages for running with Visual Studio

- .NET desktop development
- Container development tools

### Running & debugging with Visual Studio 2022
### Running & debugging with Visual Studio

1. Install Docker
2. Install Visual Studio 2022
3. Open `UT4MasterServer.sln` with Visual Studio 2022
2. Install Visual Studio
3. Open `UT4MasterServer.sln` with Visual Studio
4. Set `docker-compose` as the Startup Project
5. Start Debugging

### Running without Visual Studio 2022
### Running without Visual Studio

To run in development mode use `docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d` inside repository's root.

Expand Down
4 changes: 2 additions & 2 deletions UT4MasterServer.Authentication/BasicAuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class BasicAuthenticationHandler : AuthenticationHandler<AuthenticationSc
private readonly ClientService clientService;

public BasicAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger,
UrlEncoder encoder, ISystemClock clock,
ClientService clientService) : base(options, logger, encoder, clock)
UrlEncoder encoder,
ClientService clientService) : base(options, logger, encoder)
{
this.clientService = clientService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class BearerAuthenticationHandler : AuthenticationHandler<AuthenticationS
private readonly SessionService sessionService;

public BearerAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger,
UrlEncoder encoder, ISystemClock clock, SessionService sessionService) : base(options, logger, encoder, clock)
UrlEncoder encoder, SessionService sessionService) : base(options, logger, encoder)
{
this.sessionService = sessionService;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.29" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.29" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions UT4MasterServer.Common/Helpers/ValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ static ValidationHelper()
{
// regex from: https://www.emailregex.com/
regexEmail = new Regex(@"^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])");
disallowedUsernameWords = new List<string>
{
disallowedUsernameWords =
[
"cock", "dick", "penis", "vagina", "tits", "pussy", "boner",
"shit", "fuck", "bitch", "slut", "sex", "cum",
"nigger", "hitler", "nazi"
};
];
}

public static bool ValidateEmail(string email)
Expand Down
4 changes: 2 additions & 2 deletions UT4MasterServer.Common/UT4MasterServer.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.25.0" />
<PackageReference Include="MongoDB.Driver" Version="3.5.2" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions UT4MasterServer.Models/DTO/MMRBulk.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

namespace UT4MasterServer.Models.DTO;

public class MMRBulk
{
[JsonPropertyName("ratingTypes")]
public List<string> RatingTypes { get; set; } = new List<string>();
public List<string> RatingTypes { get; set; } = [];

[JsonPropertyName("ratings")]
public List<int> Ratings { get; set; } = new List<int>();
public List<int> Ratings { get; set; } = [];

[JsonPropertyName("numGamesPlayed")]
public List<int> NumGamesPlayed { get; set; } = new List<int>();
public List<int> NumGamesPlayed { get; set; } = [];
}
14 changes: 7 additions & 7 deletions UT4MasterServer.Models/DTO/Request/GameServerFilterRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public class GameServerAttributeCriteria
public string Type { get; set; } = string.Empty;
public string Key { get; set; } = string.Empty;

public JsonElement Value { get; set; } = default;
public JsonElement Value { get; set; }
}

public class GameServerFilterRequest
{
public List<GameServerAttributeCriteria> Criteria { get; set; } = new();
public string? BuildUniqueId { get; set; } = null;
public int? OpenPlayersRequired { get; set; } = null;
public int? MaxCurrentPlayers { get; set; } = null;
public bool? RequireDedicated { get; set; } = null;
public int? MaxResults { get; set; } = null;
public List<GameServerAttributeCriteria> Criteria { get; set; } = [];
public string? BuildUniqueId { get; set; }
public int? OpenPlayersRequired { get; set; }
public int? MaxCurrentPlayers { get; set; }
public bool? RequireDedicated { get; set; }
public int? MaxResults { get; set; }
}
2 changes: 1 addition & 1 deletion UT4MasterServer.Models/DTO/Response/ErrorResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ErrorResponse
public string? ErrorMessage { get; set; }

[JsonPropertyName("messageVars")]
public string[] MessageVars { get; set; } = Array.Empty<string>(); // any value inside errorMessage is listed in this array
public string[] MessageVars { get; set; } = []; // any value inside errorMessage is listed in this array

[JsonPropertyName("numericErrorCode")]
public int NumericErrorCode { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions UT4MasterServer.Models/DTO/Response/PagedResponse.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace UT4MasterServer.Models.DTO.Responses;
namespace UT4MasterServer.Models.DTO.Responses;

public sealed class PagedResponse<T>
{
public long Count { get; set; }
public List<T> Data { get; set; } = new();
public List<T> Data { get; set; } = [];
}
8 changes: 4 additions & 4 deletions UT4MasterServer.Models/DTO/Response/RatingTeamResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public sealed class RatingMatch
public string RatingType { get; set; } = string.Empty;

[JsonPropertyName("matchInfo")]
public RatingMatchInfo MatchInfo { get; set; } = new RatingMatchInfo();
public RatingMatchInfo MatchInfo { get; set; } = new();

[JsonPropertyName("redTeam")]
public RatingTeam RedTeam { get; set; } = new RatingTeam();
public RatingTeam RedTeam { get; set; } = new();

[JsonPropertyName("blueTeam")]
public RatingTeam BlueTeam { get; set; } = new RatingTeam();
public RatingTeam BlueTeam { get; set; } = new();
}

public sealed class RatingMatchInfo
Expand Down Expand Up @@ -45,7 +45,7 @@ public sealed class Member
}

[JsonPropertyName("members")]
public List<Member> Members { get; set; } = new List<Member>();
public List<Member> Members { get; set; } = [];

[JsonPropertyName("socialPartySize")]
public int SocialPartySize { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using UT4MasterServer.Models.Database;
using UT4MasterServer.Models.Database;

namespace UT4MasterServer.Models.Responses;

public sealed class TrustedGameServerResponse : TrustedGameServer
{
public Client? Client { get; set; } = null;
public Account? Owner { get; set; } = null;
public Client? Client { get; set; }
public Account? Owner { get; set; }
}
2 changes: 1 addition & 1 deletion UT4MasterServer.Models/Database/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Account
[BsonIgnoreIfDefault] // default value is set in Program.cs
[BsonElement("DeviceIDs")]
[JsonIgnore]
public string[] DeviceIDs { get; set; } = Array.Empty<string>();
public string[] DeviceIDs { get; set; } = [];

/************** Game Specific **************/

Expand Down
2 changes: 1 addition & 1 deletion UT4MasterServer.Models/Database/CloudFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class CloudFile

[BsonElement("RawContent")]
[BsonRepresentation(MongoDB.Bson.BsonType.Binary)]
public byte[] RawContent { get; set; } = Array.Empty<byte>();
public byte[] RawContent { get; set; } = [];

[BsonElement("Length")]
public int Length { get; set; } = 0;
Expand Down
6 changes: 3 additions & 3 deletions UT4MasterServer.Models/Database/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public class GameServer

[BsonElement("PublicPlayers")]
[JsonPropertyName("publicPlayers")]
public List<EpicID> PublicPlayers { get; set; } = new();
public List<EpicID> PublicPlayers { get; set; } = [];

[BsonElement("PrivatePlayers")]
[JsonPropertyName("privatePlayers")]
public List<EpicID> PrivatePlayers { get; set; } = new();
public List<EpicID> PrivatePlayers { get; set; } = [];

//[BsonElement("TotalPlayers")]
//[JsonPropertyName("totalPlayers")]
Expand Down Expand Up @@ -252,7 +252,7 @@ public JsonObject ToJson(bool isResponseToClient)
}

obj.Add(new("publicPlayers", arr));
arr = new JsonArray();
arr = [];
foreach (EpicID player in PrivatePlayers)
{
arr.Add(JsonValue.Create(player.ToString()));
Expand Down
14 changes: 7 additions & 7 deletions UT4MasterServer.Models/Database/Rating.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MongoDB.Bson;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using UT4MasterServer.Common;

Expand All @@ -9,13 +9,13 @@ public sealed class Rating
public const int DefaultRating = 1500;
public const int Precision = 1000;

public static readonly List<string> DmRatingTypes = new()
{
public static readonly List<string> DmRatingTypes =
[
"DMSkillRating",
};
];

public static readonly List<string> TeamRatingTypes = new()
{
public static readonly List<string> TeamRatingTypes =
[
"SkillRating",
"TDMSkillRating",
"CTFSkillRating",
Expand All @@ -25,7 +25,7 @@ public sealed class Rating
"RankedCTFSkillRating",
"RankedShowdownSkillRating",
"RankedFlagRunSkillRating",
};
];

public static readonly List<string> AllowedRatingTypes = DmRatingTypes.Union(TeamRatingTypes).ToList();

Expand Down
8 changes: 4 additions & 4 deletions UT4MasterServer.Models/Database/StatisticBase.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Attributes;

namespace UT4MasterServer.Models.Database;

public class StatisticBase
{
public readonly static List<string> StatisticProperties = new()
{
public readonly static List<string> StatisticProperties =
[
"matchesplayed",
"matchesquit",
"timeplayed",
Expand Down Expand Up @@ -147,7 +147,7 @@ public class StatisticBase
"defenderscore",
"supporterscore",
"teamkills"
};
];

public StatisticBase() { }

Expand Down
Loading