Include music db files, update link for event files, fix .evt and .cmp static file extension unknown
This commit is contained in:
parent
6eb71437cf
commit
aefc9ca326
@ -4,7 +4,7 @@ using MediatR;
|
||||
|
||||
namespace Application.Game.Server;
|
||||
|
||||
public record GetDataQuery(string Host) : IRequest<string>;
|
||||
public record GetDataQuery(string Host, string Scheme) : IRequest<string>;
|
||||
|
||||
public class GetDataQueryHandler : IRequestHandler<GetDataQuery, string>
|
||||
{
|
||||
@ -23,9 +23,8 @@ public class GetDataQueryHandler : IRequestHandler<GetDataQuery, string>
|
||||
{
|
||||
return Task.FromResult(response);
|
||||
}
|
||||
|
||||
var host = request.Host;
|
||||
var urlBase = $"http://{host}/events/";
|
||||
|
||||
var urlBase = $"{request.Scheme}://{request.Host}/events/";
|
||||
var dataString = new StringBuilder();
|
||||
var events = eventManagerService.GetEvents();
|
||||
var count = 0;
|
||||
|
@ -289,7 +289,14 @@ public class CertificateService
|
||||
{
|
||||
logger.LogInformation("Certificate CN={CommonName} found!", commonName);
|
||||
|
||||
return result.First();
|
||||
var cert = result.First();
|
||||
var extensions = cert.Extensions;
|
||||
if (extensions.Select(extension => extension.Oid).Any(oid => oid?.Value == OidLookup.ServerAuthentication.Value))
|
||||
{
|
||||
return cert;
|
||||
}
|
||||
logger.LogInformation("Certificate CN={CommonName} does not include server authentication!", commonName);
|
||||
return null;
|
||||
}
|
||||
|
||||
store.Close();
|
||||
|
2
MainServer/.gitignore
vendored
2
MainServer/.gitignore
vendored
@ -439,4 +439,4 @@ FodyWeavers.xsd
|
||||
/db/card.db3
|
||||
Certificates
|
||||
wwwroot/events/
|
||||
Database/*
|
||||
Database/card*.db3
|
||||
|
@ -35,7 +35,7 @@ public class ServerController : BaseController<ServerController>
|
||||
[HttpGet("data.php")]
|
||||
public async Task<ActionResult<string>> GetData()
|
||||
{
|
||||
var query = new GetDataQuery(Request.Host.Value);
|
||||
var query = new GetDataQuery(Request.Host.Value, Request.Scheme);
|
||||
return Ok(await Mediator.Send(query));
|
||||
}
|
||||
}
|
BIN
MainServer/Database/music.db3
Normal file
BIN
MainServer/Database/music.db3
Normal file
Binary file not shown.
BIN
MainServer/Database/music471.db3
Normal file
BIN
MainServer/Database/music471.db3
Normal file
Binary file not shown.
BIN
MainServer/Database/music471omni.db3
Normal file
BIN
MainServer/Database/music471omni.db3
Normal file
Binary file not shown.
BIN
MainServer/Database/music4MAX.db3
Normal file
BIN
MainServer/Database/music4MAX.db3
Normal file
Binary file not shown.
BIN
MainServer/Database/music4MAX465.db3
Normal file
BIN
MainServer/Database/music4MAX465.db3
Normal file
Binary file not shown.
@ -10,40 +10,71 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CertificateManager" Version="1.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.2" />
|
||||
<PackageReference Include="CertificateManager" Version="1.0.8"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.2"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.3" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="6.1.1-dev-00293" />
|
||||
<PackageReference Include="Serilog.Expressions" Version="3.4.2-dev-00119" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
|
||||
<PackageReference Include="Throw" Version="1.3.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.3"/>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="6.1.1-dev-00293"/>
|
||||
<PackageReference Include="Serilog.Expressions" Version="3.4.2-dev-00119"/>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
|
||||
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2"/>
|
||||
<PackageReference Include="Throw" Version="1.3.1"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="Configurations\database.json" />
|
||||
<None Include="Configurations\database.json" />
|
||||
<Content Remove="Configurations\events.json" />
|
||||
<None Include="Configurations\events.json" />
|
||||
<Content Remove="Configurations\game.json" />
|
||||
<None Include="Configurations\game.json" />
|
||||
<Content Remove="Configurations\logging.json" />
|
||||
<None Include="Configurations\logging.json" />
|
||||
<Content Remove="Configurations\matching.json" />
|
||||
<None Include="Configurations\matching.json" />
|
||||
<Content Update="Configurations\database.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Configurations\events.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Configurations\game.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Configurations\logging.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Configurations\matching.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Include="Database\music.db3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Include="Database\music4MAX.db3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Include="Database\music4MAX465.db3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Include="Database\music471.db3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Include="Database\music471omni.db3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\API" />
|
||||
<Folder Include="Logs" />
|
||||
<Folder Include="Controllers\API"/>
|
||||
<Folder Include="Logs"/>
|
||||
<Folder Include="wwwroot"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -6,6 +6,7 @@ using Infrastructure;
|
||||
using Infrastructure.Common;
|
||||
using Infrastructure.Persistence;
|
||||
using MainServer.Filters;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serilog;
|
||||
using Serilog.Extensions.Logging;
|
||||
@ -92,8 +93,16 @@ try
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
// app.UseExceptionHandler();
|
||||
app.UseStaticFiles();
|
||||
// Add content type for .cmp and .evt files as static files with unknown file extensions return 404 by default
|
||||
// See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-7.0#fileextensioncontenttypeprovider
|
||||
// ReSharper disable once UseObjectOrCollectionInitializer
|
||||
var provider = new FileExtensionContentTypeProvider();
|
||||
provider.Mappings[".cmp"] = "text/plain";
|
||||
provider.Mappings[".evt"] = "text/plain";
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user