optimizations and fixes

This commit is contained in:
Shaun Walker
2020-03-11 14:39:49 -04:00
parent 2436f74830
commit fe98084324
23 changed files with 159 additions and 88 deletions

View File

@ -9,6 +9,7 @@ namespace Oqtane.Services
Task<List<Page>> GetPagesAsync(int SiteId);
Task<Page> GetPageAsync(int PageId);
Task<Page> GetPageAsync(int PageId, int UserId);
Task<Page> GetPageAsync(string Path, int SiteId);
Task<Page> AddPageAsync(Page Page);
Task<Page> AddPageAsync(int PageId, int UserId);
Task<Page> UpdatePageAsync(Page Page);

View File

@ -59,13 +59,13 @@ namespace Oqtane.Services
public async Task LoadModuleDefinitionsAsync(int SiteId)
{
// get list of modules from the server
List<ModuleDefinition> moduledefinitions = await GetModuleDefinitionsAsync(SiteId);
// download assemblies to browser when running client-side Blazor
var authstateprovider = (IdentityAuthenticationStateProvider)_serviceProvider.GetService(typeof(IdentityAuthenticationStateProvider));
if (authstateprovider != null)
{
// get list of modules from the server
List<ModuleDefinition> moduledefinitions = await GetModuleDefinitionsAsync(SiteId);
// get list of loaded assemblies on the client ( in the client-side hosting module the browser client has its own app domain )
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

View File

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using Oqtane.Shared;
using System;
using System.Net;
namespace Oqtane.Services
{
@ -44,6 +45,18 @@ namespace Oqtane.Services
return await _http.GetJsonAsync<Page>(apiurl + "/" + PageId.ToString() + "?userid=" + UserId.ToString());
}
public async Task<Page> GetPageAsync(string Path, int SiteId)
{
try
{
return await _http.GetJsonAsync<Page>(apiurl + "/path/" + SiteId.ToString() + "?path=" + WebUtility.UrlEncode(Path));
}
catch
{
return null;
}
}
public async Task<Page> AddPageAsync(Page Page)
{
return await _http.PostJsonAsync<Page>(apiurl, Page);