mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Plugins - Fixed cancelling prerequisite installation
Plugins - Tweaked prerequisite installation popup size Account settings - Added personal access token management Workshop - Added plugin loading, installing and removal
This commit is contained in:
1 parent
21b8112de5
commit
f2c8de1746
33 files changed
+516
-113
No files matched your search
@@ -1,3 +1,9 @@
|
||||
namespace Artemis.WebClient.Workshop.Models;
|
||||
|
||||
public record PersonalAccessToken(string Key, DateTime CreationTime, DateTime? Expiration, string? Description);
|
||||
public class PersonalAccessToken
|
||||
{
|
||||
public string Key { get; init; }
|
||||
public DateTimeOffset CreationTime { get; init; }
|
||||
public DateTimeOffset? Expiration { get; init; }
|
||||
public string? Description { get; init; }
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public interface IWorkshopService
|
||||
InstalledEntry? GetInstalledEntry(IEntryDetails entry);
|
||||
void RemoveInstalledEntry(InstalledEntry installedEntry);
|
||||
void SaveInstalledEntry(InstalledEntry entry);
|
||||
void RemoveOrphanedFiles();
|
||||
void Initialize();
|
||||
|
||||
public record WorkshopStatus(bool IsReachable, string Message);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ internal class UserManagementService : IUserManagementService
|
||||
HttpResponseMessage response = await client.PostAsync("user/access-token", JsonContent.Create(new {Description = description, ExpirationDate = expirationDate}), cancellationToken);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
string? result = await response.Content.ReadFromJsonAsync<string>(cancellationToken: cancellationToken);
|
||||
string? result = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
if (result == null)
|
||||
throw new ArtemisWebClientException("Failed to deserialize access token");
|
||||
return result;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Net.Http.Headers;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Storage.Entities.Workshop;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.WebClient.Workshop.Exceptions;
|
||||
using Artemis.WebClient.Workshop.Handlers.UploadHandlers;
|
||||
using Artemis.WebClient.Workshop.Models;
|
||||
using Serilog;
|
||||
@@ -15,13 +17,16 @@ public class WorkshopService : IWorkshopService
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IRouter _router;
|
||||
private readonly IEntryRepository _entryRepository;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private bool _initialized;
|
||||
|
||||
public WorkshopService(ILogger logger, IHttpClientFactory httpClientFactory, IRouter router, IEntryRepository entryRepository)
|
||||
public WorkshopService(ILogger logger, IHttpClientFactory httpClientFactory, IRouter router, IEntryRepository entryRepository, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
_logger = logger;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_router = router;
|
||||
_entryRepository = entryRepository;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
}
|
||||
|
||||
public async Task<Stream?> GetEntryIcon(long entryId, CancellationToken cancellationToken)
|
||||
@@ -170,7 +175,17 @@ public class WorkshopService : IWorkshopService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RemoveOrphanedFiles()
|
||||
public void Initialize()
|
||||
{
|
||||
if (_initialized)
|
||||
throw new ArtemisWorkshopException("Workshop service is already initialized");
|
||||
|
||||
RemoveOrphanedFiles();
|
||||
_pluginManagementService.AdditionalPluginDirectories.AddRange(GetInstalledEntries().Where(e => e.EntryType == EntryType.Plugin).Select(e => e.GetReleaseDirectory()));
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
private void RemoveOrphanedFiles()
|
||||
{
|
||||
List<InstalledEntry> entries = GetInstalledEntries();
|
||||
foreach (string directory in Directory.GetDirectories(Constants.WorkshopFolder))
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
Reference in new issue
Block a user