Files
home/js/config.js
hehh 978b618df2 refactor(config): 统一缓存键命名并优化主题设置逻辑
- 将缓存键名从带版本后缀的形式统一为无版本后缀
- 更新主题设置与读取逻辑,使用配置中心的缓存键定义
- 修正语言检测时对中文标识的判断逻辑
- 优化页面脚本加载顺序,确保配置文件优先加载
- 调整主题显示文本的中英文切换条件判断表达式
2025-12-04 19:30:57 +08:00

180 lines
5.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 配置文件 - 提取自各个JavaScript文件的关键配置
// 创建日期: 2025-11-20
const SiteConfig = {
// bj.js 配置
stars: {
count: 300,
refreshInterval: 50
},
// main.js 配置
animation: {
elementUp: {
delay: 0,
increment: 150
}
},
background: {
imagePaths: [
"/images/bj/1.webp",
"/images/bj/2.webp",
"/images/bj/3.webp",
"/images/bj/4.webp",
"/images/bj/5.webp",
"/images/bj/6.webp",
"/images/bj/7.webp"
]
},
hitokoto: {
apiUrl: 'https://v1.hitokoto.cn?c=c&c=d&c=i&c=k'
},
// about.js 配置
github: {
username: 'listener-He'
},
blog: {
rssUrl: 'https://blog.hehouhui.cn/api/rss'
},
// 通用缓存键与TTL毫秒
cacheKeys: {
github: { key: 'gh_data', ttlMs: 36000000 },
blog: { key: 'blog_data', ttlMs: 3600000 },
theme: { key: 'theme', ttlMs: 3600000 }
},
techStack: [
{ name: 'Java', category: 'core', weight: 5 },
{ name: 'Spring Boot', category: 'backend', weight: 5 },
{ name: 'JavaScript', category: 'frontend', weight: 5 },
{ name: 'Python', category: 'core', weight: 4 },
{ name: 'WebFlux', category: 'backend', weight: 5 },
{ name: 'Reactor', category: 'backend', weight: 5 },
{ name: 'TypeScript', category: 'frontend', weight: 4 },
{ name: 'Spring Cloud', category: 'backend', weight: 4 },
{ name: 'Go', category: 'core', weight: 3 },
{ name: 'MySQL', category: 'data', weight: 4 },
{ name: 'Redis', category: 'data', weight: 4 },
{ name: 'MongoDB', category: 'data', weight: 3 },
{ name: 'Docker', category: 'ops', weight: 4 },
{ name: 'Kubernetes', category: 'ops', weight: 3 },
{ name: 'OpenAI API', category: 'ai', weight: 3 },
{ name: 'LangChain', category: 'ai', weight: 3 },
{ name: 'TensorFlow', category: 'ai', weight: 2 },
{ name: 'PyTorch', category: 'ai', weight: 2 },
{ name: 'Elasticsearch', category: 'data', weight: 3 },
{ name: 'RabbitMQ', category: 'data', weight: 2 },
{ name: 'RocketMQ', category: 'data', weight: 2 },
{ name: 'Kafka', category: 'data', weight: 2 },
{ name: 'Jenkins', category: 'ops', weight: 3 },
{ name: 'Git', category: 'ops', weight: 4 },
{ name: 'Linux', category: 'ops', weight: 3 },
{ name: 'AWS', category: 'ops', weight: 2 },
{ name: 'Nginx', category: 'ops', weight: 2 },
{ name: 'Spring Security', category: 'backend', weight: 3 },
{ name: 'MyBatis', category: 'backend', weight: 3 },
{ name: 'JPA', category: 'backend', weight: 2 },
{ name: 'Dubbo', category: 'backend', weight: 2 },
{ name: 'Netty', category: 'backend', weight: 2 },
{ name: 'Transformers', category: 'ai', weight: 2 },
{ name: 'Scikit-learn', category: 'ai', weight: 2 },
{ name: 'Ollama', category: 'ai', weight: 1 },
{ name: 'Dify', category: 'ai', weight: 1 },
{ name: 'Spring AI', category: 'ai', weight: 1 },
{ name: 'ClickHouse', category: 'data', weight: 1 },
{ name: 'Postgresql', category: 'data', weight: 1 },
{ name: "Hexo", category: "frontend", weight: 5},
{ name: "NextJs", category: "frontend", weight: 1},
{ name: "HuggingFace", category: "ai", weight: 1},
{ name: "Vue", category: "frontend", weight: 3},
{ name: "React", category: "frontend", weight: 1},
{ name: "R2dbc", category: "data", weight: 1},
{ name: "Proto", category: "core", weight: 1},
{ name: "Mqtt", category: "core", weight: 2},
{ name: "Grpc", category: "core", weight: 1},
{ name: "Figma", category: "frontend", weight: 1}
],
// 默认数据当API或RSS不可用时使用
defaults: {
repos: [
{name: "yunxiao-LLM-reviewer", desc: "AI Code Reviewer based on LLM", stars: 9, url: "#"},
{name: "hexo-theme-stellar", desc: "Comprehensive Hexo theme", stars: 5, url: "#"},
{name: "Universal-IoT-Java", desc: "IoT Platform Demo", stars: 2, url: "#"}
],
posts: [
{title: "Vector Database Guide", date: "2025-01-02", cat: "Tech", url: "#"},
{title: "Spring Boot 3.0 Features", date: "2024-12-30", cat: "Java", url: "#"},
{title: "Microservices Patterns", date: "2024-12-28", cat: "Arch", url: "#"}
],
user: { repos: 165, followers: 6, created: "2018-05-14" }
},
socialCards: {
rings: [130, 180, 230],
goldenAngle: 137.5,
baseSpeed: 16
},
artalk: {
server: 'https://artalk.hehouhui.cn',
site: 'Honesty的主页',
placeholder: '来说点什么吧...',
noComment: '暂无评论',
sendBtn: '发送'
},
// 站点统计配置
analytics: {
busuanzi: {
src: '//cdn.busuanzi.cc/busuanzi/3.6.9/busuanzi.abbr.min.js',
site_pv_id: 'busuanzi_site_pv',
site_uv_id: 'busuanzi_site_uv',
formatter: true
},
baidu: {
src: 'https://hm.baidu.com/hm.js?ae2a009a75b13c21d5121ee51375ea4e',
id: 'ae2a009a75b13c21d5121ee51375ea4e'
},
google: {
src: 'https://www.googletagmanager.com/gtag/js',
id: 'G-DYWDEVKDP0'
},
tencent: {
src: 'https://sdk.51.la/js-sdk-pro.min.js',
id: '3OBGjwDdEIRS7XZ1',
ck: '3OBGjwDdEIRS7XZ1'
}
},
animationSettings: {
observerOptions: {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
},
itemObserverOptions: {
threshold: 0.15,
rootMargin: '0px 0px -20px 0px'
}
},
// 开发环境配置
dev: {
isLocal: (typeof location !== 'undefined') ? (location.hostname.indexOf('localhost') > -1 || location.hostname.indexOf('127.0.0.1') > -1) : false
}
};
// 导出配置
if (typeof module !== 'undefined' && module.exports) {
module.exports = SiteConfig;
} else if (typeof window !== 'undefined') {
window.SiteConfig = SiteConfig;
}