优化配置选项,

其他设置-404页面配置
鱼塘-钓鱼开关
This commit is contained in:
1152958806@qq.com 2023-07-03 22:41:29 +08:00
parent e8c5c8ba8d
commit 3841ab80fc
14 changed files with 172 additions and 94 deletions

View File

@ -755,6 +755,8 @@ spec:
formSchema:
- $formkit: radio
name: enable
id: enable
key: enable
label: 启用ai 摘要
value: false
options:
@ -763,11 +765,13 @@ spec:
- label: 禁用
value: false
- $formkit: text
if: "$get(enable).value"
name: gptName
label: 名称
placeholder: 请输入内容
value: KunKunYu
- $formkit: radio
if: "$get(enable).value"
name: mode
label: 模式
value: local
@ -778,6 +782,7 @@ spec:
- label: ai
value: tianli
- $formkit: radio
if: "$get(enable).value"
name: switchBtn
label: 显示切换按钮
value: false
@ -787,26 +792,31 @@ spec:
- label:
value: false
- $formkit: url
if: "$get(enable).value"
name: btnLink
label: 链接地址
placeholder: 输入链接地址
value: https://afdian.net/item/f18c2e08db4411eda2f25254001e7c00
- $formkit: number
if: "$get(enable).value"
name: randomNum
label: 标签数量
value: 3
help: "按钮最大的随机次数,也就是一篇文章最大随机出来几种"
- $formkit: number
if: "$get(enable).value"
name: basicWordCount
label: 标签数量
value: 1000
help: "最低获取字符数, 最小1000, 最大1999"
- $formkit: text
if: "$get(enable).value"
name: key
label: key
value: xxxx
placeholder: 请输入key
- $formkit: url
if: "$get(enable).value"
name: Referer
label: 你的博客地址
help: 注意保留最后的斜杠
@ -1250,6 +1260,8 @@ spec:
formSchema:
- $formkit: radio
name: switch
id: switch
key: switch
label: 开关WIP
value: false
options:
@ -1258,19 +1270,23 @@ spec:
- label: 关闭
value: false
- $formkit: text
if: "$get(switch).value"
name: introductionTitle
label: 介绍框标题
value: '协议提醒助手'
- $formkit: text
if: "$get(switch).value"
name: introductionTip
label: 介绍框内容
value: '查看本站为你的个人隐私做出的努力'
- $formkit: url
if: "$get(switch).value"
name: introductionUrl
value: "/privacy"
label: 介绍框点击跳转地址
placeholder: 请输入跳转 url
- $formkit: text
if: "$get(switch).value"
name: introductionName
value: "本站如何保护你的隐私"
label: 按钮标题
@ -1370,6 +1386,24 @@ spec:
label: token地址
placeholder: 请输入token地址
help: 注意格式 (`token地址`)
- $formkit: radio
name: fcircleRandomFriendsEnable
label: 友链鱼塘页面(钓鱼)
value: true
options:
- label: 打开
value: true
- label: 关闭
value: false
- $formkit: radio
name: linksRandomFriendsEnable
label: 友联页面(钓鱼)
value: true
options:
- label: 打开
value: true
- label: 关闭
value: false
- group: comments
label: 评论
@ -1377,6 +1411,8 @@ spec:
- $formkit: select
name: use
label: 评论选择
id: use
key: use
value: commentWidget
help: Twikoo评论需要(打开,envId填写,accessToken填写)
options:
@ -1385,7 +1421,10 @@ spec:
- label: Twikoo评论
value: Twikoo
- $formkit: radio
name: twikoo
if: "$get(use).value == 'Twikoo'"
name: twikooEnable
id: twikooEnable
key: twikooEnable
label: Twikoo评论
value: false
options:
@ -1393,34 +1432,46 @@ spec:
value: true
- label: 关闭
value: false
- $formkit: number
name: maxBarrage
value: 1
label: 同时最多显示弹幕数
placeholder: 请输入显示弹幕数
- $formkit: number
name: barrageTime
value: 4000
label: 弹幕显示间隔时间ms
placeholder: 请输入间隔时间ms
- $formkit: url
name: envId
value: "`xxxxxxx`"
label: Twikoo评论-环境id
placeholder: 请输入环境id
help: 注意格式 (`地址`)
- $formkit: text
name: accessToken
value: "`xxxxxxx`"
label: Twikoo评论-token
placeholder: 请输入token
help: 注意格式 (`token`) 在控制台中获取
- $formkit: text
name: mailMd5
value: "`xxxxxxx`"
label: Twikoo评论-mailMd5
placeholder: 请输入mailMd5
help: 注意格式 (`mailMd5`)
- $formkit: group
if: "$get(twikooEnable).value"
name: twikoos
label: Twikoo评论配置
value:
maxBarrage:
barrageTime:
envId:
accessToken:
mailMd5:
children:
- $formkit: number
name: maxBarrage
value: 1
label: 同时最多显示弹幕数
placeholder: 请输入显示弹幕数
- $formkit: number
name: barrageTime
value: 4000
label: 弹幕显示间隔时间ms
placeholder: 请输入间隔时间ms
- $formkit: url
name: envId
value: "`xxxxxxx`"
label: Twikoo评论-环境id
placeholder: 请输入环境id
help: 注意格式 (`地址`)
- $formkit: text
name: accessToken
value: "`xxxxxxx`"
label: Twikoo评论-token
placeholder: 请输入token
help: 注意格式 (`token`) 在控制台中获取
- $formkit: text
name: mailMd5
value: "`xxxxxxx`"
label: Twikoo评论-mailMd5
placeholder: 请输入mailMd5
help: 注意格式 (`mailMd5`)
- group: other
label: 其他设置
formSchema:
@ -1449,23 +1500,25 @@ spec:
value: true
- label: 关闭
value: false
- $formkit: radio
name: diytitleEnable
id: diytitleEnable
key: diytitleEnable
help: 启用动态标题
value: false
options:
- label: 启用
value: true
- label: 禁用
value: false
- $formkit: group
name: diytitle
label: 动态标题
if: "$get(diytitleEnable).value"
value:
enable:
leaveTitle:
backTitle:
children:
- $formkit: radio
name: enable
help: 启用动态标题
value: false
options:
- label: 启用
value: true
- label: 禁用
value: false
- $formkit: text
name: leaveTitle
label: 离开
@ -1474,3 +1527,32 @@ spec:
name: backTitle
label: 回到
value: "♪(^∇^*)欢迎肥来!"
- $formkit: radio
name: error_404Enable
id: error_404Enable
key: error_404Enable
label: 启用404页面
help: 启动前请发布页面(自定义模板选择`页面没用找到`,别名`404`)
value: false
options:
- label: 启用
value: true
- label: 禁用
value: false
- $formkit: group
name: error_404
label: 404页面配置
if: "$get(error_404Enable).value"
value:
subtitle:
background:
children:
- $formkit: text
name: subtitle
label: 标题
value: "请尝试站内搜索寻找文章"
- $formkit: url
name: background
label: 背景
value: "/themes/theme-hao/assets/images/404s.gif"

View File

@ -15,11 +15,11 @@
</div>
<div id="error-wrap">
<div class="error-content">
<div class="error-img" style="background-image: url('/themes/theme-hao/assets/images/404s.gif')">
<div class="error-img" th:style="'background-image: url('+${theme.config.other.error_404.background}+')'">
</div>
<div class="error-info">
<h1 class="error_title">404</h1>
<div class="error_subtitle">请尝试站内搜索寻找文章</div>
<div class="error_subtitle">[[${theme.config.other.error_404.subtitle}]]</div>
<a class="button--animated" href="/"
data-pjax-state=""><i class="fas fa-rocket"></i>回到主页</a>
</div>

View File

@ -29,23 +29,26 @@
</div>
</div>
<!--钓鱼-->
<div class="title-h2-a">
<div class="title-h2-a-left">
<h2 style="padding-top:0;margin:.6rem 0 .6rem">🎣 钓鱼</h2><a class="random-post-start"
href="javascript:fetchRandomPost();"><i
class="anzhiyufont anzhiyu-icon-arrow-rotate-right"></i></a>
<th:block th:if="${theme.config.fcircle.fcircleRandomFriendsEnable}" >
<div class="title-h2-a">
<div class="title-h2-a-left">
<h2 style="padding-top:0;margin:.6rem 0 .6rem">🎣 钓鱼</h2><a class="random-post-start"
href="javascript:fetchRandomPost();"><i
class="anzhiyufont anzhiyu-icon-arrow-rotate-right"></i></a>
</div>
<div class="title-h2-a-right"><a class="random-post-all" href="/links">全部友链</a></div>
</div>
<div class="title-h2-a-right"><a class="random-post-all" href="/links">全部友链</a></div>
</div>
<div id="random-post"></div>
<script type="text/javascript">
var fdataUser = {
apiurl: [[${theme.config.fcircle.apiurl}]],
defaultFish: 500,
hungryFish: 500,
}
</script>
<script th:src="@{/assets/libs/moments/random-friends-post.js}"></script>
<div id="random-post"></div>
<script type="text/javascript">
var fdataUser = {
apiurl: [[${theme.config.fcircle.apiurl}]],
defaultFish: 500,
hungryFish: 500,
}
</script>
<script th:src="@{/assets/libs/moments/random-friends-post.js}"></script>
</th:block>
<!--鱼塘-->
<!-- <div id="hexo-circle-of-friends-root"></div>
<script defer data-pjax src="https://cdn.yzczi.com/anzhiyu-blog-static%401.0.0/friends_vue/index2.js"></script> -->

View File

@ -53,7 +53,7 @@
</div>
<!--钓鱼-->
<th:block th:if="${not #lists.isEmpty(groups)}" >
<th:block th:if="${not #lists.isEmpty(groups) && theme.config.fcircle.linksRandomFriendsEnable}" >
<div class="title-h2-a">
<div class="title-h2-a-left">
<h2 style="padding-top:0;margin:.6rem 0 .6rem">🎣 钓鱼</h2><a class="random-post-start"
@ -155,7 +155,7 @@
<hr/>
<!-- 评论模块 -->
<th:block th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
<th:block th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
<div th:replace="~{modules/twikoo :: twikoo}"></div>
</th:block>
<div id="post-comment" th:if="${pluginFinder.available('PluginCommentWidget') && #strings.equals(theme.config.comments.use, 'commentWidget')}">

View File

@ -5,20 +5,20 @@
<script data-pjax=""
th:fragment="commentBarrage"
th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)
&& not #strings.isEmpty(theme.config.comments.accessToken)}">
th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)
&& not #strings.isEmpty(theme.config.comments.twikoos.accessToken)}">
var commentBarrageConfig = {
//同时最多显示弹幕数
maxBarrage: [[${ theme.config.comments.maxBarrage }]],
maxBarrage: [[${ theme.config.comments.twikoos.maxBarrage }]],
//弹幕显示间隔时间ms
barrageTime: [[${ theme.config.comments.barrageTime }]],
barrageTime: [[${ theme.config.comments.twikoos.barrageTime }]],
//twikoo部署地址腾讯云的为环境ID
twikooUrl: [[${ theme.config.comments.envId }]],
twikooUrl: [[${ theme.config.comments.twikoos.envId }]],
//token获取见上方
accessToken: [[${ theme.config.comments.accessToken }]],
mailMd5: [[${ theme.config.comments.mailMd5 }]],
accessToken: [[${ theme.config.comments.twikoos.accessToken }]],
mailMd5: [[${ theme.config.comments.twikoos.mailMd5 }]],
pageUrl: window.location.pathname,
barrageTimer: [],
barrageList: [],

View File

@ -107,8 +107,8 @@
<!--评论弹幕弹窗 -->
<div th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)
&& not #strings.isEmpty(theme.config.comments.accessToken)}" class="comment-barrage needEndHide"
<div th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)
&& not #strings.isEmpty(theme.config.comments.twikoos.accessToken)}" class="comment-barrage needEndHide"
style="display: none;"></div>

View File

@ -170,6 +170,7 @@
isFriendLinksInFooter: [[${theme.config.footer.enable_footer_group}]],
loadingBox: [[${theme.config.other.loadingBox}]],
loadProgressBar: [[${theme.config.other.loadProgressBar}]],
error404Enable: [[${theme.config.other.error_404Enable}]],
date_suffix: {
just: '刚刚',
min: '分钟前',

View File

@ -161,7 +161,7 @@
</script>
<script th:if="${theme.config.other.diytitle.enable}">//
<script th:if="${theme.config.other.diytitleEnable}">//
let leaveTitle = '[[${theme.config.other.diytitle.leaveTitle}]]';
let backTitle = '[[${theme.config.other.diytitle.backTitle}]]';
let OriginTitile = document.title
@ -286,12 +286,14 @@
typeof preloader === 'object' && preloader.endLoading()
})
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404')
}
if(GLOBAL_CONFIG.error404Enable){
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404')
}
}
)
}
)
</script>

View File

@ -10,21 +10,11 @@
</div>
</div>
<div id="twikoo-wrap"></div>
<!-- <script th:src="@{/assets/libs/twikoo/twikoo.all.min.js}"></script>
<script>
twikoo.init({
envId: [[${theme.config.comments.envId}]], // 腾讯云环境填 envIdVercel 环境填地址https://xxx.vercel.app
el: '#twikoo-wrap', // 容器元素
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai腾讯云环境填 ap-shanghai 或 ap-guangzhouVercel 环境不填
// path: location.pathname, // 用于区分不同文章的自定义 js 路径,如果您的文章路径不是 location.pathname需传此参数
// lang: 'zh-CN', // 用于手动设定评论区语言,支持的语言列表 https://github.com/imaegoo/twikoo/blob/main/src/client/utils/i18n/index.js
})
</script> -->
<script>(() => {
const init = () => {
twikoo.init(Object.assign({
el: '#twikoo-wrap',
envId: [[${theme.config.comments.envId}]],
envId: [[${theme.config.comments.twikoos.envId}]],
region: '',
onCommentLoaded: function () {
//- btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.vemoji)'))
@ -46,7 +36,7 @@
const getCount = () => {
twikoo.getCommentsCount({
envId: [[${theme.config.comments.envId}]],
envId: [[${theme.config.comments.twikoos.envId}]],
region: '',
urls: [window.location.pathname],
includeReply: true

View File

@ -1,17 +1,17 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 归档 -->
<!-- 最新评论 -->
<div class="card-widget card-recent-post" th:fragment="comments">
<div class="item-headline"><i class="iconfont icon-comment-dots"></i><span>最新评论</span></div>
<div class="aside-list" id="newcomm">
<script th:src="@{/assets/libs/twikoo/twikoo.all.min.js}"></script>
<script th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
<script th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
(()=>{
const pagesize = [[${theme.config.sidebar.newcommentnumber}]];
const defaultpagesize = 5;
const finalpagesize = pagesize <= 0 ? defaultpagesize : pagesize;
twikoo.getRecentComments({
envId: [[${ theme.config.comments.envId }]], // 环境 ID
envId: [[${ theme.config.comments.twikoos.envId }]], // 环境 ID
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai如果您的环境地域不是上海需传此参数
pageSize: finalpagesize, // 获取多少条默认10最大100
includeReply: false // 是否包括最新回复默认false

View File

@ -5,7 +5,7 @@
<!-- 最近评论 -->
<script
th:fragment="cardNewestComments"
th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
@ -24,7 +24,7 @@
const getComment = () => {
const runTwikoo = () => {
twikoo.getRecentComments({
envId: [[${ theme.config.comments.envId }]],
envId: [[${ theme.config.comments.twikoos.envId }]],
region: '',
pageSize: 6,
includeReply: true

View File

@ -72,7 +72,7 @@
<hr/>
<!-- 评论模块 -->
<th:block
th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
<div th:replace="~{modules/twikoo :: twikoo}"></div>
</th:block>
<div id="post-comment"

View File

@ -15,7 +15,7 @@
<hr>
<!-- 评论模块 -->
<th:block
th:if="${singlePage.spec.allowComment && theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
th:if="${singlePage.spec.allowComment && theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
<div th:replace="~{modules/twikoo :: twikoo}"></div>
</th:block>
<div id="post-comment"

View File

@ -274,7 +274,7 @@
<hr>
<!-- 评论模块 -->
<th:block
th:if="${post.spec.allowComment && theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
th:if="${post.spec.allowComment && theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
<div th:replace="~{modules/twikoo :: twikoo}"></div>
</th:block>
<div id="post-comment"