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

Fix/CVE 2024 12 #646

Merged
merged 2 commits into from
Dec 23, 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
2 changes: 2 additions & 0 deletions Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions BlazorServer/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<script src="_content/Frontend/script/d3.v7.min.js"></script>

<link rel="stylesheet" href="_content/Frontend/css/animate-v4.0.0.min.css" />
<link rel="stylesheet" href="BlazorServer.styles.css" asp-append-version="true" />

<script>const whTooltips = { colorLinks: true, iconizeLinks: true, renameLinks: true };</script>
<script src="_content/Frontend/script/power.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions BlazorServer/BlazorServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Net.Http.Json" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
Expand Down
27 changes: 27 additions & 0 deletions BlazorServer/Properties/PublishProfiles/FolderProfile_dot9.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net9.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<AssemblyName>firefox</AssemblyName>
<TargetName>firefox</TargetName>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net9.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<PublishReadyToRun>false</PublishReadyToRun>
<ProjectGuid>31da3032-f0d5-42e0-8f93-ae8622b42c53</ProjectGuid>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Drawing.Common" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions Core/Session/IGrindSessionDAO.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.Generic;
using System.Linq;

namespace Core.Session;

public interface IGrindSessionDAO
{
IEnumerable<GrindSession> Load();
IQueryable<GrindSession> Load();
void Save(GrindSession session);
}
}
11 changes: 5 additions & 6 deletions Core/Session/LocalGrindSessionDAO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ public LocalGrindSessionDAO(DataConfig dataConfig)
Directory.CreateDirectory(dataConfig.ExpHistory);
}

public IEnumerable<GrindSession> Load()
public IQueryable<GrindSession> Load()
{
List<GrindSession> sessions = Directory.EnumerateFiles(dataConfig.ExpHistory, "*.json")
var sessions = Directory.EnumerateFiles(dataConfig.ExpHistory, "*.json")
.Select(file => DeserializeObject<GrindSession>(File.ReadAllText(file))!)
.OrderByDescending(grindingSession => grindingSession.SessionStart)
.ToList();
.OrderByDescending(s => s.SessionStart);

if (sessions.Count != 0)
if (sessions.Any())
{
int[] expList = ExperienceProvider.Get(dataConfig);
foreach (GrindSession? s in sessions)
Expand All @@ -37,7 +36,7 @@ public IEnumerable<GrindSession> Load()
}
}

return sessions;
return sessions.AsQueryable();
}

public void Save(GrindSession session)
Expand Down
2 changes: 2 additions & 0 deletions CoreTests/CoreTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.Debug" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 9 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
<!-- Define package versions -->
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="MemoryPack" Version="1.21.3" />
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.QuickGrid" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageVersion Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageVersion Include="Serilog.Enrichers.Process" Version="3.0.0" />
<PackageVersion Include="Serilog.Expressions" Version="5.0.1-dev-00182" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10398" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.JsonPatch" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Net.Http.Json" Version="9.0.0" />
<PackageVersion Include="GameOverlay.Net" Version="4.3.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
Expand All @@ -28,6 +31,7 @@
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" />
<PackageVersion Include="GregsStack.InputSimulatorStandard" Version="1.3.5" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="TextCopy" Version="6.2.1" />
<PackageVersion Include="Vortice.Direct3D11" Version="3.6.2" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
Expand All @@ -39,12 +43,12 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="8.0.4" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="7.0.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="7.2.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.6" />
<PackageVersion Include="System.Management" Version="9.0.0" />
</ItemGroup>
</Project>
5 changes: 1 addition & 4 deletions Frontend/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BlazorTable;
using MatBlazor;
using MatBlazor;

using Microsoft.Extensions.DependencyInjection;

Expand All @@ -16,8 +15,6 @@ public static IServiceCollection AddFrontend(this IServiceCollection services)
services.AddRazorComponents()
.AddInteractiveServerComponents();

services.AddBlazorTable();

return services;
}
}
4 changes: 3 additions & 1 deletion Frontend/Frontend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BlazorTable" />
<PackageReference Include="MatBlazor" />
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
Expand Down
84 changes: 63 additions & 21 deletions Frontend/Pages/History.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,76 @@

@if (Sessions.Any())
{
<Table class="table table-dark table-striped table-hover" TableItem="GrindSession" Items="Sessions" PageSize="15" ColumnReorder="true" ShowSearchBar="true">
<Column TableItem="GrindSession" Title="Date" Field="@(x => x.SessionStart)" Sortable="true" Filterable="true" Width="10%" DefaultSortColumn="true" DefaultSortDescending="true"></Column>
<Column TableItem="GrindSession" Title="Path" Field="@(x => x.PathName)" Sortable="true" Filterable="true" Width="15%"></Column>
<Column TableItem="GrindSession" Title="Class" Field="@(x => x.PlayerClass)" Sortable="true" Filterable="true" Width="5%"></Column>
<Column TableItem="GrindSession" Title="Duration" Field="@(x => x.TotalTimeInMinutes)" Sortable="true" Filterable="true" Width="5%">
<Template>
@{
<span>@context.TotalTimeInMinutes minutes</span>
}
</Template>
</Column>
<Column TableItem="GrindSession" Title="Level" Field="@(x => x.LevelFrom)" Sortable="true" Filterable="true" Width="5%"></Column>
<Column TableItem="GrindSession" Title="Exp" Field="@(x => x.ExpGetInBotSession)" Sortable="true" Filterable="true" Width="5%"></Column>
<Column TableItem="GrindSession" Title="Exp/Hour" Field="@(x => x.ExperiencePerHour)" Sortable="true" Filterable="true" Width="5%"></Column>
<Column TableItem="GrindSession" Title="Mobs" Field="@(x => x.MobsKilled)" Sortable="true" Filterable="true" Width="5%"></Column>
<Column TableItem="GrindSession" Title="Mobs/Min" Field="@(x => x.MobsPerMinute)" Sortable="true" Filterable="true" Width="5%"></Column>
<Column TableItem="GrindSession" Title="Death" Field="@(x => x.Death)" Sortable="true" Filterable="true" Width="5%"></Column>
<Pager ShowPageNumber="true" ShowTotalCount="true" PageSizes="@pageSize" ShowPageSizes="true"></Pager>
</Table>
<p>
Show:
<label><input type="checkbox" @bind="showPath" /> path</label>
</p>

<QuickGrid class="table table-dark table-striped table-hover" Items="Filtered" Pagination="@pagination">
<PropertyColumn Title="Start Date" Property="@(x => x.SessionStart)" Sortable="true" IsDefaultSortColumn="true"></PropertyColumn>
@if (showPath)
{
<PropertyColumn Title="Path" Property="@(x => x.PathName)" Sortable="true">
<ColumnOptions>
<div class="search-box">
<input type="search" autofocus @bind="pathFilter" @bind:event="oninput" placeholder="Path name..." />
</div>
</ColumnOptions>
</PropertyColumn>
}
<PropertyColumn Title="Class" Property="@(x => x.PlayerClass)" Sortable="true">
<ColumnOptions>
<div class="search-box">
<input type="search" autofocus @bind="classFilter" @bind:event="oninput" placeholder="Class name..." />
</div>
</ColumnOptions>
</PropertyColumn>
<PropertyColumn Title="Duration(min)" Property="@(x => x.TotalTimeInMinutes)" Sortable="true" Align="Align.Right"></PropertyColumn>
<PropertyColumn Title="Level" Property="@(x => x.LevelFrom)" Sortable="true" Align="Align.Right"></PropertyColumn>
<PropertyColumn Title="Exp" Property="@(x => x.ExpGetInBotSession)" Sortable="true" Align="Align.Right"></PropertyColumn>
<PropertyColumn Title="Exp/Hour" Property="@(x => x.ExperiencePerHour)" Sortable="true" Align="Align.Right"></PropertyColumn>
<PropertyColumn Title="Mobs" Property="@(x => x.MobsKilled)" Sortable="true" Align="Align.Right"></PropertyColumn>
<PropertyColumn Title="Mobs/Min" Property="@(x => x.MobsPerMinute)" Sortable="true" Align="Align.Right"></PropertyColumn>
<PropertyColumn Title="Death" Property="@(x => x.Death)" Sortable="true" Align="Align.Right"></PropertyColumn>
</QuickGrid>

<Paginator State="@pagination" />
}
else
{
<div>No previous sessions!</div>
}

@code {
private readonly List<int> pageSize = new() { 15, 25, 50, 100 };
private IEnumerable<GrindSession> Sessions = null!;

PaginationState pagination = new PaginationState { ItemsPerPage = 15 };

private IQueryable<GrindSession> Sessions = null!;

private bool showPath = true;

private string pathFilter = string.Empty;
private string classFilter = string.Empty;

private IQueryable<GrindSession> Filtered
{
get
{
var result = Sessions;

if (!string.IsNullOrEmpty(pathFilter))
{
result = result.Where(c => c.PathName.Contains(pathFilter, StringComparison.CurrentCultureIgnoreCase));
}

if (!string.IsNullOrEmpty(classFilter))
{
result = result.Where(c => c.PlayerClass.ToStringF().Contains(classFilter, StringComparison.CurrentCultureIgnoreCase));
}

return result;
}
}

protected override void OnInitialized()
{
Expand Down
2 changes: 1 addition & 1 deletion Frontend/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
@using SharedLib
@using Core
@using Game
@using BlazorTable
@using Microsoft.AspNetCore.Components.QuickGrid
@using static Microsoft.AspNetCore.Components.Web.RenderMode
2 changes: 2 additions & 0 deletions HeadlessServer/HeadlessServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.Debug" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions PathingAPI/PathingAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

<ItemGroup>
<PackageReference Include="MatBlazor" />
<PackageReference Include="Microsoft.AspNetCore.Components" />
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Extensions.Logging" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Swashbuckle.AspNetCore" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
</ItemGroup>

<ItemGroup>
Expand Down