mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
parent
42f2c09942
commit
7797ecf836
@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using AssetRipper.GUI.Web.Pages;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AssetRipper.GUI.Web;
|
||||
|
||||
@ -7,6 +8,7 @@ namespace AssetRipper.GUI.Web;
|
||||
[JsonSerializable(typeof(bool))]
|
||||
[JsonSerializable(typeof(int))]
|
||||
[JsonSerializable(typeof(byte[]))]
|
||||
[JsonSerializable(typeof(Commands.PathFormData))]
|
||||
internal partial class AppJsonSerializerContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
||||
namespace AssetRipper.GUI.Web.Pages;
|
||||
@ -8,6 +9,17 @@ public static class Commands
|
||||
private const string RootPath = "/";
|
||||
private const string CommandsPath = "/Commands";
|
||||
|
||||
/// <summary>
|
||||
/// For documentation purposes
|
||||
/// </summary>
|
||||
/// <param name="Path">The file system path.</param>
|
||||
internal record PathFormData(string Path);
|
||||
|
||||
internal static RouteHandlerBuilder AcceptsFormDataContainingPath(this RouteHandlerBuilder builder)
|
||||
{
|
||||
return builder.Accepts<PathFormData>("application/x-www-form-urlencoded");
|
||||
}
|
||||
|
||||
public readonly struct LoadFile : ICommand
|
||||
{
|
||||
static async Task<string?> ICommand.Execute(HttpRequest request)
|
||||
|
||||
@ -292,20 +292,18 @@ public static class WebApplicationLauncher
|
||||
|
||||
//Commands
|
||||
app.MapPost("/Export/UnityProject", Commands.HandleCommand<Commands.ExportUnityProject>)
|
||||
.WithQueryStringParameter("Path")
|
||||
.AcceptsFormDataContainingPath()
|
||||
.Produces(StatusCodes.Status302Found);
|
||||
app.MapPost("/Export/PrimaryContent", Commands.HandleCommand<Commands.ExportPrimaryContent>)
|
||||
.WithQueryStringParameter("Path")
|
||||
.AcceptsFormDataContainingPath()
|
||||
.Produces(StatusCodes.Status302Found);
|
||||
app.MapPost("/LoadFile", Commands.HandleCommand<Commands.LoadFile>)
|
||||
.WithQueryStringParameter("Path")
|
||||
.AcceptsFormDataContainingPath()
|
||||
.Produces(StatusCodes.Status302Found);
|
||||
app.MapPost("/LoadFolder", Commands.HandleCommand<Commands.LoadFolder>)
|
||||
.WithQueryStringParameter("Path")
|
||||
.Produces(StatusCodes.Status302Found);
|
||||
app.MapPost("/Reset", Commands.HandleCommand<Commands.Reset>)
|
||||
.WithQueryStringParameter("Path")
|
||||
.AcceptsFormDataContainingPath()
|
||||
.Produces(StatusCodes.Status302Found);
|
||||
app.MapPost("/Reset", Commands.HandleCommand<Commands.Reset>);
|
||||
|
||||
//Dialogs
|
||||
app.MapGet("/Dialogs/SaveFile", Dialogs.SaveFile.HandleGetRequest).Produces<string>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user