Merge pull request #71 from zsjy/dev

Dev
This commit is contained in:
宏尘 2025-03-15 19:13:58 +08:00 committed by GitHub
commit 74f59d8280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 442 additions and 186 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
.idea/
node_modules/
dist/
package-lock.json
package-lock.json
templates/assets/js/dshare.min.js.LICENSE.txt

View File

@ -1432,35 +1432,53 @@ spec:
- $formkit: attachment
name: security_link_site_img
if: $get(enable_security_link).value
label: 安全链接页面-站点图标
label: 安全链接页面-图标
placeholder: '请输入/选择安全链接页面站点的图标'
help: '请输入/选择安全链接页面站点的图标留空使用站点的favicon。'
- $formkit: attachment
name: security_link_site_img_background
if: $get(enable_security_link).value
label: 安全链接页面-背景图片
value: 'https://bing.ee123.net/img/'
placeholder: '请输入/选择安全链接页面的背景图片'
help: '请输入/选择安全链接页面的背景图片,留空不显示背景'
- $formkit: text
name: security_link_page_title
if: $get(enable_security_link).value
label: 安全链接页面-页面标题
value: '{title}-安全中心'
placeholder: '请输入安全链接页面的页面标题'
help: '请输入安全链接页面的页面标题,留空显示:“{title}-安全中心”,“ {title} ”表示站点主标题,位置为浏览器显示的标题。'
- $formkit: text
name: security_link_site_title
if: $get(enable_security_link).value
label: 安全链接页面-站点标题
value: '{title}'
placeholder: '请输入/选择安全链接页面站点的标题'
help: '请输入/选择安全链接页面站点的标题,留空不显示,“ {title} ”表示站点主标题。'
placeholder: '请输入安全链接页面站点的标题'
help: '请输入安全链接页面站点的标题,留空不显示,“ {title} ”表示站点主标题,位置为图标下方。'
- $formkit: text
name: security_link_url
label: 安全链接页面-URL
if: $get(enable_security_link).value
validation: required
placeholder: '请输入使用“安全链接页面模版”创建的页面访问路径'
help: '输入使用”安全链接页面模版“创建的页面访问路径,不能省略’/‘。'
- $formkit: attachment
name: security_link_tip_img
if: $get(enable_security_link).value
label: 安全链接页面-提示区域图标
placeholder: '请输入/选择安全链接页面提示区域的图标'
help: '输入/选择安全链接页面提示区域的图标,留空使用默认图标。'
- $formkit: text
help: '请输入使用”安全链接页面模版“创建的页面访问路径,不能省略’/‘。'
- $formkit: code
name: security_link_tip_desc
if: $get(enable_security_link).value
label: 安全链接页面-提示区域文本描述
language: html
height: 45px
placeholder: '请输入安全链接页面提示区域的文本描述'
help: '输入安全链接页面提示区域的文本描述,留空使用默认文本描述。'
help: '请输入安全链接页面提示区域的文本描述,留空使用默认:“请注意您的账号和财产安全!”。'
- $formkit: number
name: security_link_auto_jump_time
if: $get(enable_security_link).value
label: 安全链接页面-自动跳转时间
value: 5
validation: required
placeholder: '请输入安全链接页面自动跳转时间(秒)'
help: '输入安全链接页面自动跳转时间(秒)默认5秒小于等于0时关闭自动跳转。'
- $formkit: code
name: security_link_jump_desc
if: $get(enable_security_link).value
@ -1468,9 +1486,9 @@ spec:
label: 安全链接页面-跳转提示区域文本描述
language: html
height: 45px
value: '您即将离开<span>{title}</span>,去往:<span>{url}</span>'
value: '您即将离开{title},去往:{url}'
placeholder: '请输入安全链接页面跳转提示区域的文本描述'
help: '"<span></span>"包裹时字体颜色为主题色,“ {title} ”表示站点主标题,“ {url} ”表示跳转URL区分大小写。默认值“您即将离开<span>{title}</span>,去往:<span>{url}</span>”'
help: '“ {title} ”表示站点主标题,“ {url} ”表示跳转URL区分大小写。默认值“您即将离开{title},去往:{url}”'
- group: pwa
label: 'PWA配置'
formSchema:

View File

@ -1,133 +0,0 @@
@charset "utf-8";
// 移动设备最大宽度
@mobile-max-width: 768px;
// 平板最小宽度
@table-min-width: 769px;
// 笔记本电脑最小宽度
@laptop-min-width: 1024px;
// 桌面设备最小宽度
@desktop-min-width: 1216px;
// 显示器最小宽度
@display-min-width: 1700px;
// 宽屏设备最小宽度
@widescreen-min-width: 2200px;
html {
background-color: var(--bg-f);
color: var(--main);
font-family: "Dream Font", serif;
halo-contact-form-auto-loader, #live2d-plugin, #live2d-toggle {
display: none;
}
body {
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
@media (max-width: (@mobile-max-width - 1)) {
.content {
max-width: 90% !important;
min-width: auto !important;
.others-end {
justify-content: center !important;
}
}
}
.content {
max-width: 500px;
min-width: 360px;
margin-bottom: 10%;
&-title {
padding: 24px;
align-items: center;
display: flex;
justify-content: center;
img {
height: 3rem;
min-width: 3rem;
width: auto;
}
span {
font-size: 1.5rem;
margin-left: 10px;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.others {
padding: 24px;
border-radius: 15px;
border: var(--theme) solid 1px;
background-color: var(--background);
&-tip {
display: flex;
padding: 20px;
background-color: var(--theme);
align-items: center;
border-radius: 10px;
img {
height: 2rem;
width: 2rem;
}
span {
margin-left: 10px;
color: #fafafa;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
}
&-topic {
margin-top: 20px;
word-break: break-all;
span {
color: var(--theme);
}
}
&-end {
justify-content: flex-end;
margin-top: 20px;
display: flex;
a {
border-radius: 2rem;
width: 4rem;
padding: 5px;
text-align: center;
color: var(--theme);
border: var(--theme) solid 1px;
text-decoration: none;
}
}
}
}
}
}

View File

@ -559,11 +559,14 @@ const commonContext = {
if (!DreamConfig.enable_security_link || !DreamConfig.security_link_url || DreamConfig.security_link_url.length === 0) {
return
}
$(document).on('click', 'a[target=_blank]', (event) => {
event.preventDefault() // 防止链接默认行为,即打开新页面
$(document).on('click', 'a', (event) => {
var href = $(event.currentTarget).attr('href')
var hostname = window.location.hostname
// 判断是否为下载链接
const isDownloadLink = (url) => {
const downloadExtensions = ['.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.dmg', '.exe', '.msi', '.iso', '.apk']
return downloadExtensions.some(ext => url.toLowerCase().endsWith(ext))
}
const isInternalLink = (url, siteDomain) => {
// 将URL和站点域名转换为小写去除前导和尾随空格
url = url.toLowerCase().trim()
@ -581,9 +584,14 @@ const commonContext = {
// 对比URL和站点域名
return url.includes(siteDomain)
}
var tempwindow = window.open('_blank')
tempwindow.location = isInternalLink(href, hostname) ? href : (DreamConfig.security_link_url + '?target=' + encodeURIComponent(href))
if (isDownloadLink(href)) {
event.preventDefault()
// 如果是下载链接,直接跳转
window.open(href, '_blank')
} else if (!isInternalLink(href, hostname)) {
event.preventDefault()
window.open((DreamConfig.security_link_url + '?target=' + encodeURIComponent(href)), '_blank')
}
})
},
/* 灰色模式 */

View File

@ -1 +0,0 @@
@charset "utf-8";html{background-color:var(--bg-f);color:var(--main);font-family:"Dream Font",serif}html #live2d-plugin,html #live2d-toggle,html halo-contact-form-auto-loader{display:none}html body{width:100%;height:100%;overflow:hidden;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:absolute}@media (max-width:767px){html body .content{max-width:90%!important;min-width:auto!important}html body .content .others-end{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}}html body .content{max-width:500px;min-width:360px;margin-bottom:10%}html body .content-title{padding:24px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}html body .content-title img{height:3rem;min-width:3rem;width:auto}html body .content-title span{font-size:1.5rem;margin-left:10px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}html body .content .others{padding:24px;border-radius:15px;border:var(--theme) solid 1px;background-color:var(--background)}html body .content .others-tip,html body .content-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}html body .content .others-tip{padding:20px;background-color:var(--theme);border-radius:10px}html body .content .others-tip img{height:2rem;width:2rem}html body .content .others-tip span{margin-left:10px;color:#fafafa;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}html body .content .others-topic{margin-top:20px;word-break:break-all}html body .content .others-topic span{color:var(--theme)}html body .content .others-end{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;margin-top:20px;display:-webkit-box;display:-ms-flexbox;display:flex}html body .content .others-end a{border-radius:2rem;width:4rem;padding:5px;text-align:center;color:var(--theme);border:var(--theme) solid 1px;text-decoration:none}

File diff suppressed because one or more lines are too long

View File

@ -80,9 +80,7 @@
for (let time of custom_gray_mode_time_list) {
let type = time.realNode.time_span;
let desc = time.realNode.time_span_desc;
if (gray_mode_time_list.indexOf(type) === -1) {
gray_mode_time_list.push({time: type, desc: desc});
}
gray_mode_time_list.push({time: type, desc: desc});
}
}
DreamConfig["gray_mode_time_list"] = gray_mode_time_list;

View File

@ -7,36 +7,401 @@
contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)},
enableComment = false, isPost = false, canonical = ${theme.config.security_link_config.security_link_url}">
<head>
<meta charset="utf-8"/>
<title th:text="${title + (#strings.isEmpty(site.subtitle) ? '' : '|' + site.subtitle)}"></title>
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/theme.min.css(mew=${theme.spec.version})}">
<link th:if="${theme.config.enhance.cursor_style != 'none'}" rel="stylesheet" th:href="@{/assets/css/cursor.min.css(mew=${theme.spec.version})}">
<link data-pjax rel="preload stylesheet" as="style" th:href="@{/assets/css/security-link.min.css(mew=${theme.spec.version})}"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<th:block th:replace="~{common/config}"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow"/>
<title th:with="t = ${theme.config.security_link_config.security_link_page_title},
t1 = ${#strings.replace(t, '{title}', site.title)}"
th:text="${#strings.isEmpty(t) ? site.title + '-安全中心' : t1}">
</title>
<style type="text/css">
html {
--back-img-url: url([[${#strings.defaultString(theme.config.security_link_config.security_link_site_img_background, '')}]]);
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
overflow: hidden;
flex-direction: column;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
html.light body {
background-image: linear-gradient(135deg, #a0a0a0 0%, #8c8c8c 100%), var(--back-img-url);
background-blend-mode: overlay;
}
html.dark body {
background-image: linear-gradient(135deg, #364f6b 0%, #222831 100%), var(--back-img-url);
background-blend-mode: overlay;
}
html.light .loading {
background: rgba(255, 255, 255, 0.7);
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
border: 1px solid rgba(255, 255, 255, 0.18);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
html.light .others-tip {
background: rgba(255, 255, 255, 0.4);
border: 1px solid rgba(255, 255, 255, 0.3);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
}
html.dark .loading {
background: rgba(57, 62, 70, 0.6);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.08);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
html.dark .others-tip {
background: rgba(51, 51, 51, 0.4);
border: 1px solid rgba(255, 255, 255, 0.1);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
}
.others-end a {
background: rgba(63, 193, 201, 0.8);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(63, 193, 201, 0.2);
line-height: 20px;
}
.others-end a:hover {
background: rgba(63, 193, 201, 1);
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(63, 193, 201, 0.3);
}
.progress-bar {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.progress {
box-shadow: 0 0 10px rgba(171, 237, 216, 0.5);
}
@keyframes fadein {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.loading {
animation: fadein 0.3s ease-out;
}
html.light .others-topic,
html.light .others-tip,
html.light .content-title span {
color: #333;
}
html.light .others-tip {
border: 1px solid #ccc;
background-color: #F7F9FE;
}
html.light .progress {
background-color: #abedd8;
}
html.dark .loading {
background: #393e46;
box-shadow: 0 4px 8px rgba(100, 100, 100, 0.1);
}
html.dark .others-topic,
html.dark .others-tip,
html.dark .content-title span {
color: #EFEFEF;
}
html.dark .others-tip {
border: 1px solid #777;
background-color: #333;
}
html.dark .progress {
background-color: #888;
}
html.dark .progress-bar {
background-color: #444;
}
@media (max-width: 768px) {
.loading {
width: 75% !important;
max-width: 400px !important;
}
}
.loading {
text-align: center;
padding: 35px;
border-radius: 24px;
animation: fadein 0.3s ease-out;
width: 400px;
max-width: 90%;
border: 2px solid rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(25px);
-webkit-backdrop-filter: blur(25px);
box-shadow: 0 12px 40px rgba(31, 38, 135, 0.2);
position: relative;
}
.loading::before {
content: '';
position: absolute;
top: -6px;
left: -6px;
right: -6px;
bottom: -6px;
border-radius: 26px;
background: linear-gradient(145deg,
rgba(255,255,255,0.3) 0%,
rgba(255,255,255,0.1) 100%);
z-index: -1;
}
html.dark .loading {
border-color: rgba(255, 255, 255, 0.15);
background: rgba(57, 62, 70, 0.85);
}
html.dark .loading::before {
background: linear-gradient(145deg,
rgba(255,255,255,0.1) 0%,
rgba(255,255,255,0.05) 100%);
}
.content-title img {
width: 100px;
height: 100px;
border-radius: 50%;
margin: 0 auto 15px auto;
display: block;
border: 3px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}
.content-title img:hover {
transform: scale(1.05);
}
.others-tip {
font-size: 18px;
display: block;
margin-top: 5px;
margin-bottom: 25px;
padding: 20px;
border-radius: 12px;
border: 2px solid rgba(255, 255, 255, 0.3);
background: rgba(255, 255, 255, 0.6);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
color: #333;
}
html.dark .others-tip {
border-color: rgba(255, 255, 255, 0.15);
background: rgba(51, 51, 51, 0.6);
color: #EFEFEF;
}
.others-end a {
padding: 12px 24px;
border-radius: 20px;
font-size: 16px;
width: auto;
height: auto;
background: linear-gradient(135deg, #3fc1c9, #45b7d1);
color: white;
box-shadow: 0 4px 15px rgba(63, 193, 201, 0.3);
transition: all 0.3s ease;
}
.others-end a:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(63, 193, 201, 0.4);
}
.progress-bar {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.progress {
box-shadow: 0 0 10px rgba(171, 237, 216, 0.5);
}
.content-title {
margin-bottom: 20px;
font-size: 20px;
font-weight: bold;
}
.content-title img {
width: 100px;
height: 100px;
border-radius: 50%;
margin: 0 auto 15px auto;
display: block;
}
.others-topic {
margin-bottom: 10px;
font-size: 16px;
letter-spacing: 1px;
color: #333;
word-wrap: break-word;
white-space: pre-wrap;
overflow: hidden;
}
.others-tip {
font-size: 20px;
display: block;
margin-top: 5px;
margin-bottom: 25px;
padding: 15px;
border-radius: 8px;
border: 1px solid #ccc;
background-color: #F7F9FE;
color: #333;
}
.others-end {
display: flex;
justify-content: center;
gap: 20%;
margin-top: 20px;
}
.others-end a {
padding: 10px 20px;
border-radius: 16px;
border: none;
cursor: pointer;
font-size: 16px;
width: 70px;
height: 20px;
text-align: center;
text-decoration: none;
background-color: #3fc1c9;
color: white;
}
.progress-bar {
width: 100%;
border-radius: 5px;
overflow: hidden;
height: 10px;
margin-top: 20px;
}
.progress {
width: 0;
height: 100%;
background-color: #abedd8;
transition: width [[${theme.config.security_link_config.security_link_auto_jump_time}]]s linear;
}
.countdown-text {
margin-top: 12px;
font-size: 12px;
color: #333;
}
html.dark .countdown-text {
color: #EFEFEF;
}
</style>
</head>
<body>
<div class="content">
<div class="content-title">
<img th:src="${#strings.isEmpty(theme.config.security_link_config.security_link_site_img) ? site.favicon : theme.config.security_link_config.security_link_site_img}" alt="favicon">
<span th:if="${!#strings.isEmpty(theme.config.security_link_config.security_link_site_title)}"
th:with="t = ${theme.config.security_link_config.security_link_site_title},
t1 = ${#strings.replace(t, '{title}', site.title)}"
th:title="${t1}">[[${t1}]]</span>
</div>
<div class="others">
<div class="others-tip">
<img th:src="${#strings.isEmpty(theme.config.security_link_config.security_link_tip_img) ? #theme.assets('/img/warning.webp') : theme.config.security_link_config.security_link_tip_img}" alt="">
<span>[[${#strings.isEmpty(theme.config.security_link_config.security_link_tip_desc) ? '请注意您的账号和财产安全!': theme.config.security_link_config.security_link_tip_desc}]]</span>
<div class="loading">
<div class="content-title">
<img th:src="${#strings.isEmpty(theme.config.security_link_config.security_link_site_img) ? site.favicon : theme.config.security_link_config.security_link_site_img}" alt="favicon">
<span th:if="${!#strings.isEmpty(theme.config.security_link_config.security_link_site_title)}"
th:with="t = ${theme.config.security_link_config.security_link_site_title},
t1 = ${#strings.replace(t, '{title}', site.title)}"
th:text="${t1}"></span>
</div>
<div class="others-topic" th:with="oDesc = ${theme.config.security_link_config.security_link_jump_desc},
<div class="others">
<div class="others-tip" th:utext="${#strings.defaultString(theme.config.security_link_config.security_link_tip_desc, '请注意您的账号和财产安全!')}">
</div>
<div class="others-topic" th:with="oDesc = ${theme.config.security_link_config.security_link_jump_desc},
o1 = ${#strings.replace(oDesc, '{title}', site.title)},
o2 = ${#strings.replace(o1, '{url}', url)}" th:utext="${o2}">
</div>
<div class="others-end">
<a th:href="${url}" target="_self">继续</a>
</div>
<div class="progress-bar">
<div class="progress"></div>
</div>
<div class="countdown-text">
⚡将在<span id="countdown">[[${theme.config.security_link_config.security_link_auto_jump_time}]]</span>秒后跳转,请自行确认链接安全性
</div>
<div class="others-end">
<a th:href="${url}" target="_self">继续访问</a>
</div>
</div>
</div>
</div>
<script>
window.onload = function() {
let countdown = [[${theme.config.security_link_config.security_link_auto_jump_time}]]
if (countdown > 0) {
document.querySelector('.progress').style.width = '100%'
const countdownElement = document.getElementById('countdown')
const timer = setInterval(function () {
countdown--
countdownElement.textContent = countdown
if (countdown <= 0) {
clearInterval(timer)
window.location.href = '[[${url}]]'
}
}, 1000)
} else {
document.querySelector('.progress-bar').style.display = 'none';
document.querySelector('.countdown-text').style.display = 'none';
}
/** 配置主题模式 */
let default_theme = '[[${theme.config.basic_style.default_theme}]]';
const hasNightInLocal = () => localStorage.getItem('night') !== null;
const getNightInConfig = () => {
if (default_theme === 'night') {
return true;
}
if (default_theme === 'system') {
return matchMedia('(prefers-color-scheme: dark)').matches;
}
return false;
}
let isNight = hasNightInLocal() ? localStorage.getItem('night') : getNightInConfig();
document.documentElement.classList.add(isNight.toString() === 'true' ? 'dark' : 'light');
}
</script>
</body>
</html>

View File

@ -8,7 +8,7 @@ spec:
displayName: Dream2.0 Plus
author:
# 作者名称
name: 宏尘极客
name: 宏尘极客 && fishcpy
# 作者网址
website: https://www.hcjike.com
customTemplates:
@ -30,7 +30,7 @@ spec:
settingName: theme-dream2-plus-setting
configMapName: theme-dream2-plus-configMap
# 版本号
version: 1.4.1
version: 1.4.2.beta5
# 最低支持的 Halo 版本
require: ">=2.20.0"
# 许可