Switched to database scheme seperation from MoonCores SingleDb. Updated mooncore versions. Updating to correct Async naming
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Moonlight.Client.Implementations;
|
||||
|
||||
public class CoreStartup : IPluginStartup
|
||||
{
|
||||
public Task BuildApplication(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder)
|
||||
public Task BuildApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHostBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<ISidebarItemProvider, DefaultSidebarItemProvider>();
|
||||
builder.Services.AddSingleton<IOverviewElementProvider, DefaultOverviewElementProvider>();
|
||||
@@ -15,6 +15,6 @@ public class CoreStartup : IPluginStartup
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ConfigureApplication(IServiceProvider serviceProvider, WebAssemblyHost app)
|
||||
public Task ConfigureApplicationAsync(IServiceProvider serviceProvider, WebAssemblyHost app)
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class LogErrorFilter : IGlobalErrorFilter
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
public Task<bool> HandleException(Exception ex)
|
||||
public Task<bool> HandleExceptionAsync(Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Global error processed");
|
||||
return Task.FromResult(false);
|
||||
|
||||
@@ -18,21 +18,21 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
ApiClient = apiClient;
|
||||
}
|
||||
|
||||
public async Task CreateFile(string path)
|
||||
public async Task CreateFileAsync(string path)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"{BaseApiUrl}/touch?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task CreateDirectory(string path)
|
||||
public async Task CreateDirectoryAsync(string path)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"{BaseApiUrl}/mkdir?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<FsEntry[]> List(string path)
|
||||
public async Task<FsEntry[]> ListAsync(string path)
|
||||
{
|
||||
var entries = await ApiClient.GetJson<FileSystemEntryResponse[]>(
|
||||
$"{BaseApiUrl}/list?path={path}"
|
||||
@@ -48,14 +48,14 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
public async Task Move(string oldPath, string newPath)
|
||||
public async Task MoveAsync(string oldPath, string newPath)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"{BaseApiUrl}/move?oldPath={oldPath}&newPath={newPath}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Read(string path, Func<Stream, Task> onHandleData)
|
||||
public async Task ReadAsync(string path, Func<Stream, Task> onHandleData)
|
||||
{
|
||||
await using var stream = await ApiClient.GetStream(
|
||||
$"{BaseApiUrl}/download?path={path}"
|
||||
@@ -66,7 +66,7 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
public async Task Write(string path, Stream dataStream)
|
||||
public async Task WriteAsync(string path, Stream dataStream)
|
||||
{
|
||||
using var multiPartForm = new MultipartFormDataContent();
|
||||
|
||||
@@ -78,14 +78,14 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Delete(string path)
|
||||
public async Task DeleteAsync(string path)
|
||||
{
|
||||
await ApiClient.Delete(
|
||||
$"{BaseApiUrl}/delete?path={path}"
|
||||
);
|
||||
}
|
||||
|
||||
public async Task Combine(string destination, string[] files)
|
||||
public async Task CombineAsync(string destination, string[] files)
|
||||
{
|
||||
await ApiClient.Post(
|
||||
$"{BaseApiUrl}/combine",
|
||||
@@ -103,7 +103,7 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
new("tar.gz", ["tar.gz"], "Tar.gz Archive")
|
||||
];
|
||||
|
||||
public async Task Archive(
|
||||
public async Task ArchiveAsync(
|
||||
string destination,
|
||||
ArchiveFormat format,
|
||||
string root,
|
||||
@@ -120,7 +120,7 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
});
|
||||
}
|
||||
|
||||
public async Task Unarchive(
|
||||
public async Task UnarchiveAsync(
|
||||
string path,
|
||||
ArchiveFormat format,
|
||||
string destination,
|
||||
@@ -137,13 +137,13 @@ public class SystemFsAccess : IFsAccess, ICombineAccess, IArchiveAccess, IDownlo
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<string> GetFileUrl(string path)
|
||||
=> await GetDownloadUrl(path);
|
||||
public async Task<string> GetFileUrlAsync(string path)
|
||||
=> await GetDownloadUrlAsync(path);
|
||||
|
||||
public async Task<string> GetFolderUrl(string path)
|
||||
=> await GetDownloadUrl(path);
|
||||
public async Task<string> GetFolderUrlAsync(string path)
|
||||
=> await GetDownloadUrlAsync(path);
|
||||
|
||||
private async Task<string> GetDownloadUrl(string path)
|
||||
private async Task<string> GetDownloadUrlAsync(string path)
|
||||
{
|
||||
var response = await ApiClient.PostJson<DownloadUrlResponse>(
|
||||
$"{BaseApiUrl}/downloadUrl?path={path}"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MoonCore.Blazor.FlyonUi.Exceptions;
|
||||
using MoonCore.Blazor.FlyonUi.Toasts;
|
||||
using MoonCore.Exceptions;
|
||||
|
||||
namespace Moonlight.Client.Implementations;
|
||||
@@ -7,18 +8,25 @@ namespace Moonlight.Client.Implementations;
|
||||
public class UnauthenticatedErrorFilter : IGlobalErrorFilter
|
||||
{
|
||||
private readonly NavigationManager Navigation;
|
||||
private readonly ToastService ToastService;
|
||||
|
||||
public UnauthenticatedErrorFilter(NavigationManager navigation)
|
||||
public UnauthenticatedErrorFilter(
|
||||
NavigationManager navigation,
|
||||
ToastService toastService
|
||||
)
|
||||
{
|
||||
Navigation = navigation;
|
||||
ToastService = toastService;
|
||||
}
|
||||
|
||||
public Task<bool> HandleException(Exception ex)
|
||||
public async Task<bool> HandleExceptionAsync(Exception ex)
|
||||
{
|
||||
if (ex is not HttpApiException { Status: 401 })
|
||||
return Task.FromResult(false);
|
||||
return false;
|
||||
|
||||
await ToastService.InfoAsync("Session expired", "Your session has expired. Reloading..");
|
||||
|
||||
Navigation.NavigateTo("/api/auth/logout", true);
|
||||
return Task.FromResult(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user