Workshop - Refactor markdown editor

Workshop - Add changelog during upload
This commit is contained in:
RobertBeekman committed 2024-04-13 16:54:57 +02:00
1 parent 62057d657a
commit 7b71ee05da
24 files changed
+334 -334

No files matched your search

@@ -1,8 +1,6 @@
using Artemis.UI.Shared.Utilities;
namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers;
namespace Artemis.WebClient.Workshop.Handlers.UploadHandlers;
public interface IEntryUploadHandler
{
Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, CancellationToken cancellationToken);
Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, string? changelog, CancellationToken cancellationToken);
}
@@ -18,7 +18,7 @@ public class LayoutEntryUploadHandler : IEntryUploadHandler
}
/// <inheritdoc />
public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, CancellationToken cancellationToken)
public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, string? changelog, CancellationToken cancellationToken)
{
if (entrySource is not LayoutEntrySource source)
throw new InvalidOperationException("Can only create releases for layouts");
@@ -62,6 +62,8 @@ public class LayoutEntryUploadHandler : IEntryUploadHandler
MultipartFormDataContent content = new();
StreamContent streamContent = new(archiveStream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/zip");
if (!string.IsNullOrWhiteSpace(changelog))
content.Add(new StringContent(changelog), "Changelog");
content.Add(streamContent, "file", "file.zip");
// Submit
@@ -14,7 +14,7 @@ public class PluginEntryUploadHandler : IEntryUploadHandler
}
/// <inheritdoc />
public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, CancellationToken cancellationToken)
public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, string? changelog, CancellationToken cancellationToken)
{
if (entrySource is not PluginEntrySource source)
throw new InvalidOperationException("Can only create releases for plugins");
@@ -27,6 +27,8 @@ public class PluginEntryUploadHandler : IEntryUploadHandler
MultipartFormDataContent content = new();
StreamContent streamContent = new(fileStream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/zip");
if (!string.IsNullOrWhiteSpace(changelog))
content.Add(new StringContent(changelog), "Changelog");
content.Add(streamContent, "file", "file.zip");
// Submit
@@ -17,7 +17,7 @@ public class ProfileEntryUploadHandler : IEntryUploadHandler
}
/// <inheritdoc />
public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, CancellationToken cancellationToken)
public async Task<EntryUploadResult> CreateReleaseAsync(long entryId, IEntrySource entrySource, string? changelog, CancellationToken cancellationToken)
{
if (entrySource is not ProfileEntrySource source)
throw new InvalidOperationException("Can only create releases for profile configurations");
@@ -32,6 +32,8 @@ public class ProfileEntryUploadHandler : IEntryUploadHandler
StreamContent streamContent = new(archiveStream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/zip");
content.Add(JsonContent.Create(source.Dependencies.Select(d => new {PluginId = d.Plugin.Guid, FeatureId = d.Id}).ToList()), "ReleaseDependencies");
if (!string.IsNullOrWhiteSpace(changelog))
content.Add(new StringContent(changelog), "Changelog");
content.Add(streamContent, "file", "file.zip");
// Submit
@@ -2,10 +2,10 @@ namespace Artemis.WebClient.Workshop;
public static class WorkshopConstants
{
public const string AUTHORITY_URL = "https://localhost:5001";
public const string WORKSHOP_URL = "https://localhost:7281";
// public const string AUTHORITY_URL = "https://identity.artemis-rgb.com";
// public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com";
// public const string AUTHORITY_URL = "https://localhost:5001";
// public const string WORKSHOP_URL = "https://localhost:7281";
public const string AUTHORITY_URL = "https://identity.artemis-rgb.com";
public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com";
public const string IDENTITY_CLIENT_NAME = "IdentityApiClient";
public const string WORKSHOP_CLIENT_NAME = "WorkshopApiClient";
}