diff --git a/SiteServer.CMS/Api/Sys/Stl/ApiRouteActionsSearch.cs b/SiteServer.CMS/Api/Sys/Stl/ApiRouteActionsSearch.cs
index 72fc0a468..5aa22ff85 100644
--- a/SiteServer.CMS/Api/Sys/Stl/ApiRouteActionsSearch.cs
+++ b/SiteServer.CMS/Api/Sys/Stl/ApiRouteActionsSearch.cs
@@ -13,7 +13,7 @@ public static string GetUrl(string apiUrl)
return PageUtils.Combine(apiUrl, Route);
}
- public static string GetParameters(bool isAllSites, string siteName, string siteDir, string siteIds, string channelIndex, string channelName, string channelIds, string type, string word, string dateAttribute, string dateFrom, string dateTo, string since, int pageNum, bool isHighlight, int siteId, string ajaxDivId, string template)
+ public static string GetParameters(bool isAllSites, string siteName, string siteDir, string siteIds, string channelIndex, string channelName, string channelIds, string type, string word, string dateAttribute, string dateFrom, string dateTo, string since, int pageNum, bool isHighlight, bool isDefaultDisplay, int siteId, string ajaxDivId, string template)
{
return $@"
{{
@@ -55,6 +55,7 @@ public static string GetParameters(bool isAllSites, string siteName, string site
StlSearch.Since.ToLower(),
StlSearch.PageNum.ToLower(),
StlSearch.IsHighlight.ToLower(),
+ StlSearch.IsDefaultDisplay.ToLower(),
"siteid",
"ajaxdivid",
"template",
diff --git a/SiteServer.CMS/Core/OnlineTemplateManager.cs b/SiteServer.CMS/Core/OnlineTemplateManager.cs
deleted file mode 100644
index 0dc7d6113..000000000
--- a/SiteServer.CMS/Core/OnlineTemplateManager.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System.Collections.Generic;
-using System.Xml;
-using SiteServer.Utils;
-using SiteServer.Utils.Enumerations;
-
-namespace SiteServer.CMS.Core
-{
- public static class OnlineTemplateManager
- {
- private const string UrlTemplatesXml = "https://www.siteserver.cn/templates/templates.xml";
-
- public const string UrlHome = "https://www.siteserver.cn/templates/";
-
- public static bool TryGetOnlineTemplates(out List
> list)
- {
- list = new List>();
-
- try
- {
- var content = WebClientUtils.GetRemoteFileSource(UrlTemplatesXml, ECharset.utf_8);
-
- var document = XmlUtils.GetXmlDocument(content);
- var rootNode = XmlUtils.GetXmlNode(document, "//siteTemplates");
- if (rootNode.ChildNodes.Count > 0)
- {
- foreach (XmlNode node in rootNode.ChildNodes)
- {
- var ie = node.ChildNodes.GetEnumerator();
- var title = string.Empty;
- var description = string.Empty;
- var author = string.Empty;
- var source = string.Empty;
- var lastEditDate = string.Empty;
-
- while (ie.MoveNext())
- {
- var childNode = (XmlNode)ie.Current;
- if (childNode == null) continue;
-
- var nodeName = childNode.Name;
- if (StringUtils.EqualsIgnoreCase(nodeName, "title"))
- {
- title = childNode.InnerText;
- }
- else if (StringUtils.EqualsIgnoreCase(nodeName, "description"))
- {
- description = childNode.InnerText;
- }
- else if (StringUtils.EqualsIgnoreCase(nodeName, "author"))
- {
- author = childNode.InnerText;
- }
- else if (StringUtils.EqualsIgnoreCase(nodeName, "source"))
- {
- source = childNode.InnerText;
- }
- else if (StringUtils.EqualsIgnoreCase(nodeName, "lastEditDate"))
- {
- lastEditDate = childNode.InnerText;
- }
- }
-
- if (!string.IsNullOrEmpty(title))
- {
- list.Add(new Dictionary
- {
- ["title"] = StringUtils.Trim(title),
- ["description"] = StringUtils.Trim(description),
- ["author"] = StringUtils.Trim(author),
- ["source"] = StringUtils.Trim(source),
- ["lastEditDate"] = StringUtils.Trim(lastEditDate)
- });
- }
- }
- }
-
- return true;
- }
- catch
- {
- return false;
- }
- }
-
- public static string GetTemplateUrl(string name)
- {
- return $"https://www.siteserver.cn/templates/t-{name.ToLower()}/index.html";
- }
-
- public static string GetDownloadUrl(string name)
- {
- return $"https://api.siteserver.cn/downloads/template/{name}";
- }
- }
-}
diff --git a/SiteServer.CMS/ImportExport/AtomUtility.cs b/SiteServer.CMS/ImportExport/AtomUtility.cs
index 774ba829e..3f47f4208 100644
--- a/SiteServer.CMS/ImportExport/AtomUtility.cs
+++ b/SiteServer.CMS/ImportExport/AtomUtility.cs
@@ -76,7 +76,7 @@ public static AtomFeed GetEmptyFeed()
{
Title = new AtomContentConstruct("title", "siteserver channel"),
Author = new AtomPersonConstruct("author",
- "siteserver", new Uri("https://www.siteserver.cn")),
+ "siteserver", new Uri(CloudUtils.Root.Host)),
Modified = new AtomDateConstruct("modified", DateTime.Now,
TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now))
};
@@ -88,7 +88,7 @@ public static AtomEntry GetEmptyEntry()
{
var entry = new AtomEntry
{
- Id = new Uri("https://www.siteserver.cn/"),
+ Id = new Uri(CloudUtils.Root.Host),
Title = new AtomContentConstruct("title", "title"),
Modified = new AtomDateConstruct("modified", DateTime.Now,
TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)),
diff --git a/SiteServer.CMS/Packaging/PackageMetadata.cs b/SiteServer.CMS/Packaging/PackageMetadata.cs
index 6d63782fa..fa028114c 100644
--- a/SiteServer.CMS/Packaging/PackageMetadata.cs
+++ b/SiteServer.CMS/Packaging/PackageMetadata.cs
@@ -4,6 +4,7 @@
using NuGet.Packaging;
using NuGet.Versioning;
using SiteServer.Plugin;
+using SiteServer.Utils;
namespace SiteServer.CMS.Packaging
{
@@ -18,7 +19,7 @@ public PackageMetadata(string directoryName)
{
Id = directoryName;
Title = directoryName;
- IconUrl = new Uri("https://www.siteserver.cn/assets/images/favicon.png");
+ IconUrl = new Uri(CloudUtils.Root.IconUrl);
Version = "0.0.0";
}
diff --git a/SiteServer.CMS/Packaging/PackageUtils.cs b/SiteServer.CMS/Packaging/PackageUtils.cs
index 73f01f069..0c84e78a7 100644
--- a/SiteServer.CMS/Packaging/PackageUtils.cs
+++ b/SiteServer.CMS/Packaging/PackageUtils.cs
@@ -84,8 +84,7 @@ public static void DownloadPackage(string packageId, string version)
}
var localFilePath = PathUtils.Combine(directoryPath, idWithVersion + ".nupkg");
- WebClientUtils.SaveRemoteFileToLocal(
- $"https://api.siteserver.cn/downloads/update/{version}", localFilePath);
+ WebClientUtils.SaveRemoteFileToLocal(CloudUtils.Dl.GetPackagesUrl(PackageIdSsCms, version), localFilePath);
ZipUtils.ExtractZip(localFilePath, directoryPath);
}
@@ -98,8 +97,7 @@ public static void DownloadPackage(string packageId, string version)
var localFilePath = PathUtils.Combine(directoryPath, idWithVersion + ".nupkg");
- WebClientUtils.SaveRemoteFileToLocal(
- $"https://api.siteserver.cn/downloads/package/{packageId}/{version}", localFilePath);
+ WebClientUtils.SaveRemoteFileToLocal(CloudUtils.Dl.GetPackagesUrl(packageId, version), localFilePath);
ZipUtils.ExtractZip(localFilePath, directoryPath);
diff --git a/SiteServer.CMS/Plugin/PluginManager.cs b/SiteServer.CMS/Plugin/PluginManager.cs
index 9b64cae19..1b18f3e60 100644
--- a/SiteServer.CMS/Plugin/PluginManager.cs
+++ b/SiteServer.CMS/Plugin/PluginManager.cs
@@ -440,186 +440,6 @@ public static ServiceImpl GetService(string pluginId)
return null;
}
-
-
- //public static List GetAllContentModels(SiteInfo siteInfo)
- //{
- // var cacheName = nameof(GetAllContentModels) + siteInfo.Id;
- // var contentModels = GetCache>(cacheName);
- // if (contentModels != null) return contentModels;
-
- // contentModels = new List();
-
- // foreach (var pluginInfo in GetEnabledPluginInfoLists())
- // {
- // var model = pluginInfo.Plugin as IContentModel;
-
- // if (model == null) continue;
-
- // var tableName = siteInfo.AuxiliaryTableForContent;
- // var tableType = EAuxiliaryTableType.BackgroundContent;
- // if (model.ContentTableColumns != null && model.ContentTableColumns.Count > 0)
- // {
- // tableName = pluginInfo.Id;
- // tableType = EAuxiliaryTableType.Custom;
- // }
-
- // contentModels.Add(new ContentModelInfo(
- // pluginInfo.Id,
- // pluginInfo.Id,
- // $"插件:{pluginInfo.Metadata.DisplayName}",
- // tableName,
- // tableType,
- // PageUtils.GetPluginDirectoryUrl(pluginInfo.Id, pluginInfo.Metadata.Icon))
- // );
- // }
-
- // SetCache(cacheName, contentModels);
-
- // return contentModels;
- //}
-
-
-
- //public static List GetAllContentModels(SiteInfo siteInfo)
- //{
- // var cacheName = nameof(GetAllContentModels) + siteInfo.Id;
- // var contentModels = GetCache>(cacheName);
- // if (contentModels != null) return contentModels;
-
- // contentModels = new List();
-
- // foreach (var pluginInfo in GetEnabledPluginInfoLists())
- // {
- // var model = pluginInfo.Plugin as IContentModel;
-
- // if (model == null) continue;
-
- // var links = new List();
- // if (model.ContentLinks != null)
- // {
- // links.AddRange(model.ContentLinks.Select(link => new PluginContentLink
- // {
- // Text = link.Text,
- // Href = PageUtils.GetPluginDirectoryUrl(pluginInfo.Id, link.Href),
- // Target = link.Target
- // }));
- // }
- // var tableName = siteInfo.AuxiliaryTableForContent;
- // var tableType = EAuxiliaryTableType.BackgroundContent;
- // if (model.IsCustomContentTable && model.CustomContentTableColumns != null && model.CustomContentTableColumns.Count > 0)
- // {
- // tableName = pluginInfo.Id;
- // tableType = EAuxiliaryTableType.Custom;
- // }
-
- // contentModels.Add(new ContentModelInfo(
- // pluginInfo.Id,
- // pluginInfo.Id,
- // $"插件:{pluginInfo.Metadata.DisplayName}",
- // tableName,
- // tableType,
- // PageUtils.GetPluginDirectoryUrl(pluginInfo.Id, pluginInfo.Metadata.Icon),
- // links)
- // );
- // }
-
- // SetCache(cacheName, contentModels);
-
- // return contentModels;
- //}
-
-
-
- //public static Dictionary> GetRenders()
- //{
- // var renders = new Dictionary>();
-
- // var pluginInfoList = GetEnabledPluginInfoList();
- // if (pluginInfoList != null && pluginInfoList.Count > 0)
- // {
- // foreach (var pluginInfo in pluginInfoList)
- // {
- // var plugin = pluginInfo.Plugin as IRender;
- // if (plugin?.Render != null)
- // {
- // renders.Add(pluginInfo.Metadata.Id, plugin.Render);
- // }
- // //if (!(pluginInfo.Plugin is IRender plugin)) continue;
-
- // //if (plugin.Render != null)
- // //{
- // // renders.Add(pluginInfo.Metadata.Id, plugin.Render);
- // //}
- // }
- // }
-
- // return renders;
- //}
-
- //public static List> GetFileSystemChangedActions()
- //{
- // var actions = new List>();
-
- // var plugins = GetEnabledFeatures();
- // if (plugins != null && plugins.Count > 0)
- // {
- // foreach (var plugin in plugins)
- // {
- // if (plugin.FileSystemChanged != null)
- // {
- // actions.Add(plugin.FileSystemChanged);
- // }
- // }
- // }
-
- // return actions;
- //}
-
-
-
- //public static bool Install(string pluginId, string version, out string errorMessage)
- //{
- // errorMessage = string.Empty;
- // if (string.IsNullOrEmpty(pluginId)) return false;
-
- // try
- // {
- // if (IsExists(pluginId))
- // {
- // errorMessage = $"插件 {pluginId} 已存在";
- // return false;
- // }
- // var directoryPath = PathUtils.GetPluginPath(pluginId);
- // DirectoryUtils.DeleteDirectoryIfExists(directoryPath);
-
- // var zipFilePath = PathUtility.GetTemporaryFilesPath(pluginId + ".zip");
- // FileUtils.DeleteFileIfExists(zipFilePath);
-
- // var downloadUrl = $"http://download.siteserver.cn/plugins/{pluginId}/{version}/{pluginId}.zip";
- // WebClientUtils.SaveRemoteFileToLocal(downloadUrl, zipFilePath);
-
- // ZipUtils.UnpackFiles(zipFilePath, directoryPath);
- // FileUtils.DeleteFileIfExists(zipFilePath);
-
- // string dllDirectoryPath;
- // var metadata = GetPluginMetadata(pluginId, out dllDirectoryPath, out errorMessage);
- // if (metadata == null)
- // {
- // return false;
- // }
-
- // //SaveMetadataToJson(metadata);
- // }
- // catch (Exception ex)
- // {
- // errorMessage = ex.Message;
- // return false;
- // }
-
- // return true;
- //}
-
public static void Delete(string pluginId)
{
DirectoryUtils.DeleteDirectoryIfExists(PathUtils.GetPluginPath(pluginId));
diff --git a/SiteServer.CMS/SiteServer.CMS.csproj b/SiteServer.CMS/SiteServer.CMS.csproj
index 6d03fed39..d13f99574 100644
--- a/SiteServer.CMS/SiteServer.CMS.csproj
+++ b/SiteServer.CMS/SiteServer.CMS.csproj
@@ -215,7 +215,6 @@
-
diff --git a/SiteServer.CMS/StlParser/StlElement/StlSearch.cs b/SiteServer.CMS/StlParser/StlElement/StlSearch.cs
index e40524621..d04841fa4 100644
--- a/SiteServer.CMS/StlParser/StlElement/StlSearch.cs
+++ b/SiteServer.CMS/StlParser/StlElement/StlSearch.cs
@@ -60,6 +60,9 @@ private StlSearch() { }
[StlAttribute(Title = "是否关键字高亮")]
public const string IsHighlight = nameof(IsHighlight);
+ [StlAttribute(Title = "是否默认显示全部内容")]
+ public const string IsDefaultDisplay = nameof(IsDefaultDisplay);
+
public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
{
var isAllSites = false;
@@ -77,6 +80,7 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
var since = string.Empty;
var pageNum = 0;
var isHighlight = false;
+ var isDefaultDisplay = false;
foreach (var name in contextInfo.Attributes.AllKeys)
{
@@ -136,18 +140,19 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
}
else if (StringUtils.EqualsIgnoreCase(name, PageNum))
{
- pageNum = TranslateUtils.ToInt(value, 0);
+ pageNum = TranslateUtils.ToInt(value);
}
else if (StringUtils.EqualsIgnoreCase(name, IsHighlight))
{
isHighlight = TranslateUtils.ToBool(value);
}
+ else if (StringUtils.EqualsIgnoreCase(name, IsDefaultDisplay))
+ {
+ isDefaultDisplay = TranslateUtils.ToBool(value);
+ }
}
- string loading;
- string yes;
- string no;
- StlParserUtility.GetLoadingYesNo(contextInfo.InnerHtml, out loading, out yes, out no);
+ StlParserUtility.GetLoadingYesNo(contextInfo.InnerHtml, out var loading, out var yes, out var no);
if (string.IsNullOrEmpty(loading))
{
@@ -167,7 +172,7 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
var ajaxDivId = StlParserUtility.GetAjaxDivId(pageInfo.UniqueId);
var apiUrl = ApiRouteActionsSearch.GetUrl(pageInfo.ApiUrl);
- var apiParameters = ApiRouteActionsSearch.GetParameters(isAllSites, siteName, siteDir, siteIds, channelIndex, channelName, channelIds, type, word, dateAttribute, dateFrom, dateTo, since, pageNum, isHighlight, pageInfo.SiteId, ajaxDivId, yes);
+ var apiParameters = ApiRouteActionsSearch.GetParameters(isAllSites, siteName, siteDir, siteIds, channelIndex, channelName, channelIds, type, word, dateAttribute, dateFrom, dateTo, since, pageNum, isHighlight, isDefaultDisplay, pageInfo.SiteId, ajaxDivId, yes);
var builder = new StringBuilder();
builder.Append($@"
@@ -185,18 +190,20 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
var parameters = {apiParameters};
var queryString = document.location.search;
- if (queryString && queryString.length > 1) {{
- queryString = queryString.substring(1);
- var arr = queryString.split('&');
- for(var i=0; i < arr.length; i++) {{
- var item = arr[i];
- var arr2 = item.split('=');
- if (arr2 && arr2.length == 2) {{
- var key = (arr2[0] || '').toLowerCase();
- if (key) {{
- var value = decodeURIComponent(arr2[1]) || '';
- value = value.replace(/\+/g, ' ');
- parameters[key] = value;
+ if ((queryString && queryString.length > 1) || {isDefaultDisplay.ToString().ToLower()}) {{
+ if (queryString && queryString.length > 1) {{
+ queryString = queryString.substring(1);
+ var arr = queryString.split('&');
+ for(var i=0; i < arr.length; i++) {{
+ var item = arr[i];
+ var arr2 = item.split('=');
+ if (arr2 && arr2.length == 2) {{
+ var key = (arr2[0] || '').toLowerCase();
+ if (key) {{
+ var value = decodeURIComponent(arr2[1]) || '';
+ value = value.replace(/\+/g, ' ');
+ parameters[key] = value;
+ }}
}}
}}
}}
@@ -233,19 +240,22 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
function stlRedirect{ajaxDivId}(page)
{{
var queryString = document.location.search;
- if (queryString && queryString.length > 1) {{
- queryString = queryString.substring(1);
+ if ((queryString && queryString.length > 1) || {isDefaultDisplay.ToString().ToLower()}) {{
var parameters = '';
- var arr = queryString.split('&');
- for(var i=0; i < arr.length; i++) {{
- var item = arr[i];
- var arr2 = item.split('=');
- if (arr2 && arr2.length == 2) {{
- if (arr2[0] !== 'page') {{
- parameters += item + '&';
+ if (queryString && queryString.length > 1) {{
+ queryString = queryString.substring(1);
+ var arr = queryString.split('&');
+ for(var i=0; i < arr.length; i++) {{
+ var item = arr[i];
+ var arr2 = item.split('=');
+ if (arr2 && arr2.length == 2) {{
+ if (arr2[0] !== 'page') {{
+ parameters += item + '&';
+ }}
}}
}}
}}
+
parameters += 'page=' + page;
location.href = location.protocol + '//' + location.host + location.pathname + location.hash + '?' + parameters;
}}
diff --git a/SiteServer.CMS/StlParser/StlEntity/StlStlEntities.cs b/SiteServer.CMS/StlParser/StlEntity/StlStlEntities.cs
index d93062705..901821145 100644
--- a/SiteServer.CMS/StlParser/StlEntity/StlStlEntities.cs
+++ b/SiteServer.CMS/StlParser/StlEntity/StlStlEntities.cs
@@ -58,7 +58,7 @@ internal static string Parse(string stlEntity, PageInfo pageInfo, ContextInfo co
if (StringUtils.EqualsIgnoreCase(PoweredBy, attributeName))//支持信息
{
- parsedContent = @"Powered by SiteServer CMS";
+ parsedContent = $@"Powered by SiteServer CMS";
}
else if (StringUtils.EqualsIgnoreCase(RootUrl, attributeName))//系统根目录地址
{
diff --git a/SiteServer.Cli/Program.cs b/SiteServer.Cli/Program.cs
index 9b390142d..b83dec34b 100644
--- a/SiteServer.Cli/Program.cs
+++ b/SiteServer.Cli/Program.cs
@@ -155,7 +155,7 @@ private static async Task RunHelpAsync(bool isHelp, string commandName, Dictiona
}
await CliUtils.PrintRowLine();
- await CliUtils.PrintRow("https://www.siteserver.cn/docs/cli");
+ await CliUtils.PrintRow(CloudUtils.Root.DocsCliUrl);
await CliUtils.PrintRowLine();
Console.ReadLine();
}
diff --git a/SiteServer.Utils/CloudUtils.cs b/SiteServer.Utils/CloudUtils.cs
new file mode 100644
index 000000000..91431f664
--- /dev/null
+++ b/SiteServer.Utils/CloudUtils.cs
@@ -0,0 +1,39 @@
+namespace SiteServer.Utils
+{
+ public static class CloudUtils
+ {
+ public static class Root
+ {
+ public const string Host = "https://sscms.com";
+
+ public static string IconUrl => $"{Host}/assets/images/favicon.png";
+
+ public static string DocsCliUrl => $"{Host}/docs/cli/";
+
+ public static string GetDocsStlUrl(string tagName)
+ {
+ return $"{Host}/docs/stl/{tagName}/";
+ }
+
+ public static string GetDocsStlUrl(string tagName, string fieldName, string attrTitle)
+ {
+ return $"{Host}/docs/stl/{tagName}/#{fieldName.ToLower()}-{attrTitle.ToLower()}";
+ }
+ }
+
+ public static class Dl
+ {
+ private const string Host = "https://dl.sscms.com";
+
+ public static string GetTemplatesUrl(string fileName)
+ {
+ return $"{Host}/templates/{fileName}";
+ }
+
+ public static string GetPackagesUrl(string packageId, string version)
+ {
+ return $"{Host}/packages/{packageId}.{version}.nupkg";
+ }
+ }
+ }
+}
diff --git a/SiteServer.Utils/SiteServer.Utils.csproj b/SiteServer.Utils/SiteServer.Utils.csproj
index f8045c7e2..db4c83356 100644
--- a/SiteServer.Utils/SiteServer.Utils.csproj
+++ b/SiteServer.Utils/SiteServer.Utils.csproj
@@ -133,6 +133,7 @@
+
diff --git a/SiteServer.Utils/ThirdParty/Atom/Atom.Utils/DefaultValues.cs b/SiteServer.Utils/ThirdParty/Atom/Atom.Utils/DefaultValues.cs
index e99e68690..92e0ce95a 100644
--- a/SiteServer.Utils/ThirdParty/Atom/Atom.Utils/DefaultValues.cs
+++ b/SiteServer.Utils/ThirdParty/Atom/Atom.Utils/DefaultValues.cs
@@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Text;
using Atom.Core;
+using SiteServer.Utils;
namespace Atom.Utils
{
@@ -46,7 +47,7 @@ public sealed class DefaultValues
private DefaultValues() { }
internal const string GeneratorName = "Atom.NET";
- internal static readonly Uri GeneratorUri = new Uri("https://www.siteserver.cn");
+ internal static readonly Uri GeneratorUri = new Uri(CloudUtils.Root.Host);
internal const string GeneratorMessage = "Generated by SiteServer CMS";
internal static readonly string GeneratorVersion = Utils.GetVersion();
diff --git a/SiteServer.Web/404.html b/SiteServer.Web/404.html
index b58075f08..91de83b14 100644
--- a/SiteServer.Web/404.html
+++ b/SiteServer.Web/404.html
@@ -100,7 +100,7 @@ 很抱歉,您要访问的页面不存在!
4