refactoring, enhancements, and some fixes

This commit is contained in:
Shaun Walker
2021-06-10 08:16:02 -04:00
parent 82c05a841f
commit bc720555c4
30 changed files with 436 additions and 244 deletions

View File

@ -3,19 +3,28 @@ using System.Threading.Tasks;
using System.Net.Http;
using Oqtane.Documentation;
using Oqtane.Shared;
using Microsoft.AspNetCore.Components;
using System;
using System.Net;
namespace Oqtane.Services
{
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
public class InstallationService : ServiceBase, IInstallationService
{
public InstallationService(HttpClient http) : base(http) {}
private readonly NavigationManager _navigationManager;
private string ApiUrl => CreateApiUrl("Installation", null); // tenant agnostic as SiteState does not exist
public InstallationService(HttpClient http, NavigationManager navigationManager) : base(http)
{
_navigationManager = navigationManager;
}
private string ApiUrl => CreateApiUrl("Installation", null, ControllerRoutes.ApiRoute); // tenant agnostic
public async Task<Installation> IsInstalled()
{
return await GetJsonAsync<Installation>($"{ApiUrl}/installed");
var path = new Uri(_navigationManager.Uri).LocalPath.Substring(1);
return await GetJsonAsync<Installation>($"{ApiUrl}/installed/?path={WebUtility.UrlEncode(path)}");
}
public async Task<Installation> Install(InstallConfig config)