mirror of
https://github.com/Ad-closeNN/blog-fuwari.git
synced 2026-05-31 01:40:03 -04:00
docs(pages): 增加仓库信息页 /info/
2. feat(config): banner 使用 WebP 格式图片 3. style(config): search 搜索条长度固定 4. style(profile): 将个人档案 profile 中的提交记录改为 /info/ 5. chore(profile): 将 profile 电子邮箱地址改为 admin@adclosenn.top 6. style(config): 删除了顶部 Nav 的 主页 7. docs(pages): about 关于页面更新 2025/8/16 8. style(css): 加入专对于代码框的字体 JetBrainsMono-VF 9. fix(config): 解决misans.astro 文件中的解释 description 被定义为了 I18nKey.about 关于 的问题 10. fix(config): 修复网易云音乐音乐外链挂件未使用 https 的问题
This commit is contained in:
@@ -46,6 +46,9 @@ Discord:https://discord.com/users/1068060784300658688
|
||||
|
||||
---
|
||||
|
||||
# 2025/8/16
|
||||
因为 SVG 格式在没有 HarmonyOS Sans SC 字体的情况下无法正常显示这个字体(会显示为浏览器默认中文字体),所以本站使用 WebP 格式的 banner,大小 70.02 KB,相比 PNG 格式的 279.65 KB 减少了许多。
|
||||
|
||||
# 2025/8/14
|
||||
用上了大佬插件 [@rehypejs/rehype-external-links](https://www.npmjs.com/package/rehype-external-links) ,这个插件可以让仅 Markdown 文件里面定义的链接以 `target="_blank` 的形式构建。也就是通过这个插件构建出来的超链接,点击后是通过新标签页打开的。而原来原版是直接在博客里,通过覆盖你正在阅读的文章来打开链接。
|
||||
可以试试点这两个链接进行比对: [更改后](https://www.bing.com) | <a href="https://www.bing.com">更改前</a>
|
||||
@@ -65,9 +68,10 @@ the error log is like driving with your eyes closed.
|
||||
—— Apache 官方文档 Getting Started 篇章
|
||||
```
|
||||
|
||||
除此之外,我在 `/public/` 中留了 3 个 banner 文件:
|
||||
- [/public/assets/apache_carbon.svg](/assets/apache_carbon.svg) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`SVG` 格式(本站使用中)。 
|
||||
除此之外,我在 `/public/` 中留了 4 个 banner 文件:
|
||||
- [/public/assets/apache_carbon.svg](/assets/apache_carbon.svg) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`SVG` 格式。 
|
||||
- [/public/assets/apache_carbon.png](/assets/apache_carbon.png) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`PNG` 格式。
|
||||
- [/public/assets/apache_carbon.webp](/assets/apache_carbon.webp) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`WebP` 格式。(本站使用中)
|
||||
- [/public/assets/apache.jpg](/assets/apache.jpg):网传的图片 
|
||||
|
||||
和一个 `JSON` 文件:
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
# 信息/提交记录
|
||||
## 概览
|
||||
**当前提交:**
|
||||
<span>
|
||||
<a id="github-commit-link2" href="#" target="_blank">
|
||||
<span id="github-commit2">加载中...</span>
|
||||
</a>
|
||||
</span>
|
||||
<br>
|
||||
提交哈希:<code id="github-commit-full-hash">加载中...</code>
|
||||
<br>
|
||||
提交者:
|
||||
<span>
|
||||
<a id="github-commit-author-link" href="#" target="_blank">
|
||||
<span id="github-commit-author">加载中...</span>
|
||||
</a>
|
||||
</span>
|
||||
<br>
|
||||
提交日期:<span id="github-commit-date">加载中...</span>
|
||||
<br>
|
||||
提交详情:
|
||||
<pre id="github-commit-message">加载中...</pre>
|
||||
|
||||
## 完整提交记录
|
||||
<pre id="github-commit-full">加载中...</pre>
|
||||
|
||||
|
||||
<script>
|
||||
async function loadCommitStats2() {
|
||||
try {
|
||||
// 第零步:检查域名(甚至本地)
|
||||
const statsElement = document.getElementById('github-commit2'); // 查找 id
|
||||
const link = document.getElementById('github-commit-link2'); // 查找 id
|
||||
|
||||
const hashElement = document.getElementById('github-commit-hash'); // 查找 id
|
||||
const fullHashElement = document.getElementById('github-commit-full-hash'); // 查找 id
|
||||
const messageElement = document.getElementById('github-commit-message'); // 查找 id
|
||||
const authorElement = document.getElementById('github-commit-author'); // 查找 id
|
||||
const dateElement = document.getElementById('github-commit-date'); // 查找 id
|
||||
const urlElement = document.getElementById('github-commit-url'); // 查找 id
|
||||
const authorElementUrl = document.getElementById('github-commit-author-link'); // 查找 id
|
||||
const fullElement = document.getElementById('github-commit-full'); // 查找 id
|
||||
|
||||
if (!window.location.hostname.includes('localhost') && !window.location.hostname.includes('adclosenn.top')) {
|
||||
statsElement.textContent = 'Err. invalid domain name';
|
||||
}
|
||||
// 第一步:调用 API
|
||||
const githubResponse = await fetch(`https://api.adclosenn.top/.netlify/functions/commit`);
|
||||
|
||||
if (!githubResponse.ok) {
|
||||
throw new Error('获取信息失败');
|
||||
}
|
||||
|
||||
const Data = await githubResponse.json();
|
||||
|
||||
// 第二步:获取 Commit 数据
|
||||
const latestCommit = Data
|
||||
|
||||
const commitData = {
|
||||
hash: latestCommit.sha.slice(0, 7),
|
||||
fullHash: latestCommit.sha,
|
||||
message: latestCommit.commit.message.split('\n')[0],
|
||||
author: latestCommit.commit.author.name,
|
||||
date: latestCommit.commit.author.date,
|
||||
url: latestCommit.html_url
|
||||
};
|
||||
|
||||
|
||||
if (statsElement) {
|
||||
statsElement.textContent = `${Data.sha.slice(0,7)}`;
|
||||
}
|
||||
|
||||
if (hashElement) {
|
||||
hashElement.textContent = commitData.hash;
|
||||
}
|
||||
|
||||
if (fullHashElement) {
|
||||
fullHashElement.textContent = commitData.fullHash;
|
||||
}
|
||||
if (messageElement) {
|
||||
messageElement.textContent = "1. " + Data.commit.message.replace('\n\n', '\n');
|
||||
}
|
||||
if (authorElement) {
|
||||
authorElement.textContent = commitData.author;
|
||||
}
|
||||
if (authorElementUrl) {
|
||||
authorElementUrl.href = "https://github.com/"+commitData.author;
|
||||
authorElementUrl.title = "查看提交者 "+commitData.author;
|
||||
}
|
||||
|
||||
function convertToUTC8(utcTimeString) {
|
||||
const date = new Date(utcTimeString);
|
||||
|
||||
// 明确指定时区为 Asia/Shanghai (UTC+8)
|
||||
return date.toLocaleString("zh-CN", {
|
||||
timeZone: "Asia/Shanghai", // 强制使用 UTC+8 时区
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
hour12: false
|
||||
});
|
||||
}
|
||||
|
||||
if (dateElement) {
|
||||
dateElement.textContent = convertToUTC8(commitData.date) + " " + "(UTC+8:00)";
|
||||
}
|
||||
if (urlElement) {
|
||||
urlElement.textContent = commitData.url;
|
||||
}
|
||||
|
||||
if (fullElement) {
|
||||
fullElement.textContent = JSON.stringify(Data, null, 2);
|
||||
}
|
||||
|
||||
if (link){
|
||||
const gurl = "https://github.com/Ad-closeNN/blog-fuwari/commit/"+Data.sha;
|
||||
link.href = gurl;
|
||||
link.title = "("+Data.commit.committer.date + ")" + " " + Data.commit.message;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取 Commit 信息失败:', error);
|
||||
const statsElement = document.getElementById('github-commit2');
|
||||
if (statsElement) {
|
||||
statsElement.textContent = '提交信息不可用';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 页面加载完成后获取 Commit 数据
|
||||
addEventListener('DOMContentLoaded', loadCommitStats2);
|
||||
// 页面加载完成后获取 Commit 数据
|
||||
function initCommitStats() {
|
||||
// 检查是否在 info 页面
|
||||
if (window.location.pathname === '/info/') {
|
||||
loadCommitStats2();
|
||||
}
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initCommitStats);
|
||||
} else {
|
||||
initCommitStats();
|
||||
}
|
||||
|
||||
// Swup 页面跳转后重新执行
|
||||
if (window.swup) {
|
||||
window.swup.hooks.on('page:view', initCommitStats);
|
||||
} else {
|
||||
document.addEventListener('swup:enable', () => {
|
||||
window.swup.hooks.on('page:view', initCommitStats);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</MainGridLayout>
|
||||
Reference in New Issue
Block a user