diff --git a/blog-admin/.gitignore b/blog-admin/.gitignore
index 4bb68310f328fec6423ebac92cfe21ade90062cd..d5dba20660ddd88524bcc9319dec74e445b4d372 100644
--- a/blog-admin/.gitignore
+++ b/blog-admin/.gitignore
@@ -23,4 +23,3 @@
/dist/
/nbdist/
/.nb-gradle/
-/src/main/resources/application-prod.yml
diff --git a/blog-admin/src/main/resources/templates/config.ftl b/blog-admin/src/main/resources/templates/config.ftl
index e26ad901eddf0c7dd982ffc383509a3e0e4442f0..b0224df4db0f83bce4b99056c59db5cbb9f636b2 100644
--- a/blog-admin/src/main/resources/templates/config.ftl
+++ b/blog-admin/src/main/resources/templates/config.ftl
@@ -44,6 +44,9 @@
定制页面
+
+ 系统配置
+
Hunter 配置
@@ -104,6 +107,14 @@
+
@@ -577,6 +588,10 @@
+
+ <#-- 系统配置模块 -->
+ <#include "/config/sys-tab.ftl"/>
+
diff --git a/blog-core/src/main/java/com/zyd/blog/business/enums/AdPositionEnum.java b/blog-core/src/main/java/com/zyd/blog/business/enums/AdPositionEnum.java
index e160ec73a0da5f88eb3ef671df824cef792c38ef..3999168a93d95f524d4c7ab2a2772e7fdf2bd54f 100644
--- a/blog-core/src/main/java/com/zyd/blog/business/enums/AdPositionEnum.java
+++ b/blog-core/src/main/java/com/zyd/blog/business/enums/AdPositionEnum.java
@@ -37,6 +37,11 @@ public enum AdPositionEnum {
* 适用于文章详情页、留言板、等存在评论框的页面
*/
COMMENT_BOX_TOP("评论框顶部"),
+
+ /**
+ * 适用于文章详情页、留言板、等存在评论框的页面
+ */
+ COMMENT_BOX_BOTTOM("评论框底部"),
;
private String desc;
diff --git a/blog-core/src/main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java b/blog-core/src/main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java
index c494044a1319cfb6e5651e9adc944ef275c894ea..74923d30cd891007283b64a2bc5508b43f0d0add 100644
--- a/blog-core/src/main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java
+++ b/blog-core/src/main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java
@@ -1,5 +1,8 @@
package com.zyd.blog.business.enums;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
@@ -258,6 +261,44 @@ public enum ConfigKeyEnum {
* 微信公众号AppSecret
*/
WX_GZH_APP_SECRET("wxGzhAppSecret"),
+
+ //##################################### 自定义CDN #####################################
+ /**
+ * adminJsCdn
+ */
+ ADMIN_JS_CDN("adminJsCdn"),
+ /**
+ * adminCssCdn
+ */
+ ADMIN_CSS_CDN("adminCssCdn"),
+ /**
+ * webJsCdn
+ */
+ WEB_JS_CDN("webJsCdn"),
+ /**
+ * webCssCdn
+ */
+ WEB_CSS_CDN("webCssCdn"),
+
+ //##################################### 系统配置 #####################################
+ /**
+ * 是否展示网站信息
+ */
+ SHOW_WEB_SITE_ENABLED("showWebSiteEnabled"),
+ /**
+ * 前台站点统计脚本代码
+ */
+ web_Site_Stat("webSiteStat"),
+ /**
+ * 后台站点统计脚本代码
+ */
+ ADMIN_SITE_STAT("adminSiteStat"),
+
+ /**
+ * 托管信息
+ */
+ HOSTING_INFORMATION("hostingInformation"),
+
;
private final String key;
@@ -268,4 +309,20 @@ public enum ConfigKeyEnum {
public String getKey() {
return key;
- }}
+ }
+
+ private static final Map
CONF_ENUM_MAPS = new HashMap<>(ConfigKeyEnum.values().length);
+ static {
+ for (ConfigKeyEnum e: ConfigKeyEnum.values()) {
+ CONF_ENUM_MAPS.put(e.getKey(), e);
+ }
+ }
+
+ /**
+ * key 是否在定义中。 true 为是
+ */
+ public static final boolean contains(String key) {
+ return CONF_ENUM_MAPS.containsKey(key);
+ }
+
+}
diff --git a/blog-core/src/main/java/com/zyd/blog/business/service/impl/SysConfigServiceImpl.java b/blog-core/src/main/java/com/zyd/blog/business/service/impl/SysConfigServiceImpl.java
index b4ae56e3715d591466cfa858789015109cbcaf46..fa38cf205cab8973e7103036be9059f345f4c4b3 100644
--- a/blog-core/src/main/java/com/zyd/blog/business/service/impl/SysConfigServiceImpl.java
+++ b/blog-core/src/main/java/com/zyd/blog/business/service/impl/SysConfigServiceImpl.java
@@ -95,6 +95,11 @@ public class SysConfigServiceImpl implements SysConfigService {
@Override
@RedisCache(flush = true, enable = false)
public void saveConfig(String key, String value) {
+ // 安全起见, 如果在 ConfigKeyEnum 枚举中不存在,则不允许保存,忽略
+ if(!ConfigKeyEnum.contains(key)){
+ return;
+ }
+
if (!StringUtils.isEmpty(key)) {
SysConfig config = null;
if (null == (config = this.getByKey(key))) {
diff --git a/blog-web/src/main/resources/templates/article.ftl b/blog-web/src/main/resources/templates/article.ftl
index e29d078021ff656f9eb41c7e0cc05d6db586f171..2aec70e7bbbb6779e75b932454f3640c476defe4 100644
--- a/blog-web/src/main/resources/templates/article.ftl
+++ b/blog-web/src/main/resources/templates/article.ftl
@@ -238,6 +238,9 @@
#if>
#if>
+
+ <#-- 广告位: 评论框底部 -->
+
<#include "layout/sidebar.ftl"/>
diff --git a/blog-web/src/main/resources/templates/guestbook.ftl b/blog-web/src/main/resources/templates/guestbook.ftl
index 274de3a69b0cfba971a6fdabfd9a60ff1c922e55..89bfffd9893070ad98bf5cdb9f3f8be90ec8c1f0 100644
--- a/blog-web/src/main/resources/templates/guestbook.ftl
+++ b/blog-web/src/main/resources/templates/guestbook.ftl
@@ -57,6 +57,9 @@
评论功能已被站长关闭
#if>
+
+ <#-- 广告位: 评论框底部 -->
+
diff --git a/blog-web/src/main/resources/templates/layout/footer.ftl b/blog-web/src/main/resources/templates/layout/footer.ftl
index dc8508329d3cbbc28bab97b1252f66e0bf629fb8..7921fdf0dcc709ef6c0277502f432494a13ec7df 100644
--- a/blog-web/src/main/resources/templates/layout/footer.ftl
+++ b/blog-web/src/main/resources/templates/layout/footer.ftl
@@ -120,7 +120,24 @@
免责声明
- 托管于阿里云 & 七牛云<#if config.recordNumber!> · ${config.recordNumber}#if>
+
+ <#if config.hostingInformation!>
+ 托管于 ${config.hostingInformation} |
+ #if>
+
+ <#-- 前台站点统计脚本代码 -->
+ <#if config.webSiteStat!>
+
+
+ ${config.webSiteStat} ·
+
+ #if>
+
+ <#if config.recordNumber!>
+ ${config.recordNumber}
+ #if>
+
@@ -131,7 +148,10 @@
-
<#if config.copyright!>${config.copyright} |#if> Powered by OneBlog ${appInfo.version!}
+
+ <#if config.copyright!>${config.copyright} |#if>
+ Powered by OneBlog ${appInfo.version!}
+
<#if url?? && (url == "index")>
友情链接:
diff --git a/blog-web/src/main/resources/templates/layout/sidebar.ftl b/blog-web/src/main/resources/templates/layout/sidebar.ftl
index 117c4a537a6a50981d9e904e9a2992ba404085c5..38185710d820bc0fbf49a7a0bc24425b36a316f1 100644
--- a/blog-web/src/main/resources/templates/layout/sidebar.ftl
+++ b/blog-web/src/main/resources/templates/layout/sidebar.ftl
@@ -165,21 +165,26 @@
-
+
+ <#-- 是否展示网站信息 -->
+ <#if config.showWebSiteEnabled! && config.showWebSiteEnabled == 1>
+
+ #if>
+
<#-- 广告位 -->