allow module/theme template manifests to have custom names so that they do not conflict with .NET template.json
This commit is contained in:
@@ -1,20 +1,21 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using System.Diagnostics;
|
||||||
using Oqtane.Models;
|
|
||||||
using Oqtane.Shared;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
|
using Oqtane.Models;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Security;
|
using Oqtane.Security;
|
||||||
using System;
|
using Oqtane.Shared;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
@@ -271,9 +272,10 @@ namespace Oqtane.Controllers
|
|||||||
foreach (string directory in Directory.GetDirectories(templatePath))
|
foreach (string directory in Directory.GetDirectories(templatePath))
|
||||||
{
|
{
|
||||||
string name = directory.Replace(templatePath, "");
|
string name = directory.Replace(templatePath, "");
|
||||||
if (System.IO.File.Exists(Path.Combine(directory, "template.json")))
|
var manifest = Directory.GetFiles(directory, "*.json");
|
||||||
|
if (manifest.Any())
|
||||||
{
|
{
|
||||||
var template = JsonSerializer.Deserialize<Template>(System.IO.File.ReadAllText(Path.Combine(directory, "template.json")));
|
var template = JsonSerializer.Deserialize<Template>(System.IO.File.ReadAllText(manifest[0]));
|
||||||
template.Name = name;
|
template.Name = name;
|
||||||
template.Location = "";
|
template.Location = "";
|
||||||
if (template.Type.ToLower() != "internal")
|
if (template.Type.ToLower() != "internal")
|
||||||
|
|||||||
@@ -183,9 +183,10 @@ namespace Oqtane.Controllers
|
|||||||
foreach (string directory in Directory.GetDirectories(templatePath))
|
foreach (string directory in Directory.GetDirectories(templatePath))
|
||||||
{
|
{
|
||||||
string name = directory.Replace(templatePath, "");
|
string name = directory.Replace(templatePath, "");
|
||||||
if (System.IO.File.Exists(Path.Combine(directory, "template.json")))
|
var manifest = Directory.GetFiles(directory, "*.json");
|
||||||
|
if (manifest.Any())
|
||||||
{
|
{
|
||||||
var template = JsonSerializer.Deserialize<Template>(System.IO.File.ReadAllText(Path.Combine(directory, "template.json")));
|
var template = JsonSerializer.Deserialize<Template>(System.IO.File.ReadAllText(manifest[0]));
|
||||||
template.Name = name;
|
template.Name = name;
|
||||||
template.Location = "";
|
template.Location = "";
|
||||||
if (template.Type.ToLower() != "internal")
|
if (template.Type.ToLower() != "internal")
|
||||||
|
|||||||
Reference in New Issue
Block a user