first commit
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
2025-12-15 18:34:24 +08:00
commit 2526e27867
38 changed files with 1771 additions and 0 deletions

3
app/404.md Normal file
View File

@@ -0,0 +1,3 @@
---
layout: 404
---

281
app/_config.async.yml Normal file
View File

@@ -0,0 +1,281 @@
# 默认主题配置, 开启切换主题功能
theme:
switch: true
default: style-dark # style-light style-dark
# 网站图标 Favicon
favicon:
logo: /img/favicon-default.png
icon16: /img/favicon-default.png
icon32: /img/favicon-default.png
apple_touch_icon: /img/favicon-default.png
webmanifest: /site.webmanifest
visibilitychange: true
hidden: /img/favicon-circle.png
show_text: 欢迎光临
hide_text: 不要走~
# 字体图标 Icon
assets:
third_party_provider: https://npm.elemecdn.com
icons:
type: symbol
css:
js: //at.alicdn.com/t/c/font_3637590_i4hyyea14ur.js
# 用户信息 User
user:
name: Offends
first_name:
last_name:
email: offends4@163.com
domain: https://blog.offends.cn
avatar: /img/avatar.png
describe: 欢迎您发现此网站,希望你能在这找到共鸣,收获知识与快乐。
rule_text: 需要HTTPS协议并保证您的网站内容健康。
# 导航栏 TopBars
top_bars:
- title: 首页
url: /
- title: 分类
url: /categories/
- title: 其它
url: '#'
children:
- title: 关于
url: /about/
- title: 留言
url: /comment/
- title: 友链
url: /links/
# 侧栏 Sidebar
sidebar:
social:
- name: github
icon: icon-github
url: https://github.com/dinghui40
- name: gitee
icon: icon-gitee
url: https://gitee.com/offends
# 打字动画
typed_text_prefix: [' ']
typed_text: [ 'I`m Ding Hui','欢迎回来']
info:
- key: 地址
val: 银河系
- key: 年龄
val: 不清楚
- key: 实力
val: 上升期
# - key: <div><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=260 height=86 src="//music.163.com/outchain/player?type=2&id=466808591&auto=0&height=66"></iframe></div>
# 横幅 Banner
banner:
use_cover: false
default:
type: img
bgurl: /img/index-background.png
banner_text:
position: top
fit: cover
index:
banner_title: 业精于勤,荒于嬉。
bannerText: Hi my new friend!
archive:
banner_title: 积土而为山,积水而为海。
bannerText: Hi my new friend!
about:
banner_title: 四顾山光接水光,<br>凭栏十里芰荷香。
bannerText: Hi my new friend!
comment:
banner_title: 天下兴亡,咱们有责,嘿嘿。
bannerText: Hi my new friend!
links:
banner_title: 渚寒烟淡,棹移人远,飘渺行舟如叶。
bannerText: Hi my new friend!
# 页脚 Footer
footer:
# 起始年份
copyrightYear: 2020
# 显示框架
powered:
enable: true
# 显示备案号
beian:
enable: true
icp: 京ICP备2022021046号
# 运行时间
live_time:
enable: true
prefix: footer.tips
start_time: 01/3/2022 00:00:00
# 其他信息
custom_text: <a href="https://beian.mps.gov.cn/#/query/webSearch" rel="noopener" target="_blank">京公网安备11010502052505号</a>
# 打赏 Reward
reward:
enable: true
comment: 要是这篇文章为您解了惑、带来了帮助,不妨用小小的打赏来支持下我的创作吧,您的鼓励就是我持续分享的最大动力哦,感谢您啦!
methods:
- name: 支付宝
path: /img/zfb.png
- name: 微信
path: /img/wx.png
# 文章目录
toc:
enable: true
list_number: true
post_title: true
max_depth: 3
min_depth: 1
# 图片懒加载
lazyload:
enable: true
# 归档页
archive:
type: less
# 版权信息
creative_commons:
license: by-nc-sa
language: deed.zh
post: true
clipboard: false
# 自定义封面图
cover:
default: /img/cover-background.png
type: img
# 上下篇文章
post_pagination:
enable: true
type: small
# 文章过期提醒
notice_outdate:
enable: true
style: flat
limit_day: 365
position: top
# 文章破图时默认图片
error_img:
flink: /img/404.gif
post_page: /img/404.jpg
# 分类卡片
categorie_card:
enable: true
len: 2
list: ["已完成", "待验证"]
# 固定按钮块
rightside:
readmode: true
aside: true
# 日期格式化 Date Format
datetime_foramt:
post_card:
date: YY/MM/DD
time: HH:mm
post_info:
type: updated
date: MM/DD
time: HH:mm
archive:
date: MM/DD
time: HH:mm
# 代码高亮 Highlight
highlight:
theme: true
title: mac
copy: true
lang: true
code_word_wrap: true
height_limit: 200 # 超出时,显示折叠按钮
# 自定义图标 Icon
icons:
# 主题切换图标
sun: icon-sun
moon: icon-moon
# 首页视频播放
play: icon-yunhang
# 邮箱
email: icon-email
# 分类进入图标
next: icon-arrow-right
# 文章详情 日期
calendar: icon-rili
# 文章详情 时间
clock: icon-shijian
# 文章详情 作者
user: icon-yonghu
# 返回顶部 v1.1.3+
back_top: icon-backtop
# 查询 v1.1.5+
search: icon-chaxun
# 关闭 v1.1.5+
close: icon-guanbi
# 打赏 v1.1.7+
reward: icon-qiandai
# 用户信息和文章目录切换 v1.2.10+
user_tag: icon-yonghu1
toc_tag: icon-liebiao
# 右下角固定按钮 v1.2.11+
read: icon-yuedu
arrows: icon-arrows-h
# 代码块
double_arrows: icon-angle-double-down
copy: icon-copy
# 关于 About
about:
insert: none # 插入规则 before插入在内容前 | after插入在内容后 | none不插入
title: 温故而知新,可以为师矣。
introduction: 大家好,我是 Offends很高兴您能在浩瀚如烟的互联网世界里发现这个博客更感谢您能够饶有兴致地浏览这个页面。建立这个 Blog 是出于兴趣爱好,我将在此分会分享一些学习笔记,可能还会分享少许图片、视频以及其他有趣东西的链接。
blog:
<ul class="trm-list">
<li>程序Hexo </li>
<li>主题Hexo-theme-async </li>
</ul>
privacy: 本网站不会追踪访客行为,且不要求访客提供任何敏感信息(比如真实姓名、身份证号码、手机号等),因而也不存在任何隐私泄漏问题。访客参与评论,必须遵守法律法规和基本道德规范,文明礼貌。严禁发布任何有关淫秽、反动、暴力、博彩、恐吓、低俗的内容或违法信息,在尊重言论自由的同时请保持和平与理性。请勿对他人采取不友好的评论或其它过激行为。
# 评论 Comment
comment:
twikoo:
enable: true
envId: https://blog.offends.cn/twikoo
# 本地搜索
search:
enable: true
type: local
# 百度自动推送
baidu_push: true
# 字数统计
wordcount:
enable: true
count: true
time: true
# 数学公式
katex:
copy_tex: true
global: false
options: {}
# 渐入式应用
sw: true

88
app/autoload.js Normal file
View File

@@ -0,0 +1,88 @@
/*!
* Live2D Widget
* https://github.com/stevenjoezhang/live2d-widget
*/
// Recommended to use absolute path for live2d_path parameter
// live2d_path 参数建议使用绝对路径
// const live2d_path = 'https://fastly.jsdelivr.net/npm/live2d-widgets@1.0.0-rc.6/dist/';
const live2d_path = '/live2d-widget/dist/';
// Method to encapsulate asynchronous resource loading
// 封装异步加载资源的方法
function loadExternalResource(url, type) {
return new Promise((resolve, reject) => {
let tag;
if (type === 'css') {
tag = document.createElement('link');
tag.rel = 'stylesheet';
tag.href = url;
}
else if (type === 'js') {
tag = document.createElement('script');
tag.type = 'module';
tag.src = url;
}
if (tag) {
tag.onload = () => resolve(url);
tag.onerror = () => reject(url);
document.head.appendChild(tag);
}
});
}
(async () => {
// If you are concerned about display issues on mobile devices, you can use screen.width to determine whether to load
// 如果担心手机上显示效果不佳,可以根据屏幕宽度来判断是否加载
// if (screen.width < 768) return;
// Avoid cross-origin issues with image resources
// 避免图片资源跨域问题
const OriginalImage = window.Image;
window.Image = function(...args) {
const img = new OriginalImage(...args);
img.crossOrigin = "anonymous";
return img;
};
window.Image.prototype = OriginalImage.prototype;
// Load waifu.css and waifu-tips.js
// 加载 waifu.css 和 waifu-tips.js
await Promise.all([
loadExternalResource(live2d_path + 'waifu.css', 'css'),
loadExternalResource(live2d_path + 'waifu-tips.js', 'js')
]);
// For detailed usage of configuration options, see README.en.md
// 配置选项的具体用法见 README.md
initWidget({
waifuPath: live2d_path + 'waifu-tips.json',
// cdnPath: 'https://fastly.jsdelivr.net/gh/fghrsh/live2d_api/',
cubism2Path: live2d_path + 'live2d.min.js',
cubism5Path: 'https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js',
tools: ['hitokoto', 'asteroids', 'switch-model', 'switch-texture', 'photo', 'info', 'quit'],
logLevel: 'warn',
drag: false,
});
})();
console.log(`\n%cLive2D%cWidget%c\n`, 'padding: 8px; background: #cd3e45; font-weight: bold; font-size: large; color: white;', 'padding: 8px; background: #ff5450; font-size: large; color: #eee;', '');
/*
く__,.ヘヽ. / ,ー、 〉
', !-─‐-i / /´
/`ー' L//`ヽ、
/ , /| , , ',
イ / /-/ L_ ハ ヽ! i
レ ヘ 7イト レ'ァ-ト、!ハ| |
!,/7 '0' ´0iソ| |
|.从" _ ,,,, / |./ |
レ'| i.、,,__ _,.イ / .i |
レ'| | / k__/レ'ヽ, ハ. |
| |/i 〈|/ i ,.ヘ | i |
.|/ / ヘ! |
kヽ>、ハ _,.ヘ、 /、!
!'〈//´', '7'ーr'
レ'ヽL__|___i,___,ンレ|
ト-,/ |___./
'ー' !_,.:
*/

16
app/index.less Normal file
View File

@@ -0,0 +1,16 @@
.var-primary(@primary: #afb42b; @primary-weak: #c0ca33) {
--primary : @primary;
--primary-70 : fade(@primary, 70%);
--primary-50 : fade(@primary, 50%);
--primary-30 : fade(@primary, 30%);
--primary-weak : @primary-weak;
--primary-weak-50: fade(@primary-weak, 50%);
}
:root {
.var-primary(#5a5df0, #697be2);
&.dark {
.var-primary(#a4ce60, #82df7a);
}
}

184
app/init.sh Normal file
View File

@@ -0,0 +1,184 @@
#!/bin/bash
#############################################################################################
# 用途: Hexo-Async-Deployer 项目初始化脚本
# 作者: 丁辉
# 编写日期: 2021-10-1
# 更新日期: 2025-12-13
#############################################################################################
# 加载检测脚本
source <(curl -sS https://gitee.com/offends/Linux/raw/main/File/Shell/Check_command.sh)
# 修改默认 _config.yml 文件
function MODIFY_DEFAULT_FILE(){
SEND_INFO "正在修改 Hexo 基础配置"
# 修改语言
sed -i "s#language: en#language: zh-Hans#g" /hexo/_config.yml
# 修改作者
sed -i "s#author: John Doe#author: Offends#g" /hexo/_config.yml
# 修改网址
sed -i "s#url: http://example.com#url: https://blog.offends.cn#g" /hexo/_config.yml
}
# 初始化图片
function INIT_IMAGE() {
SEND_INFO "正在拉取站点图片资源"
CHECK_DIR /hexo/source/img/
# 存储地址
MINIO_URL="https://minio.offends.cn:9000/offends/hexo-async"
IMAGE_NAME=(
"avatar.png"
"favicon-default.png"
"favicon-circle.png"
"index-background.png"
"cover-background.png"
"wx.png"
"zfb.png"
"404.gif"
"404.jpg"
"md.png"
)
# 循环下载页面
for NAME in ${IMAGE_NAME[@]}; do
CHECK_COMMAND_NULL curl -so /hexo/source/img/$NAME $MINIO_URL/$NAME
done
# 预防控制台报错
cp /hexo/source/img/favicon-default.png /hexo/source/img/favicon-16x16.png
}
# 初始化页面
function INIT_PAGE() {
SEND_INFO "正在创建栏目页面"
# 分类
CHECK_COMMAND_NULL npm install hexo-generator-category
# 页面名称
PAGE_NAME=(
"categories"
"about"
"comment"
"links"
)
# 循环创建页面
for NAME in ${PAGE_NAME[@]}; do
# 创建页面
CHECK_COMMAND_NULL hexo new page $NAME
if [ $? -eq 0 ]; then
# 创建页面成功
SEND_INFO "创建页面 $NAME 成功"
else
# 创建页面失败
SEND_WARN "创建页面 $NAME 失败"
fi
done
# 初始化名称
sed -i 's#title: links#title: 友情链接#g' /hexo/source/links/index.md
sed -i 's#title: about#title: 关于#g' /hexo/source/about/index.md
sed -i 's#title: comment#title: 留言#g' /hexo/source/comment/index.md
sed -i 's#title: categories#title: 分类#g' /hexo/source/categories/index.md
# 初始功能特性
sed -i '3a\layout: links' /hexo/source/links/index.md
sed -i '3a\layout: about' /hexo/source/about/index.md
sed -i '3a\layout: comment' /hexo/source/comment/index.md
sed -i '3a\layout: category' /hexo/source/categories/index.md
# 初始化单栏显示详情页
sed -i '4a\single_column: false' /hexo/source/about/index.md
sed -i '4a\single_column: true' /hexo/source/categories/index.md
# 初始化关闭特定页面评论功能
sed -i '5a\comments: false' /hexo/source/about/index.md
sed -i '5a\comments: false' /hexo/source/categories/index.md
}
# 初始化 Async 文件
function INIT_BASE_INFO() {
SEND_INFO "正在初始化友情链接"
CHECK_DIR /hexo/source/_data/
CHECK_COMMAND_NULL mv /app/links.yml /hexo/source/_data/links.yml
SEND_INFO "正在初始本地搜索引擎"
CHECK_COMMAND_NULL npm install hexo-generator-searchdb
SEND_INFO "正在初始本地数字统计引擎"
CHECK_COMMAND_NULL npm install hexo-wordcount
SEND_INFO "正在初始化关键配置"
CHECK_COMMAND_NULL mv /app/_config.async.yml /hexo/_config.async.yml
CHECK_COMMAND_NULL mv /app/404.md /hexo/source/404.md
CHECK_COMMAND_NULL mv /app/site.webmanifest /hexo/source/site.webmanifest
CHECK_DIR /hexo/source/_data/style/
CHECK_COMMAND_NULL mv /app/index.less /hexo/source/_data/style/index.less
}
# 初始化收录配置
function INIT_BAIDU_SITEMAP() {
SEND_INFO "正在初始化收录配置"
################################## 百度Sitemap 和 Google Sitemap ##################################
CHECK_COMMAND_NULL npm install hexo-generator-sitemap
CHECK_COMMAND_NULL npm install hexo-generator-baidu-sitemap
sed -i '/^url:/ {N; s/\n/\nroot: \/\n/;}' /hexo/_config.yml
sed -i 's/permalink: :year\/:month\/:day\/:title\//permalink: :title.html/' /hexo/_config.yml
cat << EOF >> /hexo/_config.yml
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xml
EOF
sed -i '1i<meta name="google-site-verification" content="V1iIzgHls93z_BAPofTvRD8jwh01u4Ls0fqXgGo86Ro" />' /hexo/node_modules/hexo-theme-async/layout/_partial/head.ejs
sed -i '1i<meta name="baidu-site-verification" content="codeva-MZXYU3JS1x" />' /hexo/node_modules/hexo-theme-async/layout/_partial/head.ejs
################################## 百度主动推送 ##################################
CHECK_COMMAND_NULL npm install hexo-baidu-url-submit
sed -i '/deploy:/!b;n;s/ type: \x27\x27/- type: baidu_url_submitter/' /hexo/_config.yml
cat << EOF >> /hexo/_config.yml
baidu_url_submit:
count: 200
host: blog.offends.cn
token: CRBfMzmp8EjAnQCl
path: baidu_urls.txt
EOF
}
# 添加看板娘
function ADD_TOUCH_ICON() {
SEND_INFO "添加看板娘"
git clone https://githubfast.com/stevenjoezhang/live2d-widget.git /hexo/node_modules/hexo-theme-async/source/live2d-widget
# 清理无用文件
IMAGE_NAME=(
".git"
".gitignore"
".github"
"README.en.md"
"README.md"
"LICENSE"
)
# 循环下载页面
for NAME in ${IMAGE_NAME[@]}; do
rm -rf /hexo/node_modules/hexo-theme-async/source/live2d-widget/$NAME
done
# 配置看板娘
sed -i '1i<script src="/live2d-widget/dist/autoload.js"></script>' /hexo/node_modules/hexo-theme-async/layout/_partial/head.ejs
# 配置本地话
mv /app/autoload.js /hexo/node_modules/hexo-theme-async/source/live2d-widget/dist/autoload.js
# 修改看板娘层级
sed -i 's/z-index: 1;/z-index: 9999;/g' /hexo/node_modules/hexo-theme-async/source/live2d-widget/dist/waifu.css
}
# 音乐位置 : 符号去除
# function INIT_MUSIC() {
# sed -i 's/<%- __(item.key) %>:/<%- __(item.key) %>/g' /hexo/node_modules/hexo-theme-async/layout/_partial/sidebar/card/info.ejs
# }
# 执行全部初始化
function INIT_ALL() {
# 修改默认 _config.yml 文件
MODIFY_DEFAULT_FILE
# 初始化图片
INIT_IMAGE
# 初始化页面
INIT_PAGE
# 初始化 Async 文件
INIT_BASE_INFO
# 初始化收录配置
INIT_BAIDU_SITEMAP
# 添加看板娘
ADD_TOUCH_ICON
}
INIT_ALL

3
app/languages.yml Normal file
View File

@@ -0,0 +1,3 @@
zh-Hans:
site:
title: 本站信息

12
app/links.yml Normal file
View File

@@ -0,0 +1,12 @@
- name: 白云苍狗
url: https://www.imalun.com
image: https://www.imalun.com/images/avatar.jpg?v=1
desc: 醒,亦在人间;梦,亦在人间。
- name: JinhongCAI
url: https://jinhongcai.work
image: https://jinhongcai.work/img/icon.jpg
desc: IT + AI + ROBOTICS
- name: 慢慢懂の分享站
url: https://blog.manmandong.top
image: https://blog.manmandong.top/usr/uploads/2024/09/4006404265.jpg
desc: 记录,分享。

20
app/site.webmanifest Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "Offends",
"short_name": "Offends",
"icons": [
{
"src": "/img/favicon-16x16.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/img/favicon-32x32.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#fff",
"background_color": "#fff",
"display": "standalone",
"start_url": "/"
}