support for commercial modules, themes, translations
This commit is contained in:
@ -32,10 +32,10 @@ namespace Oqtane.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// GET: api/<controller>?type=x&search=y&license=z
|
||||
// GET: api/<controller>?type=x&search=y&price=z&package=a
|
||||
[HttpGet]
|
||||
[Authorize(Roles = RoleNames.Host)]
|
||||
public async Task<IEnumerable<Package>> Get(string type, string search, string price)
|
||||
public async Task<IEnumerable<Package>> Get(string type, string search, string price, string package)
|
||||
{
|
||||
// get packages
|
||||
List<Package> packages = new List<Package>();
|
||||
@ -45,7 +45,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}");
|
||||
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}");
|
||||
}
|
||||
}
|
||||
return packages;
|
||||
|
@ -186,41 +186,45 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
public bool UninstallPackage(string PackageName)
|
||||
{
|
||||
// get manifest with highest version
|
||||
string packagename = "";
|
||||
string[] packages = Directory.GetFiles(Path.Combine(_environment.ContentRootPath, "Packages"), PackageName + "*.log");
|
||||
if (packages.Length > 0)
|
||||
if (!string.IsNullOrEmpty(PackageName))
|
||||
{
|
||||
packagename = packages[packages.Length - 1]; // use highest version
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(packagename))
|
||||
{
|
||||
// use manifest to clean up file resources
|
||||
List<string> assets = JsonSerializer.Deserialize<List<string>>(File.ReadAllText(packagename));
|
||||
assets.Reverse();
|
||||
foreach (string asset in assets)
|
||||
// get manifest with highest version
|
||||
string packagename = "";
|
||||
string[] packages = Directory.GetFiles(Path.Combine(_environment.ContentRootPath, "Packages"), PackageName + "*.log");
|
||||
if (packages.Length > 0)
|
||||
{
|
||||
// legacy support for assets that were stored as absolute paths
|
||||
string filepath = asset.StartsWith("\\") ? Path.Combine(_environment.ContentRootPath, asset.Substring(1)) : asset;
|
||||
if (File.Exists(filepath))
|
||||
packagename = packages[packages.Length - 1]; // use highest version
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(packagename))
|
||||
{
|
||||
// use manifest to clean up file resources
|
||||
List<string> assets = JsonSerializer.Deserialize<List<string>>(File.ReadAllText(packagename));
|
||||
assets.Reverse();
|
||||
foreach (string asset in assets)
|
||||
{
|
||||
File.Delete(filepath);
|
||||
if (!Directory.EnumerateFiles(Path.GetDirectoryName(filepath)).Any())
|
||||
// legacy support for assets that were stored as absolute paths
|
||||
string filepath = asset.StartsWith("\\") ? Path.Combine(_environment.ContentRootPath, asset.Substring(1)) : asset;
|
||||
if (File.Exists(filepath))
|
||||
{
|
||||
Directory.Delete(Path.GetDirectoryName(filepath));
|
||||
File.Delete(filepath);
|
||||
if (!Directory.EnumerateFiles(Path.GetDirectoryName(filepath)).Any())
|
||||
{
|
||||
Directory.Delete(Path.GetDirectoryName(filepath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clean up package asset manifests
|
||||
foreach(string asset in packages)
|
||||
{
|
||||
File.Delete(asset);
|
||||
}
|
||||
// clean up package asset manifests
|
||||
foreach (string asset in packages)
|
||||
{
|
||||
File.Delete(asset);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -241,10 +241,6 @@ namespace Oqtane.Repository
|
||||
moduledefinition.ModuleDefinitionName = qualifiedModuleType;
|
||||
moduledefinition.ControlTypeTemplate = modulecontroltype.Namespace + "." + Constants.ActionToken + ", " + modulecontroltype.Assembly.GetName().Name;
|
||||
moduledefinition.AssemblyName = assembly.GetName().Name;
|
||||
if (string.IsNullOrEmpty(moduledefinition.PackageName))
|
||||
{
|
||||
moduledefinition.PackageName = Utilities.GetTypeName(moduledefinition.ModuleDefinitionName);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(moduledefinition.Categories))
|
||||
{
|
||||
|
@ -101,10 +101,6 @@ namespace Oqtane.Repository
|
||||
theme.Themes = new List<ThemeControl>();
|
||||
theme.Containers = new List<ThemeControl>();
|
||||
theme.AssemblyName = assembly.FullName.Split(",")[0];
|
||||
if (string.IsNullOrEmpty(theme.PackageName))
|
||||
{
|
||||
theme.PackageName = Utilities.GetTypeName(theme.ThemeName);
|
||||
}
|
||||
|
||||
Debug.WriteLine($"Oqtane Info: Registering Theme {theme.ThemeName}");
|
||||
themes.Add(theme);
|
||||
|
@ -12,7 +12,8 @@ namespace [Owner].[Module]
|
||||
Version = "1.0.0",
|
||||
ServerManagerType = "[ServerManagerType]",
|
||||
ReleaseVersions = "1.0.0",
|
||||
Dependencies = "[Owner].[Module].Shared.Oqtane"
|
||||
Dependencies = "[Owner].[Module].Shared.Oqtane",
|
||||
PackageName = "[Owner].[Module]"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,8 @@ namespace [Owner].[Theme]
|
||||
public Theme Theme => new Theme
|
||||
{
|
||||
Name = "[Theme]",
|
||||
Version = "1.0.0"
|
||||
Version = "1.0.0",
|
||||
PackageName = "[Owner].[Theme]"
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user