Package enhancements for Marketplace

This commit is contained in:
sbwalker 2023-07-09 08:36:14 -04:00
parent 1b2de37c4e
commit 9a3b458c45
9 changed files with 37 additions and 12 deletions

View File

@ -17,7 +17,10 @@
<hr class="app-rule" />
</div>
<div class="collapse @_show" id="@Name">
@ChildContent
@if (ChildContent != null)
{
@ChildContent
}
</div>
@code {
@ -26,7 +29,7 @@
private string _show = string.Empty;
[Parameter]
public RenderFragment ChildContent { get; set; }
public RenderFragment ChildContent { get; set; } = null;
[Parameter]
public string Name { get; set; } // required - the name of the section

View File

@ -27,6 +27,17 @@ namespace Oqtane.Services
/// <returns></returns>
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package);
/// <summary>
/// Returns a list of packages matching the given parameters
/// </summary>
/// <param name="type"></param>
/// <param name="search"></param>
/// <param name="price"></param>
/// <param name="package"></param>
/// <param name="sort"></param>
/// <returns></returns>
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package, string sort);
/// <summary>
/// Returns a specific package
/// </summary>

View File

@ -23,7 +23,12 @@ namespace Oqtane.Services
public async Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package)
{
return await GetJsonAsync<List<Package>>($"{Apiurl}?type={type}&search={WebUtility.UrlEncode(search)}&price={price}&package={package}");
return await GetPackagesAsync(type, search, price, package, "");
}
public async Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package, string sort)
{
return await GetJsonAsync<List<Package>>($"{Apiurl}?type={type}&search={WebUtility.UrlEncode(search)}&price={price}&package={package}&sort={sort}");
}
public async Task<Package> GetPackageAsync(string packageId, string version)

View File

@ -80,7 +80,7 @@ namespace Oqtane.Controllers
public Folder GetByPath(int siteId, string path)
{
var folderPath = WebUtility.UrlDecode(path).Replace("\\", "/");
if (!folderPath.EndsWith("/"))
if (!folderPath.EndsWith("/") && folderPath != "")
{
folderPath += "/";
}

View File

@ -34,7 +34,7 @@ namespace Oqtane.Controllers
// GET: api/<controller>?type=x&search=y&price=z&package=a
[HttpGet]
public async Task<IEnumerable<Package>> Get(string type, string search, string price, string package)
public async Task<IEnumerable<Package>> Get(string type, string search, string price, string package, string sort)
{
// get packages
List<Package> packages = new List<Package>();
@ -44,7 +44,7 @@ namespace Oqtane.Controllers
{
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value);
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(Constants.PackageId, Constants.Version));
packages = await GetJson<List<Package>>(client, Constants.PackageRegistryUrl + $"/api/registry/packages/?id={_configManager.GetInstallationId()}&type={type.ToLower()}&version={Constants.Version}&search={search}&price={price}&package={package}");
packages = await GetJson<List<Package>>(client, Constants.PackageRegistryUrl + $"/api/registry/packages/?id={_configManager.GetInstallationId()}&type={type.ToLower()}&version={Constants.Version}&search={search}&price={price}&package={package}&sort={sort}");
}
}
return packages;

View File

@ -7,14 +7,8 @@ using System.Linq;
using Oqtane.Security;
using System.Net;
using Oqtane.Enums;
using Oqtane.Extensions;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Modules.Admin.Users;
using System.IO;
using Oqtane.Services;
using Oqtane.UI;
using System;
namespace Oqtane.Controllers
{

View File

@ -101,6 +101,7 @@ namespace Oqtane.Repository
ModuleDefinition.IsPortable = moduleDefinition.IsPortable;
ModuleDefinition.Resources = moduleDefinition.Resources;
ModuleDefinition.IsEnabled = moduleDefinition.IsEnabled;
ModuleDefinition.PackageName = moduleDefinition.PackageName;
}
return ModuleDefinition;

View File

@ -89,6 +89,7 @@ namespace Oqtane.Repository
Theme.Containers = theme.Containers;
Theme.ThemeSettingsType = theme.ThemeSettingsType;
Theme.ContainerSettingsType = theme.ContainerSettingsType;
Theme.PackageName = theme.PackageName;
Themes.Add(Theme);
}

View File

@ -32,6 +32,11 @@ namespace Oqtane.Models
/// </summary>
public string Description { get; set; }
/// <summary>
/// logo
/// </summary>
public int? LogoFileId { get; set; }
/// <summary>
/// License for the Package.
/// </summary>
@ -62,6 +67,11 @@ namespace Oqtane.Models
/// </summary>
public string PackageUrl { get; set; }
/// <summary>
/// The direct Url for getting support for the product
/// </summary>
public string SupportUrl { get; set; }
/// <summary>
/// Indicates if any known security vulnerabilities exist
/// </summary>