1
0
mirror of synced 2024-09-24 02:58:24 +02:00

Update wwwroot content

Use OnMappingFailed to deal with client routing
Disable content caching for update
This commit is contained in:
asesidaa 2022-07-08 21:22:29 +08:00
parent 14261c8e29
commit 01710f1857
9 changed files with 11731 additions and 55110 deletions

View File

@ -4,7 +4,7 @@ namespace GCLocalServerRewrite.common;
public static class Configs
{
public const bool USE_FILE_CACHE = true;
public const bool USE_FILE_CACHE = false;
public const string ROOT_CA_CN = "Taito Arcade Machine CA";

View File

@ -44,10 +44,18 @@ public class Server
.WithWebApi(Configs.UPDATE_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
module => module.WithController<UpdateController>())
.WithStaticFolder(Configs.STATIC_BASE_ROUTE, PathHelper.HtmlRootPath, true, m => m
.WithContentCaching(Configs.USE_FILE_CACHE))
.WithContentCaching(Configs.USE_FILE_CACHE))
// Add static files after other modules to avoid conflicts
.WithStaticFolder("/", PathHelper.HtmlRootPath, true, m => m
.WithContentCaching(Configs.USE_FILE_CACHE))
.WithStaticFolder("/", PathHelper.HtmlRootPath, true, m =>
{
m.WithContentCaching(Configs.USE_FILE_CACHE);
m.OnMappingFailed = async (context, info) =>
{
var htmlContents = await File.ReadAllTextAsync(Path.Combine(PathHelper.HtmlRootPath, "index.html"));
context.Response.StatusCode = 200;
await context.SendStringAsync(htmlContents, "text/html", Encoding.UTF8);
};
})
.WithModule(new ActionModule("/", HttpVerbs.Any,
ctx => ctx.SendDataAsync(new { Message = "Error" })));
server.AddCustomMimeType(".dll", "application/octet-stream");

View File

@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<BlazorEnableCompression>false</BlazorEnableCompression>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -14,6 +15,11 @@
<RunAOTCompilation>False</RunAOTCompilation>
</PropertyGroup>
<PropertyGroup>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GenFu" Version="1.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.4" />
@ -31,14 +37,23 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="wwwroot\data\avatar.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\avatar.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="wwwroot\data\navigator.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\navigator.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="wwwroot\data\title.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\data\title.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
@ -53,5 +68,4 @@
<Folder Include="Utils" />
</ItemGroup>
</Project>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff