Use locally compiled new version of EmbedIO
Remove backports Skip trimming of FilterOperator and FilterDefinition
This commit is contained in:
parent
01710f1857
commit
e5a22ece90
@ -14,8 +14,8 @@
|
||||
<PackageReference Include="ChoETL" Version="1.2.1.47" />
|
||||
<PackageReference Include="Config.Net" Version="4.19.0" />
|
||||
<PackageReference Include="Config.Net.Json" Version="4.19.0" />
|
||||
<PackageReference Include="EmbedIO" Version="3.4.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="EmbedIO" Version="3.5.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0-preview.5.22301.12" />
|
||||
<PackageReference Include="sqlite-net2" Version="2.1.0-preB" />
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
|
||||
|
@ -1,74 +0,0 @@
|
||||
using EmbedIO;
|
||||
|
||||
namespace GCLocalServerRewrite.backports;
|
||||
|
||||
/// <summary>
|
||||
/// Provides custom response serializer callbacks.
|
||||
/// </summary>
|
||||
public static class CustomResponseSerializer
|
||||
{
|
||||
private static readonly ResponseSerializerCallback CHUNKED_ENCODING_BASE_SERIALIZER = GetBaseSerializer(false);
|
||||
private static readonly ResponseSerializerCallback BUFFERING_BASE_SERIALIZER = GetBaseSerializer(true);
|
||||
|
||||
/// <summary>
|
||||
/// Sends data in a HTTP response without serialization.
|
||||
/// </summary>
|
||||
/// <param name="bufferResponse">
|
||||
/// <see langword="true" /> to write the response body to a memory buffer first,
|
||||
/// then send it all together with a <c>Content-Length</c> header; <see langword="false" /> to use chunked
|
||||
/// transfer encoding.
|
||||
/// </param>
|
||||
/// <returns>A <see cref="ResponseSerializerCallback" /> that can be used to serialize data to a HTTP response.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <see cref="string" />s and one-dimensional arrays of <see cref="byte" />s
|
||||
/// are sent to the client unchanged; every other type is converted to a string.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The <see cref="IHttpResponse.ContentType">ContentType</see> set on the response is used to negotiate
|
||||
/// a compression method, according to request headers.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Strings (and other types converted to strings) are sent with the encoding specified by
|
||||
/// <see cref="IHttpResponse.ContentEncoding" />.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static ResponseSerializerCallback None(bool bufferResponse)
|
||||
{
|
||||
return bufferResponse ? BUFFERING_BASE_SERIALIZER : CHUNKED_ENCODING_BASE_SERIALIZER;
|
||||
}
|
||||
|
||||
private static ResponseSerializerCallback GetBaseSerializer(bool bufferResponse)
|
||||
{
|
||||
return async (context, data) =>
|
||||
{
|
||||
if (data is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var isBinaryResponse = data is byte[];
|
||||
|
||||
if (!context.TryDetermineCompression(context.Response.ContentType, out var preferCompression))
|
||||
{
|
||||
preferCompression = true;
|
||||
}
|
||||
|
||||
preferCompression = false;
|
||||
|
||||
if (isBinaryResponse)
|
||||
{
|
||||
var responseBytes = (byte[])data;
|
||||
using var stream = context.OpenResponseStream(bufferResponse, preferCompression);
|
||||
await stream.WriteAsync(responseBytes).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var responseString = data is string stringData ? stringData : data.ToString() ?? string.Empty;
|
||||
await using var text = context.OpenResponseText(context.Response.ContentEncoding, bufferResponse,
|
||||
preferCompression);
|
||||
await text.WriteAsync(responseString).ConfigureAwait(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EmbedIO.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Specifies that a parameter of a controller method will receive
|
||||
/// an object obtained by deserializing the request body as JSON.</para>
|
||||
/// <para>The received object will be <see langword="null"/>
|
||||
/// only if the deserialized object is <c>null</c>.</para>
|
||||
/// <para>If the request body is not valid JSON,
|
||||
/// or if it cannot be deserialized to the type of the parameter,
|
||||
/// a <c>400 Bad Request</c> response will be sent to the client.</para>
|
||||
/// <para>This class cannot be inherited.</para>
|
||||
/// </summary>
|
||||
/// <seealso cref="Attribute" />
|
||||
/// <seealso cref="IRequestDataAttribute{TController}" />
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public class JsonDataAttribute : Attribute, IRequestDataAttribute<WebApiController>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<object?> GetRequestDataAsync(WebApiController controller, Type type, string parameterName)
|
||||
{
|
||||
string body;
|
||||
|
||||
using (var reader = controller.HttpContext.OpenRequestText())
|
||||
{
|
||||
body = await reader.ReadToEndAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return Swan.Formatters.Json.Deserialize(body, type);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
throw HttpException.BadRequest($"Expected request body to be deserializable to {type.FullName}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using EmbedIO.Actions;
|
||||
using EmbedIO.Files;
|
||||
using EmbedIO.WebApi;
|
||||
using GCLocalServerRewrite.backports;
|
||||
using GCLocalServerRewrite.common;
|
||||
using GCLocalServerRewrite.controllers;
|
||||
using GCLocalServerRewrite.models;
|
||||
@ -25,23 +24,23 @@ public class Server
|
||||
.WithLocalSessionManager()
|
||||
.WithCors()
|
||||
.WithWebApi(Configs.API_BASE_ROUTE, module => module.WithController<ApiController>())
|
||||
.WithWebApi(Configs.CARD_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.CARD_SERVICE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<CardServiceController>())
|
||||
.WithWebApi(Configs.OPTION_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.OPTION_SERVICE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<OptionServiceController>())
|
||||
.WithWebApi(Configs.UPLOAD_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.UPLOAD_SERVICE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<UploadServiceController>())
|
||||
.WithWebApi(Configs.RESPONE_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.RESPONE_SERVICE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<ResponeServiceController>())
|
||||
.WithWebApi(Configs.INCOM_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.INCOM_SERVICE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<IncomServiceController>())
|
||||
.WithWebApi(Configs.ALIVE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.ALIVE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<AliveController>())
|
||||
.WithWebApi(Configs.SERVER_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.SERVER_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<ServerController>())
|
||||
.WithWebApi(Configs.RANK_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.RANK_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<RankController>())
|
||||
.WithWebApi(Configs.UPDATE_SERVICE_BASE_ROUTE, CustomResponseSerializer.None(true),
|
||||
.WithWebApi(Configs.UPDATE_SERVICE_BASE_ROUTE, ResponseSerializer.None(true),
|
||||
module => module.WithController<UpdateController>())
|
||||
.WithStaticFolder(Configs.STATIC_BASE_ROUTE, PathHelper.HtmlRootPath, true, m => m
|
||||
.WithContentCaching(Configs.USE_FILE_CACHE))
|
||||
@ -65,23 +64,6 @@ public class Server
|
||||
server.AddCustomMimeType(".wasm", "application/wasm");
|
||||
server.AddCustomMimeType(".woff", "application/font-woff");
|
||||
server.AddCustomMimeType(".woff2", "application/font-woff2");
|
||||
server.HandleHttpException(async (context, exception) =>
|
||||
{
|
||||
context.Response.StatusCode = exception.StatusCode;
|
||||
|
||||
switch (exception.StatusCode)
|
||||
{
|
||||
case 404:
|
||||
var htmlContents = await File.ReadAllTextAsync(Path.Combine(PathHelper.HtmlRootPath, "index.html"));
|
||||
await context.SendStringAsync(htmlContents, "text/html", Encoding.UTF8);
|
||||
|
||||
break;
|
||||
default:
|
||||
await HttpExceptionHandler.Default(context, exception);
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for state changes.
|
||||
server.StateChanged += (_, e) => $"WebServer New State - {e.NewState}".Info();
|
||||
|
12
MudAdmin/ILLink.Descriptors.xml
Normal file
12
MudAdmin/ILLink.Descriptors.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<linker>
|
||||
<assembly fullname="MudBlazor" preserve="all">
|
||||
<type fullname="MudBlazor.FilterOperator" preserve="all" />
|
||||
<type fullname="MudBlazor.FilterOperator/String" preserve="all" />
|
||||
<type fullname="MudBlazor.FilterOperator/Number" preserve="all" />
|
||||
<type fullname="MudBlazor.FilterOperator/Enum" preserve="all" />
|
||||
<type fullname="MudBlazor.FilterOperator/Boolean" preserve="all" />
|
||||
<type fullname="MudBlazor.FilterOperator/DateTime" preserve="all" />
|
||||
<type fullname="MudBlazor.FilterDefinition`1" preserve="all" />
|
||||
<type fullname="MudBlazor.Filter" preserve="all" />
|
||||
</assembly>
|
||||
</linker>
|
@ -5,6 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<BlazorEnableCompression>false</BlazorEnableCompression>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
@ -20,11 +21,21 @@
|
||||
<TrimmerSingleWarn>false</TrimmerSingleWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="ILLink.Descriptors.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="ILLink.Descriptors.xml">
|
||||
<LogicalName>ILLink.Descriptors.xml</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GenFu" Version="1.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.4" PrivateAssets="all" />
|
||||
<PackageReference Include="MudBlazor" Version="6.0.11-dev.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.6" PrivateAssets="all" />
|
||||
<PackageReference Include="MudBlazor" Version="6.0.11" />
|
||||
<PackageReference Include="protobuf-net" Version="3.1.17" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -100,7 +100,7 @@ else
|
||||
<Columns>
|
||||
<Column T="Navigator" Field="@nameof(Navigator.Id)"/>
|
||||
<Column T="Navigator" Field="@nameof(Navigator.IdString)"/>
|
||||
<Column T="Navigator" Field="@nameof(Navigator.NameEntry0)" Title="Navigator Name"
|
||||
<Column T="Navigator" Field="@nameof(Navigator.NameEntryString)" Title="Navigator Name"
|
||||
SortBy="NameEntrySortByFunc"/>
|
||||
<Column T="Navigator" Field="@nameof(Navigator.ToolTipJp)" Title="Navigator Description (Japanese)"/>
|
||||
<Column T="Navigator" Field="@nameof(Navigator.ToolTipEn)" Title="Navigator Description (English)"/>
|
||||
|
@ -32,6 +32,10 @@ public class Navigator
|
||||
|
||||
[ProtoMember(9)]
|
||||
public string? ToolTipEn { get; set; }
|
||||
|
||||
[ProtoIgnore]
|
||||
public string? NameEntryString => NameEntry0?.ToString();
|
||||
|
||||
public override string ToString() {
|
||||
return $"{Id}: {NameEntry1?.NameWithVariant}, {NameEntry1?.IllustrationCredit}";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user