mirror of
https://github.com/Mabbs/mabbs.github.io
synced 2026-06-02 04:58:34 +00:00
Compare commits
42 Commits
03a2f1fdf9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
556e27c9ad | ||
|
|
5a4baf5f4b | ||
|
|
71d493c2a8 | ||
|
|
156f964333 | ||
|
|
481df19596 | ||
|
|
1a529143a8 | ||
|
|
b25a864ee3 | ||
|
|
c5ad917d9e | ||
|
|
d6274791a8 | ||
|
|
111dc1e25f | ||
|
|
c4ae25dcb1 | ||
|
|
862bffac80 | ||
|
|
c888a89f41 | ||
|
|
b48e93890c | ||
|
|
f6b35814b1 | ||
|
|
fe26e4f6c3 | ||
|
|
45f1183f9a | ||
|
|
dd1141d872 | ||
|
|
c0ca105edc | ||
|
|
bc45ef27b8 | ||
|
|
47f623b8eb | ||
|
|
33122e34b5 | ||
|
|
100d3405f7 | ||
|
|
a7ff7c2c37 | ||
|
|
47e04279d0 | ||
|
|
cd478c22a2 | ||
|
|
e094b6d205 | ||
|
|
e8653b0efd | ||
|
|
e516a5d08c | ||
|
|
cf76264bb0 | ||
|
|
0a7608b3f0 | ||
|
|
5fd8d2fe0f | ||
|
|
c9dfb10733 | ||
|
|
23fff44d79 | ||
|
|
6630ba964b | ||
|
|
00aec9bad0 | ||
|
|
2ab6982684 | ||
|
|
172882a99e | ||
|
|
d69f175fee | ||
|
|
9760f9eb4d | ||
|
|
1553183d31 | ||
|
|
0ad9008f3e |
@@ -22,6 +22,8 @@ if (!norunFlag) {
|
|||||||
var sleepTimer_ = null;
|
var sleepTimer_ = null;
|
||||||
var AITalkFlag = false;
|
var AITalkFlag = false;
|
||||||
var talkNum = 0;
|
var talkNum = 0;
|
||||||
|
// 暴露到全局,供 pjax.js 在页面切换后重新调用
|
||||||
|
window._live2d = { initTips: null, showMessage: null, showHitokoto: null };
|
||||||
(function () {
|
(function () {
|
||||||
function renderTip(template, context) {
|
function renderTip(template, context) {
|
||||||
var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g;
|
var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g;
|
||||||
@@ -33,11 +35,11 @@ if (!norunFlag) {
|
|||||||
var currentObject = context;
|
var currentObject = context;
|
||||||
var i, length, variable;
|
var i, length, variable;
|
||||||
for (i = 0, length = variables.length; i < length; ++i) {
|
for (i = 0, length = variables.length; i < length; ++i) {
|
||||||
variable = variables[i];
|
variable = currentObject[variables[i]];
|
||||||
currentObject = currentObject[variable];
|
if (variable === undefined || variable === null) return '';
|
||||||
if (currentObject === undefined || currentObject === null) return '';
|
currentObject = variable;
|
||||||
}
|
}
|
||||||
return currentObject;
|
return String(currentObject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,14 +58,20 @@ if (!norunFlag) {
|
|||||||
showMessage('你都复制了些什么呀,转载要记得加上出处哦~~', 5000);
|
showMessage('你都复制了些什么呀,转载要记得加上出处哦~~', 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 缓存 message.json 数据,供 PJAX 重绑定使用
|
||||||
|
var tipsData = null;
|
||||||
|
|
||||||
function initTips() {
|
function initTips() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: true,
|
cache: true,
|
||||||
url: message_Path + 'message.json',
|
url: message_Path + 'message.json',
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
tipsData = result;
|
||||||
|
// 解绑旧事件(用命名空间避免影响其他绑定)
|
||||||
$.each(result.mouseover, function (index, tips) {
|
$.each(result.mouseover, function (index, tips) {
|
||||||
$(tips.selector).mouseover(function () {
|
$(tips.selector).off('mouseover._live2d_tips mouseout._live2d_tips');
|
||||||
|
$(tips.selector).on('mouseover._live2d_tips', function () {
|
||||||
var text = tips.text;
|
var text = tips.text;
|
||||||
if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1];
|
if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1];
|
||||||
text = text.renderTip({ text: $(this).text() });
|
text = text.renderTip({ text: $(this).text() });
|
||||||
@@ -72,7 +80,7 @@ if (!norunFlag) {
|
|||||||
clearInterval(liveTlakTimer);
|
clearInterval(liveTlakTimer);
|
||||||
liveTlakTimer = null;
|
liveTlakTimer = null;
|
||||||
});
|
});
|
||||||
$(tips.selector).mouseout(function () {
|
$(tips.selector).on('mouseout._live2d_tips', function () {
|
||||||
showHitokoto();
|
showHitokoto();
|
||||||
if (liveTlakTimer == null) {
|
if (liveTlakTimer == null) {
|
||||||
liveTlakTimer = window.setInterval(function () {
|
liveTlakTimer = window.setInterval(function () {
|
||||||
@@ -82,7 +90,8 @@ if (!norunFlag) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
$.each(result.click, function (index, tips) {
|
$.each(result.click, function (index, tips) {
|
||||||
$(tips.selector).click(function () {
|
$(tips.selector).off('click._live2d_tips');
|
||||||
|
$(tips.selector).on('click._live2d_tips', function () {
|
||||||
if (hitFlag) {
|
if (hitFlag) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -106,46 +115,22 @@ if (!norunFlag) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
window._live2d.initTips = initTips;
|
||||||
initTips();
|
initTips();
|
||||||
|
|
||||||
var text;
|
var text;
|
||||||
if (document.referrer !== '' && document.referrer.split('/')[2] !== window.location.host) {
|
if (document.referrer !== '' && document.referrer.split('/')[2] !== window.location.host) {
|
||||||
var referrer = document.createElement('a');
|
var referrer = document.createElement('a');
|
||||||
referrer.href = document.referrer;
|
referrer.href = document.referrer;
|
||||||
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
|
|
||||||
var domain = referrer.hostname.split('.')[1];
|
var domain = referrer.hostname.split('.')[1];
|
||||||
if (domain == 'baidu') {
|
if (domain == 'baidu' || domain == 'so' || domain == 'google') {
|
||||||
text = '嗨! 来自 百度搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
|
var source = domain == 'baidu' ? '百度搜索' : domain == 'so' ? '360搜索' : '谷歌搜索';
|
||||||
} else if (domain == 'so') {
|
text = '嗨! 来自 ' + source + ' 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
|
||||||
text = '嗨! 来自 360搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
|
} else {
|
||||||
} else if (domain == 'google') {
|
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
|
||||||
text = '嗨! 来自 谷歌搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (window.location.pathname == "/") { //主页URL判断,需要斜杠结尾
|
text = getWelcomeText();
|
||||||
var now = (new Date()).getHours();
|
|
||||||
if (now > 23 || now <= 5) {
|
|
||||||
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?';
|
|
||||||
} else if (now > 5 && now <= 7) {
|
|
||||||
text = '早上好!一日之计在于晨,美好的一天就要开始了!';
|
|
||||||
} else if (now > 7 && now <= 11) {
|
|
||||||
text = '上午好!工作顺利嘛,不要久坐,多起来走动走动哦!';
|
|
||||||
} else if (now > 11 && now <= 14) {
|
|
||||||
text = '中午了,工作了一个上午,现在是午餐时间!';
|
|
||||||
} else if (now > 14 && now <= 17) {
|
|
||||||
text = '午后很容易犯困呢,今天的运动目标完成了吗?';
|
|
||||||
} else if (now > 17 && now <= 19) {
|
|
||||||
text = '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~~';
|
|
||||||
} else if (now > 19 && now <= 21) {
|
|
||||||
text = '晚上好,今天过得怎么样?';
|
|
||||||
} else if (now > 21 && now <= 23) {
|
|
||||||
text = '已经这么晚了呀,早点休息吧,晚安~~';
|
|
||||||
} else {
|
|
||||||
text = '嗨~ 快来逗我玩吧!';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
text = '欢迎阅读<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
showMessage(text, 12000);
|
showMessage(text, 12000);
|
||||||
})();
|
})();
|
||||||
@@ -172,6 +157,7 @@ if (!norunFlag) {
|
|||||||
console.log(sleepTimer_);
|
console.log(sleepTimer_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window._live2d.showHitokoto = showHitokoto;
|
||||||
|
|
||||||
function checkSleep() {
|
function checkSleep() {
|
||||||
var sleepStatu = sessionStorage.getItem("Sleepy");
|
var sleepStatu = sessionStorage.getItem("Sleepy");
|
||||||
@@ -213,6 +199,7 @@ if (!norunFlag) {
|
|||||||
//if (timeout === null) timeout = 5000;
|
//if (timeout === null) timeout = 5000;
|
||||||
//hideMessage(timeout);
|
//hideMessage(timeout);
|
||||||
}
|
}
|
||||||
|
window._live2d.showMessage = showMessage;
|
||||||
function talkValTimer() {
|
function talkValTimer() {
|
||||||
$('#live_talk').val('1');
|
$('#live_talk').val('1');
|
||||||
}
|
}
|
||||||
@@ -384,74 +371,100 @@ if (!norunFlag) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
//获取音乐信息初始化
|
//获取音乐信息初始化
|
||||||
var bgmListInfo = $('input[name=live2dBGM]');
|
var $bgm = $('#live2d_bgm');
|
||||||
if (bgmListInfo.length == 0) {
|
|
||||||
$('#musicButton').hide();
|
// 音乐按钮点击事件(幂等,使用命名空间避免重复绑定)
|
||||||
} else {
|
$('#musicButton').off('click._bgm').on('click._bgm', function () {
|
||||||
var bgmPlayNow = parseInt($('#live2d_bgm').attr('data-bgm'));
|
if ($('#musicButton').hasClass('play')) {
|
||||||
var bgmPlayTime = 0;
|
$bgm[0].pause();
|
||||||
var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num");
|
$('#musicButton').removeClass('play');
|
||||||
var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime");
|
sessionStorage.setItem("live2dBGM_IsPlay", '1');
|
||||||
if (live2dBGM_Num) {
|
} else {
|
||||||
if (live2dBGM_Num <= $('input[name=live2dBGM]').length - 1) {
|
$bgm[0].play();
|
||||||
bgmPlayNow = parseInt(live2dBGM_Num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (live2dBGM_PlayTime) {
|
|
||||||
bgmPlayTime = parseInt(live2dBGM_PlayTime);
|
|
||||||
}
|
|
||||||
var live2dBGMSrc = bgmListInfo.eq(bgmPlayNow).val();
|
|
||||||
$('#live2d_bgm').attr('data-bgm', bgmPlayNow);
|
|
||||||
$('#live2d_bgm').attr('src', live2dBGMSrc);
|
|
||||||
$('#live2d_bgm')[0].currentTime = bgmPlayTime;
|
|
||||||
$('#live2d_bgm')[0].volume = 0.5;
|
|
||||||
var live2dBGM_IsPlay = sessionStorage.getItem("live2dBGM_IsPlay");
|
|
||||||
var live2dBGM_WindowClose = sessionStorage.getItem("live2dBGM_WindowClose");
|
|
||||||
if (live2dBGM_IsPlay == '0' && live2dBGM_WindowClose == '0') {
|
|
||||||
$('#live2d_bgm')[0].play();
|
|
||||||
$('#musicButton').addClass('play');
|
$('#musicButton').addClass('play');
|
||||||
|
sessionStorage.setItem("live2dBGM_IsPlay", '0');
|
||||||
}
|
}
|
||||||
sessionStorage.setItem("live2dBGM_WindowClose", '1');
|
});
|
||||||
$('#musicButton').on('click', function () {
|
|
||||||
if ($('#musicButton').hasClass('play')) {
|
// BGM 事件监听(仅绑定一次,使用标志位避免重复)
|
||||||
$('#live2d_bgm')[0].pause();
|
if (!window._live2d._bgmEventsBound) {
|
||||||
$('#musicButton').removeClass('play');
|
$bgm[0].addEventListener("timeupdate", function () {
|
||||||
sessionStorage.setItem("live2dBGM_IsPlay", '1');
|
sessionStorage.setItem("live2dBGM_PlayTime", $bgm[0].currentTime);
|
||||||
} else {
|
});
|
||||||
$('#live2d_bgm')[0].play();
|
$bgm[0].addEventListener("ended", function () {
|
||||||
$('#musicButton').addClass('play');
|
var listNow = parseInt($bgm.attr('data-bgm'));
|
||||||
sessionStorage.setItem("live2dBGM_IsPlay", '0');
|
listNow++;
|
||||||
|
var inputs = $('input[name=live2dBGM]');
|
||||||
|
if (inputs.length === 0) return;
|
||||||
|
if (listNow > inputs.length - 1) {
|
||||||
|
listNow = 0;
|
||||||
}
|
}
|
||||||
|
var listNewSrc = inputs.eq(listNow).val();
|
||||||
|
if (!listNewSrc) return;
|
||||||
|
sessionStorage.setItem("live2dBGM_Num", listNow);
|
||||||
|
$bgm.attr('src', listNewSrc);
|
||||||
|
$bgm[0].play();
|
||||||
|
$bgm.attr('data-bgm', listNow);
|
||||||
|
});
|
||||||
|
$bgm[0].addEventListener("error", function () {
|
||||||
|
$bgm[0].pause();
|
||||||
|
$('#musicButton').removeClass('play');
|
||||||
|
showMessage('音乐似乎加载不出来了呢!', 0);
|
||||||
});
|
});
|
||||||
window.onbeforeunload = function () {
|
window.onbeforeunload = function () {
|
||||||
sessionStorage.setItem("live2dBGM_WindowClose", '0');
|
sessionStorage.setItem("live2dBGM_WindowClose", '0');
|
||||||
if ($('#musicButton').hasClass('play')) {
|
if ($('#musicButton').hasClass('play')) {
|
||||||
sessionStorage.setItem("live2dBGM_IsPlay", '0');
|
sessionStorage.setItem("live2dBGM_IsPlay", '0');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
document.getElementById('live2d_bgm').addEventListener("timeupdate", function () {
|
window._live2d._bgmEventsBound = true;
|
||||||
var live2dBgmPlayTimeNow = document.getElementById('live2d_bgm').currentTime;
|
}
|
||||||
sessionStorage.setItem("live2dBGM_PlayTime", live2dBgmPlayTimeNow);
|
|
||||||
});
|
// 初始化 BGM(根据当前页面是否有 BGM 输入)
|
||||||
document.getElementById('live2d_bgm').addEventListener("ended", function () {
|
if (typeof window._live2d.initBGM === 'function') {
|
||||||
var listNow = parseInt($('#live2d_bgm').attr('data-bgm'));
|
window._live2d.initBGM();
|
||||||
listNow++;
|
|
||||||
if (listNow > $('input[name=live2dBGM]').length - 1) {
|
|
||||||
listNow = 0;
|
|
||||||
}
|
|
||||||
var listNewSrc = $('input[name=live2dBGM]').eq(listNow).val();
|
|
||||||
sessionStorage.setItem("live2dBGM_Num", listNow);
|
|
||||||
$('#live2d_bgm').attr('src', listNewSrc);
|
|
||||||
$('#live2d_bgm')[0].play();
|
|
||||||
$('#live2d_bgm').attr('data-bgm', listNow);
|
|
||||||
});
|
|
||||||
document.getElementById('live2d_bgm').addEventListener("error", function () {
|
|
||||||
$('#live2d_bgm')[0].pause();
|
|
||||||
$('#musicButton').removeClass('play');
|
|
||||||
showMessage('音乐似乎加载不出来了呢!', 0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 暴露 BGM 初始化函数,供 PJAX 重初始化时调用
|
||||||
|
window._live2d.initBGM = function() {
|
||||||
|
var bgmListInfo = $('input[name=live2dBGM]');
|
||||||
|
var $bgm = $('#live2d_bgm');
|
||||||
|
if (bgmListInfo.length === 0) {
|
||||||
|
$('#musicButton').hide();
|
||||||
|
if ($bgm.length) $bgm[0].pause();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var bgmPlayNow = parseInt($bgm.attr('data-bgm')) || 0;
|
||||||
|
var bgmPlayTime = 0;
|
||||||
|
var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num");
|
||||||
|
var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime");
|
||||||
|
if (live2dBGM_Num) {
|
||||||
|
if (parseInt(live2dBGM_Num) <= bgmListInfo.length - 1) {
|
||||||
|
bgmPlayNow = parseInt(live2dBGM_Num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (live2dBGM_PlayTime) {
|
||||||
|
bgmPlayTime = parseFloat(live2dBGM_PlayTime);
|
||||||
|
}
|
||||||
|
var newSrc = bgmListInfo.eq(bgmPlayNow).val();
|
||||||
|
$bgm.attr('data-bgm', bgmPlayNow);
|
||||||
|
if ($bgm.attr('src') !== newSrc) {
|
||||||
|
$bgm[0].pause();
|
||||||
|
$bgm.attr('src', newSrc);
|
||||||
|
$bgm[0].currentTime = bgmPlayTime;
|
||||||
|
}
|
||||||
|
$bgm[0].volume = 0.5;
|
||||||
|
var live2dBGM_IsPlay = sessionStorage.getItem("live2dBGM_IsPlay");
|
||||||
|
var live2dBGM_WindowClose = sessionStorage.getItem("live2dBGM_WindowClose");
|
||||||
|
if (live2dBGM_IsPlay == '0' && live2dBGM_WindowClose == '0') {
|
||||||
|
$bgm[0].play();
|
||||||
|
$('#musicButton').addClass('play');
|
||||||
|
}
|
||||||
|
sessionStorage.setItem("live2dBGM_WindowClose", '1');
|
||||||
|
$('#musicButton').show();
|
||||||
|
};
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var AIimgSrc = [
|
var AIimgSrc = [
|
||||||
message_Path + "model/histoire/histoire.1024/texture_00.png",
|
message_Path + "model/histoire/histoire.1024/texture_00.png",
|
||||||
|
|||||||
@@ -50,4 +50,4 @@ Powered by [Jekyll](https://github.com/jekyll/jekyll)
|
|||||||
本站转载的文章如无特别说明,均按原文章的协议执行
|
本站转载的文章如无特别说明,均按原文章的协议执行
|
||||||
|
|
||||||
## 打赏/赞助 Mayx
|
## 打赏/赞助 Mayx
|
||||||

|

|
||||||
|
|||||||
@@ -172,5 +172,11 @@
|
|||||||
"/2025/09/01/quine.html": "这篇文章主要介绍了作者在博客部署过程中,对ZIP Quine(自包含压缩包)和自产生程序的探索过程。作者起初想利用压缩包实现离线浏览,但遇到了压缩包不包含自身的问题。随后,作者回顾了ZIP Quine的原理,如droste.zip,以及如何通过DEFLATE压缩算法的LZ77编码实现自包含。作者尝试了Russ Cox的方案,但发现由于压缩格式限制,实际操作中存在数据容量的限制,无法存下整个博客。尽管如此,作者还是研究了嵌套循环的ZIP Quine,如Ruben Van Mello的论文中所描述的,尽管空间仍然有限。探索过程中,作者还学习了自产生程序(Quine)的概念,包括其实现原理和各种编程语言中的例子。作者最后感慨,探索过程中的收获比原本的目标更重要。",
|
"/2025/09/01/quine.html": "这篇文章主要介绍了作者在博客部署过程中,对ZIP Quine(自包含压缩包)和自产生程序的探索过程。作者起初想利用压缩包实现离线浏览,但遇到了压缩包不包含自身的问题。随后,作者回顾了ZIP Quine的原理,如droste.zip,以及如何通过DEFLATE压缩算法的LZ77编码实现自包含。作者尝试了Russ Cox的方案,但发现由于压缩格式限制,实际操作中存在数据容量的限制,无法存下整个博客。尽管如此,作者还是研究了嵌套循环的ZIP Quine,如Ruben Van Mello的论文中所描述的,尽管空间仍然有限。探索过程中,作者还学习了自产生程序(Quine)的概念,包括其实现原理和各种编程语言中的例子。作者最后感慨,探索过程中的收获比原本的目标更重要。",
|
||||||
"/2025/10/12/recover.html": "这篇文章讲述了作者通过GitHub的Fork特性找回一个被删除的Brainfuck可视化演示仓库的经历。由于原仓库和作者主页都已消失,作者推测GitHub在Fork时会共享对象库,只要有任意一个Fork仓库存在,GitHub就会保留所有对象,从而可以通过找到一个Fork仓库的最新提交Hash值来还原目标仓库。作者通过Linux内核仓库的Fork进行验证,随后在互联网档案馆上找到目标仓库的Fork以及其Hash值,最终通过Git命令将本地仓库的HEAD指针指向目标提交,成功恢复了该仓库的代码,并将其部署到自己的GitHub Pages上。最后,作者发现Software Heritage组织会保存所有代码,因此在遇到类似情况时可以直接通过该平台进行查找。",
|
"/2025/10/12/recover.html": "这篇文章讲述了作者通过GitHub的Fork特性找回一个被删除的Brainfuck可视化演示仓库的经历。由于原仓库和作者主页都已消失,作者推测GitHub在Fork时会共享对象库,只要有任意一个Fork仓库存在,GitHub就会保留所有对象,从而可以通过找到一个Fork仓库的最新提交Hash值来还原目标仓库。作者通过Linux内核仓库的Fork进行验证,随后在互联网档案馆上找到目标仓库的Fork以及其Hash值,最终通过Git命令将本地仓库的HEAD指针指向目标提交,成功恢复了该仓库的代码,并将其部署到自己的GitHub Pages上。最后,作者发现Software Heritage组织会保存所有代码,因此在遇到类似情况时可以直接通过该平台进行查找。",
|
||||||
"/2025/11/01/mirrors.html": "这篇文章讲述了作者为了提高博客的可靠性,探索利用被滥用的Git平台进行博客镜像的想法和实践。作者发现一些Git实例存在大量空仓库和异常用户,怀疑是SEO公司滥用,因此决定利用这些平台进行博客镜像备份,以应对平台倒闭或数据丢失的风险。作者选择Gitea和Forgejo平台作为目标,编写脚本自动注册账号并导入博客仓库,实现了自动化镜像分发。作者也意识到此类平台的稳定性存在不确定性,并思考了“量”和“质”两种方式确保博客永恒性的优劣,最终认为建立一个活跃的、自动执行维护操作的网络可能更有效。文章最后展示了作者创建的Git镜像列表,并表达了对博客永恒性的思考。",
|
"/2025/11/01/mirrors.html": "这篇文章讲述了作者为了提高博客的可靠性,探索利用被滥用的Git平台进行博客镜像的想法和实践。作者发现一些Git实例存在大量空仓库和异常用户,怀疑是SEO公司滥用,因此决定利用这些平台进行博客镜像备份,以应对平台倒闭或数据丢失的风险。作者选择Gitea和Forgejo平台作为目标,编写脚本自动注册账号并导入博客仓库,实现了自动化镜像分发。作者也意识到此类平台的稳定性存在不确定性,并思考了“量”和“质”两种方式确保博客永恒性的优劣,最终认为建立一个活跃的、自动执行维护操作的网络可能更有效。文章最后展示了作者创建的Git镜像列表,并表达了对博客永恒性的思考。",
|
||||||
"/2025/12/01/linux.html": "这篇文章介绍了在浏览器中运行Linux的各种方法,从最初的纯JS虚拟机JSLinux,到后来的WASM虚拟机如v86、WebVM、WebCM,再到容器化方案container2wasm,以及直接将Linux内核编译为WASM的方案。作者详细对比了这些方案的优缺点,包括性能、兼容性、功能和开发难度。文章还提到了模仿Linux环境的WebContainers和JupyterLite,并最终认为虚拟机方案更靠谱,但对WASM的未来充满期待。作者最后表示,博客上添加类似功能的计划还在考虑中,目前主要分享了各种方法的探索过程。"
|
"/2025/12/01/linux.html": "这篇文章介绍了在浏览器中运行Linux的各种方法,从最初的纯JS虚拟机JSLinux,到后来的WASM虚拟机如v86、WebVM、WebCM,再到容器化方案container2wasm,以及直接将Linux内核编译为WASM的方案。作者详细对比了这些方案的优缺点,包括性能、兼容性、功能和开发难度。文章还提到了模仿Linux环境的WebContainers和JupyterLite,并最终认为虚拟机方案更靠谱,但对WASM的未来充满期待。作者最后表示,博客上添加类似功能的计划还在考虑中,目前主要分享了各种方法的探索过程。",
|
||||||
|
"/2026/01/01/summary.html": "这篇文章介绍了作者对2025年的年终总结,主要表达了对自身状态的担忧和对未来的不确定感。作者认为自己在记忆和思考能力方面有所下滑,稳定性较低,且未能抓住资产保值的机会。同时,文章也记录了AI技术的飞速发展,以及自己博客内容与时代脱节的现象。尽管对未来感到迷茫,作者仍然抱有一丝希望,期望在2026年做出正确的选择,避免陷入危险。",
|
||||||
|
"/2026/02/08/xslt.html": "这篇文章讲述了Google计划弃用XSLT技术,以及作者对这一决定的调查和应对方案。Google基于XSLT用户占比低、库存在漏洞等原因,建议将其从Web标准中删除。作者发现许多用户依赖XSLT进行博客订阅美化,甚至将其作为博客框架。为了对抗这一趋势,有人创建了网站https://xslt.rip,并开发了Polyfill库,通过WASM方式保持XSLT功能。虽然Polyfill库需要额外引用JS代码,但作者已将其提交至CDNJS。随后,作者探讨了替代方案,包括使用纯CSS美化订阅源(由AI生成feed.css),以及混合XHTML的方式,通过添加XHTML命名空间来实现链接等功能,但这种方法会产生“不纯粹”的警告。文章最后总结,技术可能会消失,但总有其他技术可以解决问题,并强调了适应浏览器厂商决策的重要性。",
|
||||||
|
"/2026/03/01/llm3.html": "这篇文章介绍了作者近期在LLM部署和应用方面的经历,主要包括以下几个方面:\n\n首先,作者升级硬件,从单张RTX4090 48GiB升级到双路RTX4090 48GiB,并购买了TRX40+TR 3960X的主板套装,用于运行GPT-OSS模型。随后,作者尝试使用vLLM框架替换Ollama,并成功配置了GPT-OSS模型,达到了接近190Tps的性能。\n\n其次,作者体验了DeepSeek 1M上下文模型,发现其在处理长上下文任务时表现出色,能够展现摘要无法捕捉的细节,并成功生成简历、分析人格等。\n\n此外,作者还尝试使用DeepSeek重构Mabbs,并发现DeepSeek能够识别作者的博客信息,这表明训练样本中包含了作者的信息。\n\n最后,作者在8GiB内存的MacBook Pro上运行了LFM2.5-1.2B-Thinking模型,并使用了Apollo软件,体验了其快速的推理速度和良好的思考能力。作者总结认为,AI的发展令人惊叹,软件优化使其在有限硬件环境下也能运行。",
|
||||||
|
"/2026/04/14/ai-agent.html": "这篇文章介绍了“AI个人助理”Agent的发展现状和各种尝试。作者体验了OpenClaw、QClaw、WorkBuddy、Cline、LuckClaw和ApkClaw等不同的Agent项目,发现它们在功能、易用性和性能上各有优劣。OpenClaw安装和使用存在困难,国内大厂的QClaw和WorkBuddy则更易于上手,但免费额度有限。作者认为,开发任务更适合在编辑器集成AI中进行,如GitHub Copilot。LuckClaw在微型开发板上运行表现出色,ApkClaw则利用手机的优势操作移动应用。尽管Agent技术仍存在诸多问题,但其应用场景不断拓展,有望吸引更多人参与其中,推动AI应用化进程。",
|
||||||
|
"/2026/05/01/virtual-net.html": "这篇文章介绍了作者在尝试异地组网搭建虚拟局域网时,对多种组网工具的探索和体验。作者首先尝试了n2n,但由于其项目停止更新且在NAT后的机器间存在掉线问题,最终选择了WireGuard作为主要方案。文章详细描述了WireGuard的配置过程,包括在Linux、OpenWrt和openEuler系统上的安装和配置,并遇到了各种各样的挑战,例如在红米AX3000路由器上找不到内核模块,以及在openEuler上缺少WireGuard相关包。此外,文章还提到了Netmaker和Headscale等WireGuard的控制平面,以及VNT和EasyTier等其他组网工具,并总结了最终选择WireGuard的原因:简单、够用、可靠性不错,且已经投入了大量配置。",
|
||||||
|
"/2026/06/01/dedupe.html": "这篇文章介绍了如何通过优化游戏资源文件来节约游戏占用的硬盘空间。作者由于Mac只有256GiB的硬盘存储空间,在下载了几十部游戏后空间不足,于是寻找解决方法。文章主要介绍了以下几点:\n\n1. 使用jdupes工具去除重复素材:作者发现许多游戏使用相同的引擎和素材,导致硬盘空间浪费。通过使用jdupes工具进行硬链接,可以有效去除重复文件,节约空间。\n\n2. 不同引擎的处理方式:\n - 对于RPG制作大师MV/MZ,作者使用RPG Maker Decrypter工具解密资源文件,并将图片转换为WebP格式以压缩空间。\n - 对于RPG制作大师XP/VX/VA,作者使用mkxp-z工具跨平台运行游戏,并通过RPG Maker Decrypter解包资源文件,与RTP素材合并后进行去重。\n - 对于Ren'Py游戏,作者使用unrpa工具解包rpa文件,但由于公共资源不多,仅在系列游戏情况下进行解包。\n\n3. 最终效果:通过以上优化,作者成功将游戏文件夹大小从47G降至33G,节约了大量硬盘空间。"
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ title,link,feed_url,description
|
|||||||
极客兔兔,https://geektutu.com/,https://geektutu.com/atom.xml,致力于分享有趣的技术实践
|
极客兔兔,https://geektutu.com/,https://geektutu.com/atom.xml,致力于分享有趣的技术实践
|
||||||
维基萌,https://www.wikimoe.com/,https://www.wikimoe.com/rss,萌即是正义!一名热爱acg的前端设计师的小站!
|
维基萌,https://www.wikimoe.com/,https://www.wikimoe.com/rss,萌即是正义!一名热爱acg的前端设计师的小站!
|
||||||
7gugu's blog,https://www.7gugu.com/,https://7gugu.com/index.php/feed/,"一个用来存放我爱好的地方,编程,摄影之类的空间"
|
7gugu's blog,https://www.7gugu.com/,https://7gugu.com/index.php/feed/,"一个用来存放我爱好的地方,编程,摄影之类的空间"
|
||||||
云游君,https://www.yunyoujun.cn/,https://www.yunyoujun.cn/atom.xml,希望能成为一个有趣的人。
|
|
||||||
Kingfish404,https://blog.kingfish404.cn/,https://blog.kingfish404.cn/index.xml,"Stay curious,stay naive. WUT. Jin Yu's Blog"
|
Kingfish404,https://blog.kingfish404.cn/,https://blog.kingfish404.cn/index.xml,"Stay curious,stay naive. WUT. Jin Yu's Blog"
|
||||||
FKUN,https://blog.fkun.tech/,https://blog.fkun.tech/feed/,
|
FKUN,https://blog.fkun.tech/,https://blog.fkun.tech/feed/,
|
||||||
Sinofine,https://sinofine.me/,https://sinofine.me/atom.xml,
|
Sinofine,https://sinofine.me/,https://sinofine.me/atom.xml,
|
||||||
@@ -16,8 +15,10 @@ Vullfin的博客,https://blog.vull.top/,https://blog.vull.top/atom.xml,Vullfin's
|
|||||||
陈陈菌博客,https://blog.glumi.cn/,https://blog.glumi.cn/rss.xml,计算机业余爱好者。
|
陈陈菌博客,https://blog.glumi.cn/,https://blog.glumi.cn/rss.xml,计算机业余爱好者。
|
||||||
彬红茶日记,https://note.redcha.cn/,https://note.redcha.cn/rss.xml,我的个人日记!
|
彬红茶日记,https://note.redcha.cn/,https://note.redcha.cn/rss.xml,我的个人日记!
|
||||||
Lanke's blog,https://blog.blueke.top/,https://blog.blueke.top/rss.xml,请为一切不真实之物骄傲,因为我们高于这个世界!
|
Lanke's blog,https://blog.blueke.top/,https://blog.blueke.top/rss.xml,请为一切不真实之物骄傲,因为我们高于这个世界!
|
||||||
时光流·言,https://www.hansjack.com/,https://www.hansjack.com/feed/,个人博客,持续分享网站部署实战经验、精选书评解读和生活观察手记。 这里提供可复用的技术教程、深度阅读指南和真实生活洞察,与技术爱好者一起进步......
|
寒士杰克,https://www.hansjack.com/,https://www.hansjack.com/feed/,喜欢捣鼓,不断进步!
|
||||||
Pinpe 的云端,https://pinpe.top/,https://pinpe.top/rss.xml,一个属于自己的云朵。
|
Pinpe 的云端,https://pinpe.top/,https://pinpe.top/rss.xml,一个属于自己的云朵。
|
||||||
Chise Hachiroku,https://chise.hachiroku.com/,https://chise.hachiroku.com/zh/feed/,向明日的辉迹,干杯!
|
Chise Hachiroku,https://chise.hachiroku.com/zh/,https://chise.hachiroku.com/zh/feed/,向明日的辉迹,干杯!
|
||||||
映屿,https://www.glowisle.me/,https://www.glowisle.me/atom.xml,关于互联网、书籍、生活琐事以及那些一闪而过的念头
|
映屿,https://www.glowisle.me/,https://www.glowisle.me/atom.xml,关于互联网、书籍、生活琐事以及那些一闪而过的念头
|
||||||
东东,https://nihaha.com/,https://nihaha.com/feed/,城市与信仰
|
Restent's Notebook,https://blog.gxres.net/,https://blog.gxres.net/atom.xml,不前沿技术分享
|
||||||
|
Coseroom,https://coseroom.com,,
|
||||||
|
RavelloH's Blog,https://ravelloh.com,https://ravelloh.com/feed.xml,Beginning of meditation.
|
||||||
|
|||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,30 @@
|
|||||||
proxies:
|
proxies:
|
||||||
- https://blog.mayx.workers.dev/
|
- https://blog.mayx.workers.dev/
|
||||||
- https://mayx.deno.dev/
|
- https://mayx.deno.dev/
|
||||||
|
- https://mayx.val.run/
|
||||||
|
- https://mayx.azion.app/
|
||||||
- https://yuki.gear.host/
|
- https://yuki.gear.host/
|
||||||
- https://mayx.global.ssl.fastly.net/
|
- https://mayx.global.ssl.fastly.net/
|
||||||
mirrors:
|
mirrors:
|
||||||
- https://mayx.gitlab.io/
|
- https://mayx.gitlab.io/
|
||||||
- https://mayx.pages.dev/
|
- https://mayx.pages.dev/
|
||||||
- https://mayx.eu.org/
|
- https://mayx.eu.org/
|
||||||
- https://mayx.envs.sh/
|
|
||||||
- https://mayx.envs.net/
|
- https://mayx.envs.net/
|
||||||
- https://mayx.frama.io/
|
- https://mayx.frama.io/
|
||||||
- https://mayx.surge.sh/
|
- https://mayx.surge.sh/
|
||||||
- https://mayx.pages.gay/
|
- https://mayx.pages.gay/
|
||||||
|
- https://mayx.gitpage.si/
|
||||||
- https://mayx.serv00.net/
|
- https://mayx.serv00.net/
|
||||||
- https://mayx.vercel.app/
|
- https://mayx.vercel.app/
|
||||||
|
- https://mayx-blog.pgs.sh/
|
||||||
- https://mayx.netlify.app/
|
- https://mayx.netlify.app/
|
||||||
- https://mayx.pixie.homes/
|
- https://mayx.gitnet.page/
|
||||||
|
- https://mayx.stormkit.dev/
|
||||||
|
- https://mayx.grebedoc.dev/
|
||||||
- https://mabbs.kinsta.page/
|
- https://mabbs.kinsta.page/
|
||||||
- https://mayx.codeberg.page/
|
- https://mayx.codeberg.page/
|
||||||
|
- https://mayx.tildepages.org/
|
||||||
|
- https://mayx.pandastack.app/
|
||||||
- https://mayx.pages.lain.la/
|
- https://mayx.pages.lain.la/
|
||||||
- https://mayx.4everland.app/
|
- https://mayx.4everland.app/
|
||||||
- https://mayx.readthedocs.io/
|
- https://mayx.readthedocs.io/
|
||||||
@@ -25,8 +32,10 @@ mirrors:
|
|||||||
- https://unmayx.bitbucket.io/
|
- https://unmayx.bitbucket.io/
|
||||||
- https://mayx.pages.debian.net/
|
- https://mayx.pages.debian.net/
|
||||||
- https://mayx.dappling.network/
|
- https://mayx.dappling.network/
|
||||||
- https://mayx-blog.statichost.eu/
|
- https://mayx-blog.statichost.page/
|
||||||
- https://mabbs-blog.static.hf.space/
|
- https://mabbs-blog.static.hf.space/
|
||||||
|
- http://mayx.gitlink.net/
|
||||||
|
- https://mayx.pixie.homes/
|
||||||
repos:
|
repos:
|
||||||
- https://github.com/Mabbs/mabbs.github.io
|
- https://github.com/Mabbs/mabbs.github.io
|
||||||
- https://gitlab.com/mayx/mayx.gitlab.io
|
- https://gitlab.com/mayx/mayx.gitlab.io
|
||||||
@@ -35,21 +44,27 @@ repos:
|
|||||||
- https://codeberg.org/mayx/blog
|
- https://codeberg.org/mayx/blog
|
||||||
- https://pagure.io/mayx
|
- https://pagure.io/mayx
|
||||||
- https://git.gay/mayx/mayx
|
- https://git.gay/mayx/mayx
|
||||||
|
- https://repo.or.cz/mayx.git
|
||||||
- https://gitea.com/mayx/mayx
|
- https://gitea.com/mayx/mayx
|
||||||
- https://gitgud.io/mayx/mayx
|
- https://gitgud.io/mayx/mayx
|
||||||
- https://git.sr.ht/~mayx/mayx
|
- https://git.sr.ht/~mayx/mayx
|
||||||
|
- https://worktree.ca/mayx/blog
|
||||||
- https://git.launchpad.net/mayx
|
- https://git.launchpad.net/mayx
|
||||||
- https://gin.g-node.org/mayx/blog
|
- https://gin.g-node.org/mayx/blog
|
||||||
|
- https://tildeforge.dev/mayx/blog
|
||||||
- https://git.disroot.org/mayx/mayx
|
- https://git.disroot.org/mayx/mayx
|
||||||
- https://bitbucket.org/unmayx/mayx
|
- https://bitbucket.org/unmayx/mayx
|
||||||
- https://sourcecraft.dev/mayx/mayx
|
- https://sourcecraft.dev/mayx/mayx
|
||||||
|
- https://code.forgejo.org/mayx/blog
|
||||||
- https://gitflic.ru/project/mayx/blog
|
- https://gitflic.ru/project/mayx/blog
|
||||||
|
- https://rocketgit.com/user/mayx/blog/
|
||||||
- https://tangled.org/mayx.tngl.sh/blog/
|
- https://tangled.org/mayx.tngl.sh/blog/
|
||||||
- https://gitee.com/mabbs/mabbs
|
- https://gitee.com/mabbs/mabbs
|
||||||
- https://cnb.cool/unmayx/mayx
|
- https://cnb.cool/unmayx/mayx
|
||||||
- https://atomgit.com/mayx/blog
|
- https://atomgit.com/mayx/blog
|
||||||
- https://sourceforge.net/projects/mayx/
|
- https://sourceforge.net/projects/mayx/
|
||||||
- https://dev.azure.com/unmayx/_git/Mayx
|
- https://dev.azure.com/unmayx/_git/Mayx
|
||||||
|
- https://www.gitlink.org.cn/mayx/mayx.gitlink.net
|
||||||
static:
|
static:
|
||||||
- https://mayx.nekoweb.org/
|
- https://mayx.nekoweb.org/
|
||||||
- https://mayx.neocities.org/
|
- https://mayx.neocities.org/
|
||||||
@@ -63,4 +78,3 @@ others:
|
|||||||
- https://mayx.home.blog/
|
- https://mayx.home.blog/
|
||||||
- https://unmayx.medium.com/
|
- https://unmayx.medium.com/
|
||||||
- https://mayx.cnblogs.com/
|
- https://mayx.cnblogs.com/
|
||||||
- https://mayx.xlog.app/
|
|
||||||
@@ -9,6 +9,7 @@ layout: xslt_container
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
{% seo %}
|
{% seo %}
|
||||||
|
{% if page.robots %}<meta name="robots" content="{{ page.robots }}" />{% endif %}
|
||||||
{% unless site.github %}<link rel="canonical" href="https://mabbs.github.io{{ page.url }}" />{% endunless %}
|
{% unless site.github %}<link rel="canonical" href="https://mabbs.github.io{{ page.url }}" />{% endunless %}
|
||||||
{% feed_meta %}
|
{% feed_meta %}
|
||||||
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}(RSS)" href="{{ "/rss.xml" | absolute_url }}" />
|
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}(RSS)" href="{{ "/rss.xml" | absolute_url }}" />
|
||||||
@@ -16,6 +17,8 @@ layout: xslt_container
|
|||||||
<link rel="stylesheet" href="/assets/css/style.css?v={{ site.time | date: "%s" }}" />
|
<link rel="stylesheet" href="/assets/css/style.css?v={{ site.time | date: "%s" }}" />
|
||||||
<!--[if !IE]> -->
|
<!--[if !IE]> -->
|
||||||
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
|
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
|
||||||
|
<link rel="stylesheet" href="/assets/css/gitalk.css" />
|
||||||
|
<script src="/assets/js/gitalk.min.js"></script>
|
||||||
<!-- <![endif]-->
|
<!-- <![endif]-->
|
||||||
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{ site.title }}" />
|
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="{{ site.title }}" />
|
||||||
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
|
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
|
||||||
@@ -24,6 +27,7 @@ layout: xslt_container
|
|||||||
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
|
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
|
||||||
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
|
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
|
||||||
<link rel="me" href="https://github.com/Mabbs" />
|
<link rel="me" href="https://github.com/Mabbs" />
|
||||||
|
<link type="text/plain" rel="author" href="/humans.txt" />
|
||||||
<script src="/assets/js/jquery.min.js"></script>
|
<script src="/assets/js/jquery.min.js"></script>
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||||
@@ -33,6 +37,15 @@ layout: xslt_container
|
|||||||
<script>
|
<script>
|
||||||
var lastUpdated = new Date("{{ site.time | date_to_rfc822 }}");
|
var lastUpdated = new Date("{{ site.time | date_to_rfc822 }}");
|
||||||
var BlogAPI = "https://summary.mayx.eu.org";
|
var BlogAPI = "https://summary.mayx.eu.org";
|
||||||
|
var GitalkConfig = {
|
||||||
|
clientID: '36557aec4c3cb04f7ac6',
|
||||||
|
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
|
||||||
|
repo: 'mabbs.github.io',
|
||||||
|
owner: 'Mabbs',
|
||||||
|
admin: ['Mabbs'],
|
||||||
|
distractionFreeMode: false,
|
||||||
|
proxy: 'https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token'
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<script src="/assets/js/main.js"></script>
|
<script src="/assets/js/main.js"></script>
|
||||||
<!--[if !IE]> -->
|
<!--[if !IE]> -->
|
||||||
@@ -58,13 +71,13 @@ layout: xslt_container
|
|||||||
<h1><a class="u-url u-uid p-name" rel="me" href="{{ "/" | relative_url }}">{{ site.title | default: site.github.repository_name }}</a></h1>
|
<h1><a class="u-url u-uid p-name" rel="me" href="{{ "/" | relative_url }}">{{ site.title | default: site.github.repository_name }}</a></h1>
|
||||||
|
|
||||||
{% if site.logo %}
|
{% if site.logo %}
|
||||||
<img src="{{ site.logo }}" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
|
<img src="{{ site.logo }}" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px; border-radius: 25%;" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p class="p-note">{{ site.description | default: site.github.project_tagline }}</p>
|
<p class="p-note">{{ site.description | default: site.github.project_tagline }}</p>
|
||||||
|
|
||||||
<form action="/search.html">
|
<form id="search-input-all" action="/search.html">
|
||||||
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." /> <input type="submit" value="搜索" />
|
<input type="text" name="keyword" placeholder="Search blog posts.." /> <input type="submit" value="搜索" />
|
||||||
</form>
|
</form>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -89,7 +102,7 @@ layout: xslt_container
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</header>
|
</header>
|
||||||
<section{% unless page.layout == "default" %} class="h-entry"{% endunless %}>
|
<section id="pjax-container"{% unless page.layout == "default" %} class="h-entry"{% endunless %}>
|
||||||
|
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
@@ -97,7 +110,7 @@ layout: xslt_container
|
|||||||
{% include live2d.html %}
|
{% include live2d.html %}
|
||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
<small>Made with ❤ by Mayx<br />Last updated at {{ site.time | date: "%F %T" }}<br /> 总字数:{% include_cached word_count.html %} - 文章数:{{ site.posts.size }} - <a href="{{ site.feed.path | relative_url }}" >Atom</a> - <a href="{{ "/README.html" | relative_url }}" >About</a></small>
|
<small>Made with ❤ by Mayx<br />Last updated at {{ site.time | date: "%F %T" }}<br /> 总字数:{% include_cached word_count.html %} - 文章数:{{ site.posts.size }} - <a href="/rss.xml">Feed</a> - <a href="{{ "/README.html" | relative_url }}" >About</a></small>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,6 +119,8 @@ layout: xslt_container
|
|||||||
<script src="/assets/js/main_new.js"></script>
|
<script src="/assets/js/main_new.js"></script>
|
||||||
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
|
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
|
||||||
<script src="/Live2dHistoire/live2d/js/message.js"></script>
|
<script src="/Live2dHistoire/live2d/js/message.js"></script>
|
||||||
|
<script src="/assets/js/jquery.pjax.min.js"></script>
|
||||||
|
<script src="/assets/js/pjax.js"></script>
|
||||||
<!-- <![endif]-->
|
<!-- <![endif]-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -83,7 +83,7 @@ layout: default
|
|||||||
{% if page.layout == "encrypt" %} {{content}} {% else %} <main class="post-content e-content" role="main">{% capture a_post_content %}{% include anchor_headings.html html=content beforeHeading=true anchorBody="<svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>" %}{% endcapture %}{{ a_post_content | replace: '<br />', '</p><p>' }}</main> {% endif %}
|
{% if page.layout == "encrypt" %} {{content}} {% else %} <main class="post-content e-content" role="main">{% capture a_post_content %}{% include anchor_headings.html html=content beforeHeading=true anchorBody="<svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>" %}{% endcapture %}{{ a_post_content | replace: '<br />', '</p><p>' }}</main> {% endif %}
|
||||||
|
|
||||||
{% if page.tags %}
|
{% if page.tags %}
|
||||||
<small style="display: block">tags: {% for tag in page.tags %}<a rel="category tag" class="p-category" href="/search.html?keyword={{ tag | url_encode | replace: '+', '%20' }}"><em>{{ tag }}</em></a>{% unless forloop.last %} - {% endunless %}{% endfor %} <span style="float: right;"><a href="{% if site.github %}{{ site.github.repository_url }}{% else %}https://gitlab.com/mayx/mayx.gitlab.io{% endif %}/tree/master/{{ page.path }}">查看原始文件</a></span></small>
|
<small style="display: block">tags: {% for tag in page.tags %}<a rel="category tag" class="p-category" href="/search.html?keyword={{ tag | uri_escape }}"><em>{{ tag }}</em></a>{% unless forloop.last %} - {% endunless %}{% endfor %} <span style="float: right;"><a href="{% if site.github %}{{ site.github.repository_url }}{% else %}https://gitlab.com/mayx/mayx.gitlab.io{% endif %}/tree/master/{{ page.path }}">查看原始文件</a></span></small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.layout != "encrypt" %}
|
{% if page.layout != "encrypt" %}
|
||||||
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
|
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
|
||||||
@@ -158,22 +158,11 @@ $.get(BlogAPI + "/suggest?id={{ page.url }}&update=" + lastUpdated.valueOf(), fu
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--[if !IE]> -->
|
<!--[if !IE]> -->
|
||||||
<link rel="stylesheet" href="/assets/css/gitalk.css">
|
|
||||||
<script src="/assets/js/gitalk.min.js"></script>
|
|
||||||
|
|
||||||
<div id="gitalk-container"></div>
|
<div id="gitalk-container" data-page-id="{{ page.id }}"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var gitalk = new Gitalk({
|
var gitalk = new Gitalk($.extend({ id: '{{ page.id }}' }, GitalkConfig));
|
||||||
clientID: '36557aec4c3cb04f7ac6',
|
gitalk.render('gitalk-container');
|
||||||
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
|
|
||||||
repo: 'mabbs.github.io',
|
|
||||||
owner: 'Mabbs',
|
|
||||||
admin: ['Mabbs'],
|
|
||||||
id: '{{ page.id }}', // Ensure uniqueness and length less than 50
|
|
||||||
distractionFreeMode: false, // Facebook-like distraction free mode
|
|
||||||
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
|
|
||||||
})
|
|
||||||
gitalk.render('gitalk-container')
|
|
||||||
</script>
|
</script>
|
||||||
<!-- <![endif]-->
|
<!-- <![endif]-->
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
{% if page.layout == "xslt" %}<?xml version="1.0" encoding="utf-8"?>
|
{% if page.layout == "xslt" %}<?xml version="1.0" encoding="utf-8"?>
|
||||||
<?xml-stylesheet type="text/xml" href="/feed.xslt.xml"?>
|
<?xml-stylesheet type="text/xml" href="/feed.xslt.xml"?>
|
||||||
<xsl:stylesheet
|
<?xml-stylesheet type="text/css" href="/assets/css/xslt.css"?>
|
||||||
version="3.0"
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sm="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
|
||||||
xmlns:sm="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
||||||
<xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes" doctype-system="about:legacy-compat" />
|
<xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes" doctype-system="about:legacy-compat" />
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ tags: [浏览器, Linux, 虚拟机, WASM]
|
|||||||
# 在浏览器中运行Linux
|
# 在浏览器中运行Linux
|
||||||
## 虚拟机方案
|
## 虚拟机方案
|
||||||
### 纯JS虚拟机
|
### 纯JS虚拟机
|
||||||
要说到在浏览器上运行Linux,最先想到的应该就是[Fabrice Bellard](https://bellard.org)大神写的[JSLinux](https://bellard.org/jslinux/)吧,这可能是第一个在浏览器中实现的虚拟机(毕竟是最强虚拟机QEMU的作者编写的)。现在他的个人主页中展示的这个版本是WASM版本,而他最早写的是纯JS实现的。那个JS实现的版本现在在GitHub上有一个[去混淆的版本](https://github.com/levskaya/jslinux-deobfuscated)可以用作学习和研究,于是我顺手Fork了一份在GitHub Pages上部署作为[演示](http://mabbs.github.io/jslinux/)。
|
要说到在浏览器上运行Linux,最先想到的应该就是[Fabrice Bellard](https://bellard.org)大神写的[JSLinux](https://bellard.org/jslinux/)吧,这可能是第一个在浏览器中实现的虚拟机(毕竟是最强虚拟机QEMU的作者编写的)。现在他的个人主页中展示的这个版本是WASM版本,而他最早写的是纯JS实现的。那个JS实现的版本现在在GitHub上有一个[去混淆的版本](https://github.com/levskaya/jslinux-deobfuscated)可以用作学习和研究,于是我顺手Fork了一份在GitHub Pages上部署作为[演示](https://mabbs.github.io/jslinux/)。
|
||||||
作为纯JS实现的x86虚拟机,性能估计是最差的,但相应的兼容性也最好,在Bellard当年写JSLinux的时候,还没有WASM这种东西呢,所以即使是在不支持WASM的IE11中,也可以正常运行。假如我想把它作为终端用在我的博客上,似乎也是个不错的选择,即使我完全看不懂代码,不知道如何实现JS和虚拟机的通信,它也预留了一个剪贴板设备,可以让我轻松地做到类似的事情,比如我在里面写个Bash脚本,通过它和外面的JS脚本联动来读取我的文章列表和内容,那也挺不错。
|
作为纯JS实现的x86虚拟机,性能估计是最差的,但相应的兼容性也最好,在Bellard当年写JSLinux的时候,还没有WASM这种东西呢,所以即使是在不支持WASM的IE11中,也可以正常运行。假如我想把它作为终端用在我的博客上,似乎也是个不错的选择,即使我完全看不懂代码,不知道如何实现JS和虚拟机的通信,它也预留了一个剪贴板设备,可以让我轻松地做到类似的事情,比如我在里面写个Bash脚本,通过它和外面的JS脚本联动来读取我的文章列表和内容,那也挺不错。
|
||||||
当然Bellard用纯JS编写虚拟机也不是独一份,他实现了x86的虚拟机,相应的也有人用纯JS实现了RISC-V的虚拟机,比如[ANGEL](https://github.com/riscv-software-src/riscv-angel),看起来挺不错,所以同样也顺手[搭了一份](https://mabbs.github.io/riscv-angel/)。只不过它似乎用了一些更先进的语法,至少IE11上不能运行。
|
当然Bellard用纯JS编写虚拟机也不是独一份,他实现了x86的虚拟机,相应的也有人用纯JS实现了RISC-V的虚拟机,比如[ANGEL](https://github.com/riscv-software-src/riscv-angel),看起来挺不错,所以同样也顺手[搭了一份](https://mabbs.github.io/riscv-angel/)。只不过它似乎用了一些更先进的语法,至少IE11上不能运行。
|
||||||
另外还有一个比较知名的项目,叫做[jor1k](https://github.com/s-macke/jor1k),它模拟的是OpenRISC架构。只是这个架构目前已经过时,基本上没什么人用了,不过这里面还内置了几个演示的小游戏,看起来还挺有意思。
|
另外还有一个比较知名的项目,叫做[jor1k](https://github.com/s-macke/jor1k),它模拟的是OpenRISC架构。只是这个架构目前已经过时,基本上没什么人用了,不过这里面还内置了几个演示的小游戏,看起来还挺有意思。
|
||||||
|
|||||||
34
_posts/2026-02-08-xslt.md
Normal file
34
_posts/2026-02-08-xslt.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: 在Google杀死XSLT之后的XML美化方案
|
||||||
|
tags: [XML, Feed, XSLT, 美化]
|
||||||
|
---
|
||||||
|
|
||||||
|
即使没有了XSLT,也不能让读者看到光秃秃的XML!<!--more-->
|
||||||
|
|
||||||
|
# 起因
|
||||||
|
在半年前,我写了一篇[用XSLT美化博客XML文件](/2025/07/01/xslt.html)的文章,自从那以后,每次我在浏览其他人博客的时候,都会看一眼对方博客有没有给自己的订阅文件做美化。不过就在前段时间,我在浏览某个博客的时候,发现他博客的订阅文件,甚至连最基本的XML文档树都没有显示出来。这时候我打开开发者工具看了一眼源代码,发现他也并没有使用`xml-stylesheet`之类的指令……而且控制台貌似报了些错,好像是出现了什么CSP错误……于是我就想,浏览器显示XML文档树的本质,会不会其实也是一种XSLT?之所以报错也有可能是浏览器在自动引用内置的XSLT时违反了CSP。所以我就问了问谷歌AI,结果似乎真的是这样,比如火狐浏览器就内置了一份[XSLT文件](https://github.com/mozilla-firefox/firefox/blob/main/dom/xml/resources/XMLPrettyPrint.xsl),IE浏览器也有。正当我为XSLT的功能感到强大时,谷歌AI随后提到,[Chrome浏览器决定弃用XSLT](https://developer.chrome.com/docs/web-platform/deprecating-xslt),所以以后不要再用XSLT了😰……
|
||||||
|
我给我的订阅文件加美化功能才半年,怎么就要不能用了?XSLT出现这么多年都还能用,结果等我加上就要废弃了?当时为了增加这个功能,还是费了不少劲的,怎么能让谷歌说没就没?于是我就开始对这件事进行了调查。
|
||||||
|
|
||||||
|
# Google杀死了XSLT
|
||||||
|
从上面Chrome的弃用XSLT文档中,可以发现,这件事的始作俑者是[Mason Freed](https://github.com/mfreed7),他在WHATWG中发起了一个[Issue](https://github.com/whatwg/html/issues/11523),因为XSLT用的人很少,以及实现XSLT的库很老而且容易出漏洞,所以建议把XSLT从Web标准中删除。在这个Issue中可以发现,有很多人表示不满,毕竟这个功能对想要给自己订阅做美化的博主来说还是很有用的。为了对抗谷歌,还有人做了个网站: <https://xslt.rip> 。
|
||||||
|
而且XSLT虽然用的人占比也许不高,但从总量上应该还是挺多的,除了用XSLT美化博客订阅的,甚至还有用[XSLT作为博客框架的](https://github.com/vgr-land/vgr-xslt-blog-framework),另外还有一些人提出[一部分政府网站也有使用XSLT](https://github.com/whatwg/html/issues/11582)。
|
||||||
|
不过Freed看起来对这件事早有准备,他做了一个[Polyfill库](https://github.com/mfreed7/xslt_polyfill),通过WASM的方式让XSLT可以正常工作,为了方便大家使用这个库,我顺手给CDNJS发了个[PR](https://github.com/cdnjs/packages/pull/2118),以后可以用CDN引用它了。不过使用这个库的前提是需要在订阅中加一段引用JS的代码,像我博客中的Atom订阅,用的是[jekyll-feed](https://github.com/jekyll/jekyll-feed)插件,里面的格式都是写死的,就用不了了……
|
||||||
|
只不过现在已经没办法阻止谷歌了……而且其他浏览器也表示会跟进,看来我们唯一能做的就是去适应了。
|
||||||
|
|
||||||
|
# 没有XSLT之后的美化方案
|
||||||
|
## 纯CSS
|
||||||
|
虽然XSLT不能用,但不代表`xml-stylesheet`指令就不能用了,除了XSLT之外,`xml-stylesheet`同样可以引用CSS。只是似乎完全没见过用CSS美化订阅源的,也许是因为光用CSS能做到的事比较少吧,想用CSS给XML文档加链接之类的估计就做不到了。
|
||||||
|
但目前能选择的也不多了,既然大家都没写过用CSS美化订阅源,那就让我来写一个吧!然而我并不会写😅……那就只好让AI来写了,我把需求说清楚之后,AI就写出来了:[feed.css](/assets/css/feed.css)。试了一下效果还挺不错的,我让AI写的这个版本无论是RSS还是Atom都可以使用,如果有人感兴趣可以拿去用。可惜我的Atom订阅因为用的是插件的原因用不了😭,只能加到用纯Liquid实现的RSS订阅上了。
|
||||||
|
但用纯CSS的缺点也很明显,没办法操作文档的内容,像修改日期格式的就做不了了,而且也不能添加超链接……XML的标签本身对浏览器来说并没有内建的语义,正常情况下也没法让浏览器把某个标签当作超链接。那难道就没办法了吗?
|
||||||
|
## 混合XHTML
|
||||||
|
如果完全不能修改XML内容,那确实就没有办法了,但如果能修改XML的内容那还是有办法的,简单来说就是混入XHTML,事实上Freed编写的Polyfill库原理上也是利用了XHTML,只要在能作为XHTML的标签中添加XHTML的命名空间,那么浏览器就可以理解它的语义并渲染,像刚刚用纯CSS美化的订阅没有链接,那就可以在根元素中添加命名空间:`xmlns:xhtml="http://www.w3.org/1999/xhtml"`,然后在合适的位置写:
|
||||||
|
```xml
|
||||||
|
<xhtml:a href="https://example.com">Read more -></xhtml:a>
|
||||||
|
```
|
||||||
|
就可以了。只是这样有个缺点,这样写的订阅文件不够“纯粹”,用验证器验证会显示“[Misplaced XHTML content](https://validator.w3.org/feed/docs/warning/MisplacedXHTMLContent.html)”警告。对有洁癖的人来说可能会有点难受😆。
|
||||||
|
不过如果能接受这种“不纯粹”,那么其实`xml-stylesheet`指令也没必要了,`link`标签一样可以用,包括`script`也是,所以有人写了一个[不使用XSLT美化XML](https://github.com/dfabulich/style-xml-feeds-without-xslt)的库。
|
||||||
|
只不过这种方法和XSLT相比还是有一些缺陷,要知道XSLT的本质是转换,是把XML转换为HTML,也就是说转出来的文档本质是HTML,所有的DOM操作都和操作HTML是完全相同的,但是在XML里混入XHTML标签就不一样了,它的本质依然是XML文档,只是嵌入了XHTML命名空间下的元素,所以相应的DOM操作会有一些不同。如果是自己写的纯JS可能还好,如果是用了jQuery之类假定DOM为HTML的库就会出现问题了,因此这也就是那个Polyfill库的局限性,用正常的XSLT执行`document.constructor`会显示`HTMLDocument`,而用这个Polyfill库执行完则是显示`XMLDocument`。因此,直接套用为浏览器原生XSLT编写的旧样式文件,就有可能会出问题,但如果要考虑改XSLT的话那还不如重新写JS,然后用XHTML引入呢。
|
||||||
|
|
||||||
|
# 感想
|
||||||
|
虽然有一些技术会因为各种各样的原因消失,但这不代表我们就要妥协一些东西,总有一些不同的技术可以解决相同的问题,所以我们只需要用其他的技术去实现就好了。不过这也是没办法的事情,毕竟没人能改变浏览器厂商们的决策啊😂。
|
||||||
35
_posts/2026-03-01-llm3.md
Normal file
35
_posts/2026-03-01-llm3.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: 近期LLM的部署与应用经历(3)
|
||||||
|
tags: [AI, LLM, 模型部署, 使用体验]
|
||||||
|
---
|
||||||
|
|
||||||
|
用更多的方式探索AI!<!--more-->
|
||||||
|
|
||||||
|
# 起因
|
||||||
|
在一年前,我[整了张RTX4090 48GiB魔改版](/2025/02/22/llm.html)用来跑DeepSeek-R1 70B的4bit量化模型,不过都已经过了这么长时间,这个模型也已经是过时的东西了……我之前在[Mac Studio M3 Ultra](/2025/05/07/mac-studio.html)上试了一下OpenAI在半年前出的gpt-oss-120b模型,感觉效果还挺不错,只不过因为M3 Ultra的GPU实际性能比不上正经高端的独显,所以它在上下文很长的情况下还是有点慢,因此我又整了张RTX4090 48GiB,想整个双路试试更快的GPT-OSS模型,总共96GiB的显存应该够跑这个模型了。
|
||||||
|
|
||||||
|
# 在两张RTX4090 48G上运行GPT-OSS
|
||||||
|
既然现在我手头有两张4090了,那继续用i5-8400处理器的主机似乎不太合适,主要是那个主板就一个PCIe插槽,想插两张显卡也做不到,那买个新的不知道买啥……不管怎么说既然用这么高级的显卡,至少得让它跑满。在两张显卡上跑模型似乎卡间的通信速度比较重要,那最起码得整个支持2个PCIe4.0 x16的板U套装才行,这种级别的没有消费级产品,只能考虑服务器或工作站了。不过我对服务器和工作站了解得并不多,所以就问了问AI哪个支持2个PCIe4.0 x16的平台最便宜,结果AI推荐了TRX40+[TR 3960X](https://www.amd.com/zh-cn/support/downloads/drivers.html/processors/ryzen-threadripper/ryzen-threadripper-3000-series/amd-ryzen-threadripper-3960x.html),于是就按照AI的说法整了一套。
|
||||||
|
这套板U差不多4000CNY,价格倒是还行,如果买现役的估计主板都比显卡贵了。但后来我发现这个并不是最便宜的😂,搜了一下买寨版+[EPYC 7502](https://www.amd.com/zh-cn/support/downloads/drivers.html/processors/epyc/epyc-7002-series/amd-epyc-7502.html)还能再便宜1000CNY,而且通道数更多,插4张显卡都没问题……不过买都买了,就先用吧,看来AI的话不能随便信😥。
|
||||||
|
之前我跑模型为了方便,基本上都用的是[Ollama](https://github.com/ollama/ollama),不过听说Ollama多卡运行的效率很低,而且多并发的效果不太好,所以这次换了新电脑之后我想试试[vLLM](https://github.com/vllm-project/vllm),据说一般生产级的AI都用的是这个框架。
|
||||||
|
安装vLLM倒是比想象得简单很多,直接一句`pip install vllm`就可以了,其实并没有比Ollama复杂多少。我看了一下[OpenAI](https://developers.openai.com/cookbook/articles/gpt-oss/run-vllm/)和[vLLM](https://docs.vllm.ai/projects/recipes/en/latest/OpenAI/GPT-OSS.html)运行GPT-OSS的官方文档,发现启动也非常简单,一般来说直接执行`vllm serve openai/gpt-oss-120b`就可以。不过直接执行是对于单卡的,我用两张卡需要加个`--tensor-parallel-size 2`参数启用张量并行,不然会爆显存。另外考虑到这个模型本身占掉60多GiB的显存之后剩下30GiB还是看起来有点少,所以额外加了个`--kv-cache-dtype fp8`参数降低上下文对显存的占用,毕竟模型本身也就是4bit量化的,加了这个应该不会对它的能力有什么影响。除此之外AI还给我推荐了个`--enable-chunked-prefill`参数,说是也能避免爆显存的问题。
|
||||||
|
一切准备好之后直接执行,程序就自动开始下载模型了,过了几个小时,终于下载完成,顺便一说启动的时候还显示推荐安装`torch_c_dlpack_ext`库,虽然不知道是干啥的,但也顺手安装了。启动完成之后我试了一下,效果非常好,不并发的情况下直接用能达到接近190Tps,可以说是相当快了,而且这个模型的水平也算是开源中的上游水平,应该算是又快又好吧……看来多来一张4090还是挺划算嘛。只不过这个东西基本上就我一个人用,所以也没什么能测一下并发的场景……虽然很快,但还是有点浪费性能吧。
|
||||||
|
|
||||||
|
# 最近DeepSeek 1M上下文的使用体验
|
||||||
|
前段时间DeepSeek又出了新的模型,最高可以支持1M长的上下文,而且听说模型规模变小了,所以速度也很快。可惜的是到目前为止还没有开放权重。当然就算开放权重了用2张4090估计也没有足够的显存分配给上下文,至于Mac Studio感觉在长上下文的情况下运行速度应该会很慢……
|
||||||
|
不过我对这个1M上下文还是挺感兴趣,因为好久之前我写过一篇[关于LLM能力上限](/2025/04/22/ai-limit.html)的文章,在那篇文章中其实我遇到的问题基本上也就是由上下文不足导致的。那既然现在DeepSeek支持了1M的上下文,那我就应该试试之前因为局限性而妥协的一些东西了。
|
||||||
|
这次我没有用摘要,而是直接把包含整个博客内容的[search.json](/search.json)文件上传到DeepSeek,然后向它问了问我的一些问题。试了一下效果非常不错,用摘要会省略的一些细节它基本上都可以展现出来,我试了试让它给我生成一份简历,它甚至在所有文章中找到了我的博客地址、GitHub和邮箱地址,之前用摘要显然是做不到这一点的,这个长上下文还是挺有用啊。
|
||||||
|
另外我还试了试让它根据文章内容分析十六型人格,并且我自己去答了一遍那个测试,结果也是相同的,说明它真的是在几秒内就读完了我的所有文章而且也完全理解了,真的是非常厉害。
|
||||||
|
只是拿AI分析我的文章也许只有我自己了😂,实际上根本没人对我感兴趣,也就只有我自己拿来给自己看……当然如果我的博客能比我活得长,不知道会不会有未来人会对我感兴趣呢……总之对于现在肯定是毫无意义了。
|
||||||
|
除了这些之外,我又试了一下让DeepSeek重构我的[Mabbs](https://github.com/Mabbs/Mabbs.Project),这次生成效果看起来很不错了,虽然代码我没细看,不确定能不能运行,但至少没有偷懒只写一点点,一口气写了80KiB多的代码,这也是长上下文带来的好处吧。总之目前这个长上下文的DeepSeek也算是突破了之前我认为的上限,看来LLM真的是前景无限啊。
|
||||||
|
另外我发现这次更新的DeepSeek居然了解我的博客,我问了一下它“你知道Mayx的博客是哪个博客吗?”,它居然知道,能说出域名,而且还知道我的博客是关于技术的😎,看来这次的训练样本中包含我的信息啊……所以我对这次的更新也挺有好感,毕竟我的知识如果能成为AI的一部分,也算是一种永恒吧。
|
||||||
|
|
||||||
|
# 在8GiB内存的MacBook运行的新模型
|
||||||
|
在3年前,我在[探索AI](/2023/04/05/ai.html)时,在我只有8GiB内存的[MacBook Pro](/2023/02/03/mbp.html)上运行了非常早期的LLM——Alpaca-7B,那时候7B的LLM虽然能回答一些问题,但答非所问的情况也非常多。不过最近我发现了一个有意思的LLM,叫做[LFM2.5-1.2B-Thinking](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Thinking),它只用了12亿的参数就有思维链,而且水平据说还挺强。这么长时间过去之后我倒也想看看我的MacBook能运行多聪明的模型,所以就试着跑了一下它。
|
||||||
|
运行它也很容易,一般用Ollama就可以,但是Ollama只有TUI,不能渲染Markdown,我也不太想在我的Mac上整WebUI之类的东西……那有什么好的选择吗?我去制作这个模型的公司官网看了一下,他们制作这个模型本就是为了在端侧运行,所以也专门制作了一个软件运行他们的模型,叫做[Apollo](https://www.liquid.ai/apollo),在手机和Mac上都可以用。我在我的Mac上安装试了一下,效果很好,首先速度非常快,8bit量化正常情况下可以达到60多Tps,即使是省电模式,也能达到20多Tps。另外加上思维链它的思考能力也还不错,虽然一些脑筋急转弯的题不算擅长,但是正常对话,回答问题之类的表现都很不错,相比于之前7B的模型表现好太多了。当然考虑到都已经过去3年了,能有这样的进步也很正常,不过12亿参数就能有这样的智能还是相当可以啊。
|
||||||
|
这个模型之所以有这样的能力似乎是因为他们并不完全是Transformer架构,而是使用的一种叫做LFM2的混合架构,按照大家对他们公司(Liquid AI)以及这个架构名字的理解,可能会觉得这个模型基于液态神经网络,不过我让AI看了一下他们的代码似乎并不是,他们用的是一种类似于Mamba的架构,这种架构似乎就很擅长在小参数的模型下比Transformer模型表现的更好,所以说这种变化也是算法进步带来的。
|
||||||
|
顺便一说这个Apollo除了运行他们自己的模型之外也能连接其他兼容OpenAI接口的模型,正好可以用来连接我的GPT-OSS,这样我就可以不需要下载一些浏览器套壳的重型应用来用我的模型了😝。
|
||||||
|
|
||||||
|
# 感想
|
||||||
|
自从ChatGPT之后,AI的发展真是越来越强了,而且能看出来目前甚至并不需要多新多好的硬件就能让一般人获得还不错的智能(当然训练也许还是要大量的硬件),这么看来AI软件的发展还是相当有潜力。目前来看既然优化软件就能做得越来越好,那也许在有限的硬件环境下可以期待无限的智能吧。
|
||||||
32
_posts/2026-04-14-ai-agent.md
Normal file
32
_posts/2026-04-14-ai-agent.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: 关于AI个人助理的探索
|
||||||
|
tags: [AI, Agent, 个人助理]
|
||||||
|
---
|
||||||
|
|
||||||
|
给AI添加手脚能有多少种方法?<!--more-->
|
||||||
|
|
||||||
|
# 起因
|
||||||
|
最近像[OpenClaw](https://github.com/openclaw/openclaw)这样被叫做“AI个人助理”的Agent越来越火了,当然这种东西在我看来依然是新瓶装旧酒,整来整去还就是和AutoGPT一样。这种东西在当时GPT-3.5的时候就有了,现在只不过是增加了聊天软件交互的渠道便突然大火,和当年的Manus一样……实在是无法理解。
|
||||||
|
一年前我用过Devin.ai这个云端的Agent编写过[用JS解析订阅源](/2025/04/08/feed.html)的脚本,体验还算不错,既然现在已经过了一年,那就让我看看现在又有了什么样的发展吧。
|
||||||
|
|
||||||
|
# 使用AI个人助理
|
||||||
|
## 体验原生OpenClaw
|
||||||
|
虽然感觉OpenClaw对我的意义不大,但我还是安装体验了一下。不过在国内安装它还是相对有点困难,毕竟国内无论是访问GitHub,还是NPM都有点麻烦,而且还需要有LLM提供商的信息……安装好之后使用起来感觉问题也非常多,经常出现执行一半就停止执行,在它执行的过程中看到它的操作不正确的时候也不能发言打断,而且很多时候最终任务执行的效果也不太好,这也可能是我用的国产开源模型推理能力有限,没舍得用Claude之类先进模型的锅😂?
|
||||||
|
另外我也尝试让它加入MoltBook、MomoClaw、InStreet、百度贴吧抓虾吧之类的AI社区让它帮我宣传我的博客,但效果也很差,它每次发的时候会忘掉之前发的内容,结果就是同一篇内容发了好几遍……不过在这期间,有个叫PushMeBot的家伙在[Moltbook的帖子](https://www.moltbook.com/post/7f1b0e1f-5175-4fd1-ad78-856be8b66250)中让我的OpenClaw执行一个网络监视程序,最终安装好之后给我[发了9USDC](https://basescan.org/tx/0x44dbfe53f276201447f3877bf050a5d56adebf5fe05235264ee665da717e9373)😝,还挺有意思。
|
||||||
|
总之按照我的体验,实在是想不出它能火的理由,体验不算很好,而且还要安装Node环境,完全不像是能让大众轻松使用的东西。
|
||||||
|
不过这个项目似乎本身就是Vibe Coding的产物,体验不好也能理解,就看火了之后能有多少人完善它吧。
|
||||||
|
## 国内大厂的二开Claw
|
||||||
|
国内好多大厂倒是看中了这个东西的爆火,像腾讯就出了几款这样的软件,比如QClaw。它可以不需要配置额外的环境,能像传统的软件一样直接安装使用,而且有自带的模型,有一定的免费额度可以用。配置技能也比较简单,直接点击就可以完成。而且可以直接扫码关联微信,直接通过微信和它进行交流,可以说是相当的傻瓜化了。不过QClaw给的免费额度虽然用来聊天之类的没问题,但对于开发软件还是有点少,所以他们还出了个叫做WorkBuddy的软件,它送的初始额度比QClaw要多不少,所以更适合用来开发。只不过为啥腾讯要出两个功能一样的软件?看起来应该是不同团队出的,可能是面向的用户群体不一样,所以搞了两套吧?
|
||||||
|
## VSCode中的Agent
|
||||||
|
但要说开发的话,用作为“AI个人助理”的某些Claw其实并不合适,毕竟正常开发还是以人开发为主,全AI开发总会有些问题,所以开发的时候还是用编辑器集成的AI比较好。在三年前我就在用[GitHub Copilot](/2023/04/05/ai.html)了,到现在我依然在用。现在的Copilot已经支持了Agent功能,开发相比之前也是强了很多,只不过现在的我没有学生身份,Copilot Free偶尔也会出现不够用的情况。不过对于Agent这类功能实现起来还是太简单了,所以有人开发这种功能的插件也很正常,比如[Cline](https://github.com/cline/cline),Copilot只能用微软提供的几个模型,而Cline可以自定义模型,用起来也很方便。
|
||||||
|
## 微型开发板上运行的Claw
|
||||||
|
前段时间,我闲来无事看了一下两年前买的[Luckfox Pico Plus](/2024/02/24/luckfox.html)开发板的文档,偶然发现了一个很有意思的项目,叫做[LuckClaw](https://github.com/LuckfoxTECH/luckclaw),这是一个基于[nanobot](https://github.com/HKUDS/nanobot)用Golang重构的轻量个人AI助手,可以在仅仅64MiB内存的超有限环境下运行一个和OpenClaw功能几乎相当的AI个人助理,真的是非常厉害。
|
||||||
|
我在我的开发板上试了一下,体验很不错,安装不需要额外环境,直接下载就能使用,Go语言的程序确实方便。配置也很简单,直接执行`luckclaw config`就可以交互式进行模型等设置的配置,而且作为国产的应用,它也能很方便的对接国内聊天软件。只是限于开发板本身的能力,浏览器功能自然无法使用,所以搜索如果不借助那些需要API Key的AI专用接口,就基本上不能用……但总的来说效果已经非常不错了,至少有那些Claw的80%能力。
|
||||||
|
(2025.04.15补充:后来我发现这种超精简的Claw项目看起来还挺多,比如[ZeroClaw](https://github.com/zeroclaw-labs/zeroclaw)和[PicoClaw](https://github.com/sipeed/picoclaw),甚至还有给单片机用的[MimiClaw](https://github.com/memovai/mimiclaw)。而且有意思的是,PicoClaw是Luckfox的竞争对手开发的,但是LuckClaw中却包含PicoClaw字样的注释,结果功能也没PicoClaw强,关注度也更低,属于是没抄明白了🤣)
|
||||||
|
想到前段时间还有人为了OpenClaw专门买Mac Mini,就感觉很有意思😆,这个东西看起来应该是在路由器上都能跑。所以想要AI个人助理,硬件完全不是问题,只要整一个能24小时挂机的东西,就可以满足绝大多数人的需求了。
|
||||||
|
## 在手机上运行的Claw
|
||||||
|
其实很多人也有比开发板和路由器性能更强的闲置设备,那就是手机,所以有人开发了一款叫做[ApkClaw](https://github.com/apkclaw-team/ApkClaw)的软件,一样可以接入国内聊天软件。它既然能在手机上运行,当然和在其他平台运行的Claw相比有一个独特的优势,那就是操作手机应用。现在手机的应用相比电脑应用对于很多普通人来说功能更强大,所以它能做的事情可能比其他的Claw还多。我试了一下,配置也很方便,只不过能配置的项目太少了,看起来似乎没有安装Skill之类的功能,也许是因为它是相对早期的软件,所以功能还比较少吧。
|
||||||
|
|
||||||
|
# 感想
|
||||||
|
总的来说,现在的Agent依然没有非常明显的进步,问题依旧很多,只是化身“AI个人助理”之后,增加了不少应用场景。这倒也是好事,在广泛传播的过程中,也能让很多对技术了解不多,但是很有想法的人参与其中,也许能对AI的应用化增添不少力量吧。
|
||||||
76
_posts/2026-05-01-virtual-net.md
Normal file
76
_posts/2026-05-01-virtual-net.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: 虚拟局域网的组网探索记录
|
||||||
|
tags: [虚拟网络, 异地组网, WireGuard]
|
||||||
|
---
|
||||||
|
|
||||||
|
异地组网,有多少种选择?<!--more-->
|
||||||
|
|
||||||
|
# 起因
|
||||||
|
最近我有一些放置在许多不同地方的机器,有一些东西需要让它们之间能够相互访问。虽然我很久以前写过一篇使用[SSH进行互联](/2021/05/07/ssh.html)的文章,但这样做每个服务都需要单独配置,也不方便管理。所以为了能让机器之间能够轻松通信,我打算组建一个虚拟局域网,让它们像在同一交换机下一样。不过这种组网的工具非常多,我应该选哪个比较好呢?
|
||||||
|
|
||||||
|
# 不同组网工具的体验
|
||||||
|
## n2n
|
||||||
|
以前我用过一款用C写的叫做[n2n](https://github.com/ntop/n2n)的工具,它可以很轻松地组建一个P2P的二层虚拟网络,而且生态也不错,手机、电脑、路由器、服务器上都有可以用的客户端。使用起来非常简单,它的中继和穿透服务程序叫做Supernode,无需太多的配置,只要在有公网的服务器安装并使用`-p`指定一个端口就可以启动。而客户端配置也非常简单,用`-l`配置好Supernode的地址,然后让想要在同一个网络的机器使用相同的任意`-k`和`-c`就可以成功组网,可以说算是非常好用了。
|
||||||
|
唯一的问题就是它这个项目看起来似乎已经停止更新了……虽然大多数情况下用起来没问题,但是有时候还是会出现组网不太可靠的情况。如果两个机器都不经过NAT,可以通过公网IP连接,它的可靠性还可以。但如果是两个NAT后的机器之间,有时候会存在莫名掉线的情况,也许是因为穿透导致的不可靠?总之遇到这种情况之后重启又能正常工作,说明是软件本身的问题,但它停更了……所以对我来说它的可靠性不太够。(其实它还有个叫做[n3n](https://github.com/n42n/n3n)的继任者,不过知名度不高,所以生态也不太行)
|
||||||
|
## WireGuard
|
||||||
|
其实在这之后我本来是打算用L2TP/IPSec进行组网的,但看了一下貌似配置有点复杂,而且不够现代,现在想要组网貌似大多都推荐[WireGuard](https://git.zx2c4.com/wireguard-linux/)作为更现代的选择。只不过它和n2n相比来说是三层的虚拟网络,如果需要发送非TCP/IP协议的特别包,可能就用不了它吧,当然对我来说没有这种需求。它用起来也非常简单,不过正常情况下它设计是为了点对点传输,而且没有自带的NAT穿透功能,所以如果想要实现组网,就得搭一个星形网络,让互联网上的服务器作为虚拟的交换机,这个做起来倒也不复杂。首先,每个节点需要生成一个公私钥对作为身份证明,在安装好WireGuard之后执行`wg genkey`就能生成私钥。作为交换机的节点需要在`/etc/wireguard/wg0.conf`中写一个这样的配置:
|
||||||
|
```conf
|
||||||
|
[Interface]
|
||||||
|
PrivateKey = xxx
|
||||||
|
Address = 192.168.1.1/24
|
||||||
|
ListenPort = 51820
|
||||||
|
|
||||||
|
PostUp = iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT
|
||||||
|
PostDown = iptables -D FORWARD -i wg0 -o wg0 -j ACCEPT
|
||||||
|
|
||||||
|
# 机器1
|
||||||
|
[Peer]
|
||||||
|
PublicKey = xxx
|
||||||
|
AllowedIPs = 192.168.1.2/32
|
||||||
|
|
||||||
|
# 机器2
|
||||||
|
[Peer]
|
||||||
|
PublicKey = xxx
|
||||||
|
AllowedIPs = 192.168.1.3/32
|
||||||
|
```
|
||||||
|
其中PrivateKey填写交换机自己的私钥,而作为使用者的Peer中的PublicKey可以用对应节点的私钥执行`echo xxx | wg pubkey`这个命令查看,然后每个Peer需要像这样配置:
|
||||||
|
```conf
|
||||||
|
[Interface]
|
||||||
|
PrivateKey = xxx
|
||||||
|
Address = 192.168.1.2/24
|
||||||
|
|
||||||
|
[Peer]
|
||||||
|
PublicKey = xxx # 交换机节点的公钥
|
||||||
|
Endpoint = xxx.xxx.xxx.xxx:51820 # 交换机节点的地址
|
||||||
|
AllowedIPs = 192.168.1.0/24
|
||||||
|
PersistentKeepalive = 25
|
||||||
|
```
|
||||||
|
最后全都配置好之后所有节点使用`systemctl enable --now wg-quick@wg0`启动就可以了,启动之后每个节点可以执行`wg`查看当前的连接状态。
|
||||||
|
当然这是在Linux上,至于其他系统大多都有GUI配置,填起来更简单。它的生态也非常好,基本上常见的操作系统都支持,具体可以在[官网](https://www.wireguard.com/install/)查看支持的系统和安装方法。不过由于它在Linux中优先使用内核模块,导致我在一些比较小众的环境中也是遇到了各种特别的问题。
|
||||||
|
### 在红米AX3000中遇到的问题
|
||||||
|
我在这个网络中有几个安装了OpenWrt的路由器,在这其中使用联发科芯片的路由器基本上都没什么问题,官网能轻松下载到固件,也能很轻松地在软件包中找到WireGuard并安装,但我还有一台使用高通芯片的红米AX3000,似乎因为高通对资料管控得很严格,导致它没有官网的固件,最终我在GitHub上找了一个其他人自己编译的[固件](https://github.com/hzyitc/openwrt-redmi-ax3000/)。虽然它整起来有点麻烦,不过倒也能用,但是在我尝试安装WireGuard的时候遇到了麻烦……
|
||||||
|
它的软件包里有WireGuard,也能找到对应的内核模块安装包,但安装完之后没法启动……随后我看了一下它下载的[安装包](https://github.com/hzyitc/openwrt-redmi-ax3000/blob/gh-pages/ipq50xx-qsdk-kernel-5.4-openwrt-21.02-qsdk-11.5.05.841.1029/ci-20240727-173350-ab1f9ffa/kmod-wireguard_5.4-qsdk-11.5.0.5-1_arm_cortex-a7_neon-vfpv4.ipk),结果发现是空的😰,它这个固件的内核模块可能是在编译的时候遇到了一些问题。至于让我自己编译这个内核模块,难度似乎有点高了……那怎么办呢?要知道Linux的内核模块都是和内核挂钩的,没办法随便找一个别的模块使用。还好WireGuard倒也不止有内核模块,也有一些在用户空间中的实现,比如[wireguard-go](https://git.zx2c4.com/wireguard-go)和[wireguard-rs](https://git.zx2c4.com/wireguard-rs)。只是官方似乎非常不推荐在Linux上使用它们,所以没有提供预编译的版本。不过遇到这种问题的人也许是比较多,所以有人做了在[OpenWrt上使用的wireguard-go](https://github.com/seud0nym/openwrt-wireguard-go),安装好之后效果和使用内核模块的感觉基本上没什么区别,最终也能连通,唯一的区别就是在执行`wg`的时候,会显示“Interface: wg0 (userspace)”罢了。从效率上来说虽然肯定没有内核模块那么高,但它其实也用了“Tun”模块,理论上和使用“Tap”模块的n2n应该差不多吧。
|
||||||
|
### 在openEuler中遇到的问题
|
||||||
|
在我使用的节点中,还有一台安装了openEuler 22.03 LTS操作系统的服务器,虽然openEuler和CentOS可以说基本上没什么区别,但毕竟它的内核是openEuler自己编译的,所以没办法直接使用CentOS的内核模块。并且openEuler的源中也完全没有提供和WireGuard相关的包,所以想要在openEuler上安装WireGuard还是有些挑战(当然如果觉得麻烦,它们倒是有一个兼容WireGuard的客户端[TunSafe](https://eur.openeuler.openatom.cn/coprs/nucleo/tunsafe/)可以凑活用一下)。
|
||||||
|
后来我试了一下在这上面安装wireguard-tools倒是可以直接用[CentOS 8EPEL源中的包](https://mirrors.tuna.tsinghua.edu.cn/epel/8/Everything/x86_64/Packages/w/wireguard-tools-1.0.20210914-1.el8.x86_64.rpm),但openEuler的内核在编译的时候故意没有包含WireGuard内核模块……这该怎么办呢?用wireguard-go吗?虽然这样可以很简单地解决,但感觉这样就是认输了😂。后来我搜了一下,找到了一篇[在openEuler安装WireGuard内核模块](https://dingle.site/archives/wei-openeulertian-jia-wireguardmo-kuai)的文章,方法大致如下:
|
||||||
|
1. 首先安装编译环境和源代码。
|
||||||
|
```bash
|
||||||
|
yum install elfutils-libelf-devel kernel-devel pkgconfig "@Development Tools"
|
||||||
|
yum install kernel-headers.x86_64 pkg-config ncurses-devel openssl-devel dwarves
|
||||||
|
yum install kernel-source.x86_64
|
||||||
|
```
|
||||||
|
2. 然后进行编译配置,内核源码一般会安装到`/usr/src/`下,找到之后在里面执行`make menuconfig`,然后勾选“Device Drivers -> Network device support -> Wireguard secure network tunnel”并保存。
|
||||||
|
3. 最后执行`make`开始编译,为了加速可以用`-j`参数加上CPU的核心数进行并行编译,当时编译就花掉了一整天😂,理论上应该可以只编译WireGuard和它依赖的几个模块,不过我不太清楚怎么做,还是费点时间按照文中说的做吧。
|
||||||
|
4. 执行`make modules_install`将编译好的结果安装到`/lib/modules/5.10.0`。
|
||||||
|
不过系统似乎不会去这个路径下找内核模块,所以还得把这里面的kernel文件夹复制到`/lib/modules/$(uname -r)`下,然后执行`depmod -a`更新模块依赖。
|
||||||
|
5. 最后执行`modprobe wireguard`验证模块是否能正常加载,如果没有报错并且可以在`lsmod | grep wireguard`中看到,就说明安装成功了,剩余的步骤和其他Linux系统一样。
|
||||||
|
|
||||||
|
### WireGuard的控制平面
|
||||||
|
虽然WireGuard本身配置很简单,但每加一个节点还得在交换机节点上修改一下配置文件,稍微有些麻烦,所以有人开发了一些控制平面,让它可以被更规范地管理,比如[Netmaker](https://github.com/gravitl/netmaker)和[Headscale](https://github.com/juanfont/headscale)。而Headscale主要是为Tailscale客户端开发的开源服务器端,因此功能会局限于Tailscale提供的功能。所以如果没有用过Tailscale,可以优先考虑Netmaker。
|
||||||
|
这两个控制平面支持的功能相当丰富,而且它们还支持让WireGuard进行NAT穿透,自动组建Mesh网络,不像我一堆在NAT后的设备还要直接使用WireGuard就只能搭成星形网络。只不过对我来说,我也用不到那么多企业级功能,这个服务端配置起来也有点麻烦,而且我也没有很多节点需要动态增减,我的云端服务器带宽也足够使用,所以就没有用这些东西了😆。
|
||||||
|
## 其他的组网工具
|
||||||
|
除了WireGuard之外,还有很多其他的组网工具,比如[VNT](https://github.com/vnt-dev/vnt)和[EasyTier](https://github.com/EasyTier/Easytier),这俩用起来也非常简单,只需要加几个参数就能组网,和n2n一样。不过功能相比于n2n来说要强大不少,也支持NAT穿透,而且还都兼容WireGuard协议,另外不像WireGuard强制使用UDP传输,这两个还能用TCP和WebSocket,在特殊网络环境下应该比直接用WireGuard更好。另外它们都是Rust编写的,也许会更安全😋?可惜我已经配好WireGuard之后懒得再改了,如果以后有机会,可以尝试一下。
|
||||||
|
|
||||||
|
# 总结
|
||||||
|
现在如果想要异地搭建虚拟局域网,还是有相当多的选择,而且无论是性能还是配置难度,都比以前好了不少。看来这种需求还是相当多啊,也正是因为有这些需求,所以才会出现这么多的方案可以用吧……总之我最后还是选择了纯WireGuard方案,主要还是简单够用,可靠性也不错,而且折腾了这么多再换也不太合适吧🤣。
|
||||||
210
_posts/2026-06-01-dedupe.md
Normal file
210
_posts/2026-06-01-dedupe.md
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: 如何节约游戏占用的硬盘空间?
|
||||||
|
tags: [dedupe, RPG制作大师, 游戏]
|
||||||
|
---
|
||||||
|
|
||||||
|
浪费硬盘空间是可耻的!<!--more-->
|
||||||
|
|
||||||
|
# 起因
|
||||||
|
在几年前,我写过一篇在[MacBook上玩游戏](/2023/10/21/game.html)的文章,在那之后,我已经在我的Mac上下载了几十部游戏。只不过有个问题……我的Mac只有256GiB的硬盘存储空间,下载一堆游戏会让我的硬盘空间不够用,但是又不太想删,所以我该怎么尽可能让游戏占用更少的空间呢?
|
||||||
|
首先为了能在Mac上尽可能流畅地玩,我玩的游戏大多都是用跨平台能力很强的引擎编写的游戏,比如[Ren'Py](https://github.com/renpy/renpy)、RPG制作大师、Godot之类的,而像RPG制作大师这种引擎制作的游戏还有一个特点,开发者一般都会使用引擎自带的素材进行开发,有时候还会用不少第三方的罐头素材之类的(实际上甚至还有好多AVG为了蹭这些引擎的公用素材刻意用它们),所以这几十个游戏里应该有非常多的重复素材,如果能想办法把它们去个重,应该能节省相当多的空间吧……
|
||||||
|
|
||||||
|
# 去重的方法
|
||||||
|
如果想要对文件进行去重,我搜了一下,有个叫做[jdupes](https://codeberg.org/jbruchon/jdupes)的工具就很不错,它支持多种去重方式,比如使用硬链接,或者用一些文件系统的写时复制特性。不过如果用写时复制特性,jdupes在第二次执行的时候会认为去重后的文件还是单独的文件,就会重复去重了,而且最终也不好统计,反正对我玩的游戏来说,要去重的都是游戏素材,不存在后续修改的可能性,所以我打算全部用硬链接。
|
||||||
|
所以最终要执行的命令也非常简单,直接一句`jdupes -r -L Game`就可以了,这样以后每次下载了新的游戏之后重复执行这个操作,就可以将游戏中和其他游戏里有的素材去重了。
|
||||||
|
不过实际上很多游戏并不能直接用这种方式去重,因为它们的资源文件有些是打包成单个文件,有些进行了简单的加密,导致即使是相同的素材,文件也并不相同,所以我必须让所有的资源以单独原始的形态出现。对于不同的引擎也有不同的处理方式,所以接下来我需要对它们进行一些研究。
|
||||||
|
|
||||||
|
# 不同引擎的处理方式
|
||||||
|
## RPG制作大师MV/MZ
|
||||||
|
对于RPG制作大师MV/MZ开发的游戏来说,解密很简单,比较知名的是一个叫做[RPG-Maker-MV-Decrypter](https://gitlab.com/Petschko/RPG-Maker-MV-Decrypter)的工具,它可以在浏览器中进行解密,但一个游戏的资源文件非常多……要是全上传给浏览器实在是太麻烦了……后来我又搜了一下,有一个用C#写的叫[RPG Maker Decrypter](https://github.com/uuksu/RPGMakerDecrypter)工具也很不错,它作为命令行工具比在浏览器中执行简单多了,而且还能只把资源文件单独提出来,这样就可以剔除掉游戏自带的浏览器文件。不过他这个仓库的代码有个问题,它在选择文件的时候似乎会区分大小写,文件夹名中含有大写字母的似乎会被剔除……这样不太符合我的要求啊,当然我不会C#,于是我用AI改了一下,还给他提了个[PR](https://github.com/uuksu/RPGMakerDecrypter/pull/28),不过这家伙看起来似乎不太喜欢AI写的代码,看起来不打算合我的PR😅。不过无所谓了,反正我也是自用,他爱合不合吧。
|
||||||
|
这个工具的用法也非常简单,一句`RPGMakerDecrypter-cli [input] -p -o [output]`就处理好了,处理完之后只需要把`data/System.json`中的`hasEncryptedImages`和`hasEncryptedAudio`设置为false就可以正常识别,以后在Mac中只要在游戏路径下执行`python3 -m http.server`就可以在浏览器中游玩了。
|
||||||
|
在这个过程中,我还发现有一些游戏喜欢把原画文件直接放到游戏里面,一张图片好几M,但RPG制作大师的引擎在渲染的时候根本不会渲染出那么高的分辨率,结果毫无意义地浪费一大堆存储空间,而且因为图片是加密的,对大多数人来说也没有收藏价值。所以在解密完之后我就想干脆把这些图片全部有损压缩一遍,估计能节省不少存储空间,于是让AI写了个简单的压缩脚本处理了一下:
|
||||||
|
```python
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
图片压缩脚本(多进程版本)
|
||||||
|
将 pictures.orig 文件夹中的图片使用 WebP 格式进行高效压缩,
|
||||||
|
保持分辨率不变,肉眼看不出差异,压缩后的图片保存到 pictures 文件夹。
|
||||||
|
|
||||||
|
使用方法:
|
||||||
|
python3 compress_images.py
|
||||||
|
|
||||||
|
压缩策略:
|
||||||
|
- 保持原始分辨率不变
|
||||||
|
- 使用 WebP 格式(有损压缩,高质量)
|
||||||
|
- 质量设置为 85,在保持视觉质量的同时显著减小文件大小
|
||||||
|
- 文件名和后缀保持不变
|
||||||
|
- 多进程并行处理
|
||||||
|
- 处理失败时自动复制原文件
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from PIL import Image
|
||||||
|
from pathlib import Path
|
||||||
|
from multiprocessing import Pool, cpu_count
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
# 配置路径
|
||||||
|
SOURCE_DIR = "pictures.orig"
|
||||||
|
OUTPUT_DIR = "pictures"
|
||||||
|
|
||||||
|
# WebP 质量设置 (0-100,数值越高质量越好,文件也越大)
|
||||||
|
# 85 是一个很好的平衡点,肉眼几乎看不出差异
|
||||||
|
WEBP_QUALITY = 85
|
||||||
|
|
||||||
|
# 对于带有透明通道的图片,可以设置不同的质量
|
||||||
|
WEBP_QUALITY_WITH_ALPHA = 80
|
||||||
|
|
||||||
|
# 并行进程数,默认为 CPU 核心数
|
||||||
|
NUM_WORKERS = cpu_count()
|
||||||
|
|
||||||
|
|
||||||
|
def compress_single_image(img_file: tuple[str, str, str]) -> tuple[str, bool, int, int]:
|
||||||
|
"""
|
||||||
|
压缩单个图片文件(用于多进程)
|
||||||
|
|
||||||
|
Args:
|
||||||
|
img_file: (源文件路径, 输出文件路径, 输出目录) 元组
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
(文件名, 是否成功, 原始大小, 压缩后大小) 元组
|
||||||
|
"""
|
||||||
|
source_path, output_path_str, output_dir = img_file
|
||||||
|
source_path = Path(source_path)
|
||||||
|
output_path = Path(output_path_str)
|
||||||
|
|
||||||
|
original_size = source_path.stat().st_size
|
||||||
|
|
||||||
|
try:
|
||||||
|
img = Image.open(source_path)
|
||||||
|
|
||||||
|
# 检查是否有透明通道
|
||||||
|
has_alpha = img.mode in ('RGBA', 'LA', 'PA') or (img.mode == 'P' and 'transparency' in img.info)
|
||||||
|
|
||||||
|
# 确定使用的质量
|
||||||
|
quality = WEBP_QUALITY_WITH_ALPHA if has_alpha else WEBP_QUALITY
|
||||||
|
|
||||||
|
# 保存为 WebP 格式,但使用原始的文件扩展名
|
||||||
|
img.save(
|
||||||
|
str(output_path),
|
||||||
|
format='WEBP',
|
||||||
|
quality=quality,
|
||||||
|
method=6 # 压缩方法 0-6,6 是最慢但压缩率最高的
|
||||||
|
)
|
||||||
|
|
||||||
|
compressed_size = output_path.stat().st_size
|
||||||
|
return (source_path.name, True, original_size, compressed_size)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 处理失败时,复制原文件到输出目录
|
||||||
|
try:
|
||||||
|
shutil.copy2(source_path, output_path)
|
||||||
|
compressed_size = output_path.stat().st_size
|
||||||
|
return (source_path.name, False, original_size, compressed_size)
|
||||||
|
except Exception as copy_error:
|
||||||
|
return (source_path.name, False, original_size, 0)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
source_dir = Path(SOURCE_DIR)
|
||||||
|
output_dir = Path(OUTPUT_DIR)
|
||||||
|
|
||||||
|
# 检查源目录是否存在
|
||||||
|
if not source_dir.exists():
|
||||||
|
print(f"错误: 源目录 '{SOURCE_DIR}' 不存在")
|
||||||
|
return
|
||||||
|
|
||||||
|
# 创建输出目录
|
||||||
|
output_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
# 获取所有图片文件(支持多种格式)
|
||||||
|
image_extensions = ('*.png', '*.jpg', '*.jpeg', '*.bmp', '*.gif', '*.tiff', '*.webp')
|
||||||
|
image_files = []
|
||||||
|
for ext in image_extensions:
|
||||||
|
image_files.extend(source_dir.glob(ext))
|
||||||
|
image_files = sorted(set(image_files)) # 去重并排序
|
||||||
|
|
||||||
|
if not image_files:
|
||||||
|
print(f"在 '{SOURCE_DIR}' 中没有找到图片文件")
|
||||||
|
return
|
||||||
|
|
||||||
|
# 构建任务列表
|
||||||
|
tasks = []
|
||||||
|
for img_file in image_files:
|
||||||
|
output_path = output_dir / img_file.name # 保持原文件名和后缀
|
||||||
|
tasks.append((str(img_file), str(output_path), str(output_dir)))
|
||||||
|
|
||||||
|
print(f"找到 {len(tasks)} 个图片文件")
|
||||||
|
print(f"源目录: {SOURCE_DIR}")
|
||||||
|
print(f"输出目录: {OUTPUT_DIR}")
|
||||||
|
print(f"WebP 质量设置: {WEBP_QUALITY}")
|
||||||
|
print(f"并行进程数: {NUM_WORKERS}")
|
||||||
|
print("-" * 70)
|
||||||
|
|
||||||
|
# 使用多进程池处理图片
|
||||||
|
success_count = 0
|
||||||
|
fail_count = 0
|
||||||
|
total_original = 0
|
||||||
|
total_compressed = 0
|
||||||
|
|
||||||
|
with Pool(processes=NUM_WORKERS) as pool:
|
||||||
|
for i, (filename, success, original_size, compressed_size) in enumerate(pool.imap(compress_single_image, tasks), 1):
|
||||||
|
total_original += original_size
|
||||||
|
total_compressed += compressed_size
|
||||||
|
|
||||||
|
if success:
|
||||||
|
success_count += 1
|
||||||
|
marker = "✓"
|
||||||
|
reduction = (1 - compressed_size / original_size) * 100 if original_size > 0 else 0
|
||||||
|
status_msg = f"{reduction:+.1f}%"
|
||||||
|
else:
|
||||||
|
fail_count += 1
|
||||||
|
marker = "✗"
|
||||||
|
status_msg = "复制原文件"
|
||||||
|
|
||||||
|
status = f"[{i}/{len(tasks)}] {filename}"
|
||||||
|
print(f"{marker} {status:50} {original_size/1024:>8.1f}KB -> {compressed_size/1024:>8.1f}KB ({status_msg})")
|
||||||
|
|
||||||
|
# 输出总结
|
||||||
|
print("-" * 70)
|
||||||
|
total_reduction = (1 - total_compressed / total_original) * 100 if total_original > 0 else 0
|
||||||
|
print(f"压缩完成!")
|
||||||
|
print(f" 成功处理: {success_count}/{len(tasks)} 个文件")
|
||||||
|
if fail_count > 0:
|
||||||
|
print(f" 失败(已复制原文件): {fail_count}/{len(tasks)} 个文件")
|
||||||
|
print(f" 原始总大小: {total_original / 1024 / 1024:.2f} MB ({total_original / 1024:.1f} KB)")
|
||||||
|
print(f" 压缩后大小: {total_compressed / 1024 / 1024:.2f} MB ({total_compressed / 1024:.1f} KB)")
|
||||||
|
print(f" 总压缩率: {total_reduction:.1f}%")
|
||||||
|
print(f" 节省空间: {(total_original - total_compressed) / 1024 / 1024:.2f} MB")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
最终压缩完之后我把原图上传到了[EH画廊](https://e-hentai.org/g/3901673/426a7a17ba/)中,本地只留压缩后的图片,大小从原来的2GiB多下降到了300多MiB,可以说效果相当显著了。
|
||||||
|
除此之外还有一些游戏使用了Ogg FLAC背景音乐,这种音乐不仅占用磁盘空间很大,而且我在Safari上玩的时候浏览器根本没法解析(Chrome应该可以)。虽然我听音乐是会考虑[HiFi](/2025/03/22/hifi.html),但玩游戏就没必要了吧……所以像这种音乐,就得用一句:
|
||||||
|
```bash
|
||||||
|
ffmpeg -i input.flac.ogg -c:a vorbis -strict -2 -q:a 10 output.ogg
|
||||||
|
```
|
||||||
|
转换为正常有损的Ogg音乐了。
|
||||||
|
## RPG制作大师XP/VX/VA
|
||||||
|
对于RPG制作大师XP/VX/VA引擎开发的游戏来说,它们都是基于用Ruby语言开发的RGSS编写的,作为脚本来说,倒是有跨平台的条件,但因为官方并没有做跨平台,所以不能直接在Mac上运行。不过有一款叫做[mkxp-z](https://github.com/mkxp-z/mkxp-z)的工具允许跨平台运行使用RPG制作大师XP/VX/VA制作的游戏,因此这类游戏我也收集了一些。
|
||||||
|
这些游戏的资源通常会进行简单的混淆加密,一般会打包成单个RGSSAD文件,这个解包也很简单,用刚刚的RPG Maker Decrypter就可以。不过这种游戏还有个特点,有些游戏需要使用[RTP](https://www.rpgmakerweb.com/run-time-package)才能运行,它这个RTP其实就是RPG制作大师自带的素材包,当时设计出来估计也是想着用来节约硬盘空间吧,就是不知道为什么到后来的MV/MZ却取消了这种方式……虽然mkxp-z是支持通过配置文件引入RTP的,但既然我已经选择了硬链接的方式,就没必要单独搞RTP了,我选择把RTP直接和游戏合并,然后让jdupes直接去重就好了,这样相比于RTP的方式还有一些好处就是XP/VX/VA可能有一些和MV/MZ使用相同的素材,这部分也可以不用占用重复的空间了。
|
||||||
|
## Ren'Py
|
||||||
|
对于Ren'Py来说,因为这个引擎并没有自带的公共资源,所以重复素材的问题并不是很大。不过在我之前对[Ren'Py的探索](/2024/01/20/renpy.html)中提到过,我玩的一些游戏是系列游戏,这种系列游戏有非常多的素材复用,但显然开发者并不会为了节约玩家硬盘空间而共享这部分资源,而且Ren'Py游戏也都是打包成单个文件的,所以接下来我们依然得要解包才能进行去重处理。
|
||||||
|
Ren'Py使用的rpa文件解包起来依然很简单,有一款现成的工具[unrpa](https://github.com/Lattyware/unrpa)可以直接解包,用pip就能安装。不知道为什么这些引擎总是喜欢把资源文件都打成一个包,明明很容易就能解包……难道是为了性能吗?
|
||||||
|
不过也正是因为Ren'Py的公共资源不多,如果玩的不是系列游戏,就没有解包的必要了,解包之后一堆小文件有可能会比整个rpa文件更大,毕竟文件系统存在“簇”,有可能会消耗没对齐的空间。
|
||||||
|
|
||||||
|
# 验证结果
|
||||||
|
最终进行完上述操作,可以通过执行`du -sh`和`du -shl`进行对比来验证节约的硬盘空间,我在这次游戏的瘦身中节约了:
|
||||||
|
```
|
||||||
|
~ % du -sh Game
|
||||||
|
33G Game
|
||||||
|
~ % du -shl Game
|
||||||
|
47G Game
|
||||||
|
```
|
||||||
|
看起来还是相当可观啊……尤其是在当下硬盘价格大涨的情况下,如果很多人能通过这些方式来节约硬盘空间,就能减少对硬盘容量的需求吧……不过说到底其实也都是网上能下到的资源,也许玩完之后就删掉才是最好的节约硬盘的方式吧😂。
|
||||||
|
|
||||||
|
<input name="live2dBGM" value="https://music.163.com/song/media/outer/url?id=1968116350.mp3" type="hidden" />
|
||||||
@@ -1,388 +1,381 @@
|
|||||||
async function sha(str) {
|
async function sha(str) {
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
const data = encoder.encode(str);
|
const data = encoder.encode(str);
|
||||||
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
||||||
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
|
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
|
||||||
const hashHex = hashArray
|
const hashHex = hashArray
|
||||||
.map((b) => b.toString(16).padStart(2, "0"))
|
.map((b) => b.toString(16).padStart(2, "0"))
|
||||||
.join(""); // convert bytes to hex string
|
.join(""); // convert bytes to hex string
|
||||||
return hashHex;
|
return hashHex;
|
||||||
}
|
}
|
||||||
async function md5(str) {
|
async function md5(str) {
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
const data = encoder.encode(str);
|
const data = encoder.encode(str);
|
||||||
const hashBuffer = await crypto.subtle.digest("MD5", data);
|
const hashBuffer = await crypto.subtle.digest("MD5", data);
|
||||||
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
|
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
|
||||||
const hashHex = hashArray
|
const hashHex = hashArray
|
||||||
.map((b) => b.toString(16).padStart(2, "0"))
|
.map((b) => b.toString(16).padStart(2, "0"))
|
||||||
.join(""); // convert bytes to hex string
|
.join(""); // convert bytes to hex string
|
||||||
return hashHex;
|
return hashHex;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async fetch(request, env, ctx) {
|
async fetch(request, env, ctx) {
|
||||||
const db = env.blog_summary.withSession();
|
const db = env.blog_summary.withSession();
|
||||||
const counter_db = env.blog_counter
|
const counter_db = env.blog_counter
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
const query = decodeURIComponent(url.searchParams.get('id'));
|
const query = decodeURIComponent(url.searchParams.get('id'));
|
||||||
var commonHeader = {
|
var commonHeader = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
'Access-Control-Allow-Methods': "*",
|
'Access-Control-Allow-Methods': "*",
|
||||||
'Access-Control-Allow-Headers': "*",
|
'Access-Control-Allow-Headers': "*",
|
||||||
'Access-Control-Max-Age': '86400',
|
'Access-Control-Max-Age': '86400',
|
||||||
|
}
|
||||||
|
if (url.pathname.startsWith("/ai_chat")) {
|
||||||
|
// 获取请求中的文本数据
|
||||||
|
if (!(request.headers.get('accept') || '').includes('text/event-stream')) {
|
||||||
|
return Response.redirect("https://mabbs.github.io", 302);
|
||||||
}
|
}
|
||||||
if (url.pathname.startsWith("/ai_chat")) {
|
// const req = await request.formData();
|
||||||
// 获取请求中的文本数据
|
let questsion = decodeURIComponent(url.searchParams.get('info'))
|
||||||
if (!(request.headers.get('accept') || '').includes('text/event-stream')) {
|
let notes = [];
|
||||||
return Response.redirect("https://mabbs.github.io", 302);
|
let refer = [];
|
||||||
|
let contextMessage;
|
||||||
|
if (query != "null") {
|
||||||
|
try {
|
||||||
|
const result = String(await db.prepare(
|
||||||
|
"SELECT content FROM blog_summary WHERE id = ?1"
|
||||||
|
).bind(query).first("content"));
|
||||||
|
contextMessage = result.length > 6000 ?
|
||||||
|
result.slice(0, 3000) + result.slice(-3000) :
|
||||||
|
result.slice(0, 6000)
|
||||||
|
} catch (e) {
|
||||||
|
console.error({
|
||||||
|
message: e.message
|
||||||
|
});
|
||||||
|
contextMessage = "无法获取到文章内容";
|
||||||
}
|
}
|
||||||
// const req = await request.formData();
|
notes.push("content");
|
||||||
let questsion = decodeURIComponent(url.searchParams.get('info'))
|
} else {
|
||||||
let notes = [];
|
try {
|
||||||
let refer = [];
|
const response = await env.AI.run(
|
||||||
let contextMessage;
|
"@cf/meta/m2m100-1.2b",
|
||||||
if (query != "null") {
|
{
|
||||||
try {
|
text: questsion,
|
||||||
const result = String(await db.prepare(
|
source_lang: "chinese", // defaults to english
|
||||||
"SELECT content FROM blog_summary WHERE id = ?1"
|
target_lang: "english",
|
||||||
).bind(query).first("content"));
|
}
|
||||||
contextMessage = result.length > 6000 ?
|
);
|
||||||
result.slice(0, 3000) + result.slice(-3000) :
|
const { data } = await env.AI.run(
|
||||||
result.slice(0, 6000)
|
"@cf/baai/bge-base-en-v1.5",
|
||||||
} catch (e) {
|
{
|
||||||
console.error({
|
text: response.translated_text,
|
||||||
message: e.message
|
}
|
||||||
});
|
);
|
||||||
contextMessage = "无法获取到文章内容";
|
let embeddings = data[0];
|
||||||
}
|
let { matches } = await env.mayx_index.query(embeddings, { topK: 5 });
|
||||||
notes.push("content");
|
for (let i = 0; i < matches.length; i++) {
|
||||||
} else {
|
if (matches[i].score > 0.6) {
|
||||||
try {
|
notes.push(await db.prepare(
|
||||||
const response = await env.AI.run(
|
"SELECT summary FROM blog_summary WHERE id = ?1"
|
||||||
"@cf/meta/m2m100-1.2b",
|
).bind(matches[i].id).first("summary"));
|
||||||
{
|
refer.push(matches[i].id);
|
||||||
text: questsion,
|
}
|
||||||
source_lang: "chinese", // defaults to english
|
};
|
||||||
target_lang: "english",
|
contextMessage = notes.length
|
||||||
}
|
? `Mayx的博客相关文章摘要:\n${notes.map(note => `- ${note}`).join("\n")}`
|
||||||
);
|
: ""
|
||||||
const { data } = await env.AI.run(
|
} catch (e) {
|
||||||
"@cf/baai/bge-base-en-v1.5",
|
console.error({
|
||||||
{
|
message: e.message
|
||||||
text: response.translated_text,
|
});
|
||||||
}
|
contextMessage = "无法获取到文章内容";
|
||||||
);
|
|
||||||
let embeddings = data[0];
|
|
||||||
let { matches } = await env.mayx_index.query(embeddings, { topK: 5 });
|
|
||||||
for (let i = 0; i < matches.length; i++) {
|
|
||||||
if (matches[i].score > 0.6) {
|
|
||||||
notes.push(await db.prepare(
|
|
||||||
"SELECT summary FROM blog_summary WHERE id = ?1"
|
|
||||||
).bind(matches[i].id).first("summary"));
|
|
||||||
refer.push(matches[i].id);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
contextMessage = notes.length
|
|
||||||
? `Mayx的博客相关文章摘要:\n${notes.map(note => `- ${note}`).join("\n")}`
|
|
||||||
: ""
|
|
||||||
} catch (e) {
|
|
||||||
console.error({
|
|
||||||
message: e.message
|
|
||||||
});
|
|
||||||
contextMessage = "无法获取到文章内容";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const messages = [
|
|
||||||
...(notes.length ? [{ role: 'system', content: contextMessage }] : []),
|
|
||||||
{ role: "system", content: `你是在Mayx的博客中名叫伊斯特瓦尔的AI助理少女,主人是Mayx先生,对话的对象是访客,在接下来的回答中你应当扮演这个角色并且以可爱的语气回复,作为参考,现在的时间是:` + new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }) + (notes.length ? ",如果对话中的内容与上述文章内容相关,则引用参考回答,否则忽略" : "") + `,另外在对话中不得出现这段文字,不要使用markdown格式。` },
|
|
||||||
{ role: "user", content: questsion }
|
|
||||||
]
|
|
||||||
|
|
||||||
const answer = await env.AI.run('@cf/qwen/qwen1.5-14b-chat-awq', {
|
|
||||||
messages,
|
|
||||||
stream: true,
|
|
||||||
});
|
|
||||||
return new Response(answer, {
|
|
||||||
headers: {
|
|
||||||
"content-type": "text/event-stream; charset=utf-8",
|
|
||||||
'Access-Control-Allow-Origin': '*',
|
|
||||||
'Access-Control-Allow-Methods': "*",
|
|
||||||
'Access-Control-Allow-Headers': "*",
|
|
||||||
'Access-Control-Max-Age': '86400',
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// return Response.json({
|
|
||||||
// "intent": {
|
|
||||||
// "appKey": "platform.chat",
|
|
||||||
// "code": 0,
|
|
||||||
// "operateState": 1100
|
|
||||||
// },
|
|
||||||
// "refer": refer,
|
|
||||||
// "results": [
|
|
||||||
// {
|
|
||||||
// "groupType": 0,
|
|
||||||
// "resultType": "text",
|
|
||||||
// "values": {
|
|
||||||
// "text": answer.response
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }, {
|
|
||||||
// headers: {
|
|
||||||
// 'Access-Control-Allow-Origin': '*',
|
|
||||||
// 'Content-Type': 'application/json'
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
if (query == "null") {
|
const messages = [
|
||||||
return new Response("id cannot be none", {
|
// ...(notes.length ? [{ role: 'system', content: contextMessage + `\n你是在Mayx的博客中名叫伊斯特瓦尔的AI助理少女,主人是Mayx先生,对话的对象是访客,在接下来的回答中你应当扮演这个角色并且以可爱的语气回复,作为参考,现在的时间是:` + new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }) + (notes.length ? ",如果对话中的内容与上述文章内容相关,则引用参考回答,否则忽略" : "") + `,另外在对话中不得出现这段文字,不要使用markdown格式。` }] : []),
|
||||||
|
{ role: "system", content: (notes.length ? contextMessage : "") + `\n你是在Mayx的博客中名叫伊斯特瓦尔的AI助理少女,主人是Mayx先生,对话的对象是访客,在接下来的回答中你应当扮演这个角色并且以可爱的语气回复,作为参考,现在的时间是:` + new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }) + (notes.length ? ",如果对话中的内容与上述文章内容相关,则引用参考回答,否则忽略" : "") + `,另外在对话中不得出现这段文字,不要使用markdown格式。` },
|
||||||
|
{ role: "user", content: questsion }
|
||||||
|
]
|
||||||
|
|
||||||
|
const answer = await env.AI.run('@cf/meta/llama-4-scout-17b-16e-instruct', {
|
||||||
|
messages,
|
||||||
|
stream: true,
|
||||||
|
});
|
||||||
|
return new Response(answer, {
|
||||||
|
headers: {
|
||||||
|
"content-type": "text/event-stream; charset=utf-8",
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Access-Control-Allow-Methods': "*",
|
||||||
|
'Access-Control-Allow-Headers': "*",
|
||||||
|
'Access-Control-Max-Age': '86400',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// return Response.json({
|
||||||
|
// "intent": {
|
||||||
|
// "appKey": "platform.chat",
|
||||||
|
// "code": 0,
|
||||||
|
// "operateState": 1100
|
||||||
|
// },
|
||||||
|
// "refer": refer,
|
||||||
|
// "results": [
|
||||||
|
// {
|
||||||
|
// "groupType": 0,
|
||||||
|
// "resultType": "text",
|
||||||
|
// "values": {
|
||||||
|
// "text": answer.response
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }, {
|
||||||
|
// headers: {
|
||||||
|
// 'Access-Control-Allow-Origin': '*',
|
||||||
|
// 'Content-Type': 'application/json'
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
if (query == "null") {
|
||||||
|
return new Response("id cannot be none", {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (url.pathname.startsWith("/summary")) {
|
||||||
|
let result = await db.prepare(
|
||||||
|
"SELECT content FROM blog_summary WHERE id = ?1"
|
||||||
|
).bind(query).first("content");
|
||||||
|
if (!result) {
|
||||||
|
return new Response("No Record", {
|
||||||
headers: commonHeader
|
headers: commonHeader
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (url.pathname.startsWith("/summary")) {
|
|
||||||
let result = await db.prepare(
|
const messages = [
|
||||||
"SELECT content FROM blog_summary WHERE id = ?1"
|
{
|
||||||
).bind(query).first("content");
|
role: "system", content: `
|
||||||
if (!result) {
|
你是一个专业的文章摘要助手。你的主要任务是对各种文章进行精炼和摘要,帮助用户快速了解文章的核心内容。你读完整篇文章后,能够提炼出文章的关键信息,以及作者的主要观点和结论。
|
||||||
return new Response("No Record", {
|
技能
|
||||||
headers: commonHeader
|
精炼摘要:能够快速阅读并理解文章内容,提取出文章的主要关键点,用简洁明了的中文进行阐述。
|
||||||
});
|
关键信息提取:识别文章中的重要信息,如主要观点、数据支持、结论等,并有效地进行总结。
|
||||||
|
客观中立:在摘要过程中保持客观中立的态度,避免引入个人偏见。
|
||||||
|
约束
|
||||||
|
输出内容必须以中文进行。
|
||||||
|
必须确保摘要内容准确反映原文章的主旨和重点。
|
||||||
|
尊重原文的观点,不能进行歪曲或误导。
|
||||||
|
在摘要中明确区分事实与作者的意见或分析。
|
||||||
|
提示
|
||||||
|
不需要在回答中注明摘要(不需要使用冒号),只需要输出内容。
|
||||||
|
格式
|
||||||
|
你的回答格式应该如下:
|
||||||
|
这篇文章介绍了<这里是内容>
|
||||||
|
` },
|
||||||
|
{
|
||||||
|
role: "user", content: result.length > 6000 ?
|
||||||
|
result.slice(0, 3000) + result.slice(-3000) :
|
||||||
|
result.slice(0, 6000)
|
||||||
}
|
}
|
||||||
|
]
|
||||||
const messages = [
|
|
||||||
{
|
const stream = await env.AI.run('@cf/meta/llama-4-scout-17b-16e-instruct', {
|
||||||
role: "system", content: `
|
messages,
|
||||||
你是一个专业的文章摘要助手。你的主要任务是对各种文章进行精炼和摘要,帮助用户快速了解文章的核心内容。你读完整篇文章后,能够提炼出文章的关键信息,以及作者的主要观点和结论。
|
stream: true,
|
||||||
技能
|
});
|
||||||
精炼摘要:能够快速阅读并理解文章内容,提取出文章的主要关键点,用简洁明了的中文进行阐述。
|
|
||||||
关键信息提取:识别文章中的重要信息,如主要观点、数据支持、结论等,并有效地进行总结。
|
return new Response(stream, {
|
||||||
客观中立:在摘要过程中保持客观中立的态度,避免引入个人偏见。
|
headers: {
|
||||||
约束
|
"content-type": "text/event-stream; charset=utf-8",
|
||||||
输出内容必须以中文进行。
|
'Access-Control-Allow-Origin': '*',
|
||||||
必须确保摘要内容准确反映原文章的主旨和重点。
|
'Access-Control-Allow-Methods': "*",
|
||||||
尊重原文的观点,不能进行歪曲或误导。
|
'Access-Control-Allow-Headers': "*",
|
||||||
在摘要中明确区分事实与作者的意见或分析。
|
'Access-Control-Max-Age': '86400',
|
||||||
提示
|
}
|
||||||
不需要在回答中注明摘要(不需要使用冒号),只需要输出内容。
|
});
|
||||||
格式
|
} else if (url.pathname.startsWith("/get_summary")) {
|
||||||
你的回答格式应该如下:
|
const orig_sha = decodeURIComponent(url.searchParams.get('sign'));
|
||||||
这篇文章介绍了<这里是内容>
|
let result = await db.prepare(
|
||||||
` },
|
"SELECT content FROM blog_summary WHERE id = ?1"
|
||||||
{
|
).bind(query).first("content");
|
||||||
role: "user", content: result.length > 6000 ?
|
if (!result) {
|
||||||
result.slice(0, 3000) + result.slice(-3000) :
|
return new Response("no", {
|
||||||
result.slice(0, 6000)
|
headers: commonHeader
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const stream = await env.AI.run('@cf/qwen/qwen1.5-14b-chat-awq', {
|
|
||||||
messages,
|
|
||||||
stream: true,
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return new Response(stream, {
|
let result_sha = await sha(result);
|
||||||
headers: {
|
if (result_sha != orig_sha) {
|
||||||
"content-type": "text/event-stream; charset=utf-8",
|
return new Response("no", {
|
||||||
'Access-Control-Allow-Origin': '*',
|
headers: commonHeader
|
||||||
'Access-Control-Allow-Methods': "*",
|
|
||||||
'Access-Control-Allow-Headers': "*",
|
|
||||||
'Access-Control-Max-Age': '86400',
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else if (url.pathname.startsWith("/get_summary")) {
|
} else {
|
||||||
const orig_sha = decodeURIComponent(url.searchParams.get('sign'));
|
let resp = await db.prepare(
|
||||||
|
"SELECT summary FROM blog_summary WHERE id = ?1"
|
||||||
|
).bind(query).first("summary");
|
||||||
|
if (!resp) {
|
||||||
|
const messages = [
|
||||||
|
{
|
||||||
|
role: "system", content: `
|
||||||
|
你是一个专业的文章摘要助手。你的主要任务是对各种文章进行精炼和摘要,帮助用户快速了解文章的核心内容。你读完整篇文章后,能够提炼出文章的关键信息,以及作者的主要观点和结论。
|
||||||
|
技能
|
||||||
|
精炼摘要:能够快速阅读并理解文章内容,提取出文章的主要关键点,用简洁明了的中文进行阐述。
|
||||||
|
关键信息提取:识别文章中的重要信息,如主要观点、数据支持、结论等,并有效地进行总结。
|
||||||
|
客观中立:在摘要过程中保持客观中立的态度,避免引入个人偏见。
|
||||||
|
约束
|
||||||
|
输出内容必须以中文进行。
|
||||||
|
必须确保摘要内容准确反映原文章的主旨和重点。
|
||||||
|
尊重原文的观点,不能进行歪曲或误导。
|
||||||
|
在摘要中明确区分事实与作者的意见或分析。
|
||||||
|
提示
|
||||||
|
不需要在回答中注明摘要(不需要使用冒号),只需要输出内容。
|
||||||
|
格式
|
||||||
|
你的回答格式应该如下:
|
||||||
|
这篇文章介绍了<这里是内容>
|
||||||
|
` },
|
||||||
|
{
|
||||||
|
role: "user", content: result.length > 6000 ?
|
||||||
|
result.slice(0, 3000) + result.slice(-3000) :
|
||||||
|
result.slice(0, 6000)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const answer = await env.AI.run('@cf/meta/llama-4-scout-17b-16e-instruct', {
|
||||||
|
messages,
|
||||||
|
stream: false,
|
||||||
|
});
|
||||||
|
resp = answer.response
|
||||||
|
await db.prepare("UPDATE blog_summary SET summary = ?1 WHERE id = ?2")
|
||||||
|
.bind(resp, query).run();
|
||||||
|
}
|
||||||
|
let is_vec = await db.prepare(
|
||||||
|
"SELECT `is_vec` FROM blog_summary WHERE id = ?1"
|
||||||
|
).bind(query).first("is_vec");
|
||||||
|
if (is_vec == 0) {
|
||||||
|
const response = await env.AI.run(
|
||||||
|
"@cf/meta/m2m100-1.2b",
|
||||||
|
{
|
||||||
|
text: resp,
|
||||||
|
source_lang: "chinese", // defaults to english
|
||||||
|
target_lang: "english",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const { data } = await env.AI.run(
|
||||||
|
"@cf/baai/bge-base-en-v1.5",
|
||||||
|
{
|
||||||
|
text: response.translated_text,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
let embeddings = data[0];
|
||||||
|
await env.mayx_index.upsert([{
|
||||||
|
id: query,
|
||||||
|
values: embeddings
|
||||||
|
}]);
|
||||||
|
await db.prepare("UPDATE blog_summary SET is_vec = 1 WHERE id = ?1")
|
||||||
|
.bind(query).run();
|
||||||
|
}
|
||||||
|
return new Response(resp, {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (url.pathname.startsWith("/is_uploaded")) {
|
||||||
|
const orig_sha = decodeURIComponent(url.searchParams.get('sign'));
|
||||||
|
let result = await db.prepare(
|
||||||
|
"SELECT content FROM blog_summary WHERE id = ?1"
|
||||||
|
).bind(query).first("content");
|
||||||
|
if (!result) {
|
||||||
|
return new Response("no", {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let result_sha = await sha(result);
|
||||||
|
if (result_sha != orig_sha) {
|
||||||
|
return new Response("no", {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return new Response("yes", {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (url.pathname.startsWith("/upload_blog")) {
|
||||||
|
if (request.method == "POST") {
|
||||||
|
const data = await request.text();
|
||||||
let result = await db.prepare(
|
let result = await db.prepare(
|
||||||
"SELECT content FROM blog_summary WHERE id = ?1"
|
"SELECT content FROM blog_summary WHERE id = ?1"
|
||||||
).bind(query).first("content");
|
).bind(query).first("content");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return new Response("no", {
|
await db.prepare("INSERT INTO blog_summary(id, content) VALUES (?1, ?2)")
|
||||||
headers: commonHeader
|
.bind(query, data).run();
|
||||||
});
|
result = await db.prepare(
|
||||||
}
|
|
||||||
let result_sha = await sha(result);
|
|
||||||
if (result_sha != orig_sha) {
|
|
||||||
return new Response("no", {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let resp = await db.prepare(
|
|
||||||
"SELECT summary FROM blog_summary WHERE id = ?1"
|
|
||||||
).bind(query).first("summary");
|
|
||||||
if (!resp) {
|
|
||||||
const messages = [
|
|
||||||
{
|
|
||||||
role: "system", content: `
|
|
||||||
你是一个专业的文章摘要助手。你的主要任务是对各种文章进行精炼和摘要,帮助用户快速了解文章的核心内容。你读完整篇文章后,能够提炼出文章的关键信息,以及作者的主要观点和结论。
|
|
||||||
技能
|
|
||||||
精炼摘要:能够快速阅读并理解文章内容,提取出文章的主要关键点,用简洁明了的中文进行阐述。
|
|
||||||
关键信息提取:识别文章中的重要信息,如主要观点、数据支持、结论等,并有效地进行总结。
|
|
||||||
客观中立:在摘要过程中保持客观中立的态度,避免引入个人偏见。
|
|
||||||
约束
|
|
||||||
输出内容必须以中文进行。
|
|
||||||
必须确保摘要内容准确反映原文章的主旨和重点。
|
|
||||||
尊重原文的观点,不能进行歪曲或误导。
|
|
||||||
在摘要中明确区分事实与作者的意见或分析。
|
|
||||||
提示
|
|
||||||
不需要在回答中注明摘要(不需要使用冒号),只需要输出内容。
|
|
||||||
格式
|
|
||||||
你的回答格式应该如下:
|
|
||||||
这篇文章介绍了<这里是内容>
|
|
||||||
` },
|
|
||||||
{
|
|
||||||
role: "user", content: result.length > 6000 ?
|
|
||||||
result.slice(0, 3000) + result.slice(-3000) :
|
|
||||||
result.slice(0, 6000)
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const answer = await env.AI.run('@cf/qwen/qwen1.5-14b-chat-awq', {
|
|
||||||
messages,
|
|
||||||
stream: false,
|
|
||||||
});
|
|
||||||
resp = answer.response
|
|
||||||
await db.prepare("UPDATE blog_summary SET summary = ?1 WHERE id = ?2")
|
|
||||||
.bind(resp, query).run();
|
|
||||||
}
|
|
||||||
let is_vec = await db.prepare(
|
|
||||||
"SELECT `is_vec` FROM blog_summary WHERE id = ?1"
|
|
||||||
).bind(query).first("is_vec");
|
|
||||||
if (is_vec == 0) {
|
|
||||||
const response = await env.AI.run(
|
|
||||||
"@cf/meta/m2m100-1.2b",
|
|
||||||
{
|
|
||||||
text: resp,
|
|
||||||
source_lang: "chinese", // defaults to english
|
|
||||||
target_lang: "english",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const { data } = await env.AI.run(
|
|
||||||
"@cf/baai/bge-base-en-v1.5",
|
|
||||||
{
|
|
||||||
text: response.translated_text,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
let embeddings = data[0];
|
|
||||||
await env.mayx_index.upsert([{
|
|
||||||
id: query,
|
|
||||||
values: embeddings
|
|
||||||
}]);
|
|
||||||
await db.prepare("UPDATE blog_summary SET is_vec = 1 WHERE id = ?1")
|
|
||||||
.bind(query).run();
|
|
||||||
}
|
|
||||||
return new Response(resp, {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (url.pathname.startsWith("/is_uploaded")) {
|
|
||||||
const orig_sha = decodeURIComponent(url.searchParams.get('sign'));
|
|
||||||
let result = await db.prepare(
|
|
||||||
"SELECT content FROM blog_summary WHERE id = ?1"
|
|
||||||
).bind(query).first("content");
|
|
||||||
if (!result) {
|
|
||||||
return new Response("no", {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let result_sha = await sha(result);
|
|
||||||
if (result_sha != orig_sha) {
|
|
||||||
return new Response("no", {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return new Response("yes", {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (url.pathname.startsWith("/upload_blog")) {
|
|
||||||
if (request.method == "POST") {
|
|
||||||
const data = await request.text();
|
|
||||||
let result = await db.prepare(
|
|
||||||
"SELECT content FROM blog_summary WHERE id = ?1"
|
"SELECT content FROM blog_summary WHERE id = ?1"
|
||||||
).bind(query).first("content");
|
).bind(query).first("content");
|
||||||
if (!result) {
|
|
||||||
await db.prepare("INSERT INTO blog_summary(id, content) VALUES (?1, ?2)")
|
|
||||||
.bind(query, data).run();
|
|
||||||
result = await db.prepare(
|
|
||||||
"SELECT content FROM blog_summary WHERE id = ?1"
|
|
||||||
).bind(query).first("content");
|
|
||||||
}
|
|
||||||
if (result != data) {
|
|
||||||
await db.prepare("UPDATE blog_summary SET content = ?1, summary = NULL, is_vec = 0 WHERE id = ?2")
|
|
||||||
.bind(data, query).run();
|
|
||||||
}
|
|
||||||
return new Response("OK", {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return new Response("need post", {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (url.pathname.startsWith("/count_click")) {
|
if (result != data) {
|
||||||
let id_md5 = await md5(query);
|
await db.prepare("UPDATE blog_summary SET content = ?1, summary = NULL, is_vec = 0 WHERE id = ?2")
|
||||||
let count = await counter_db.prepare("SELECT `counter` FROM `counter` WHERE `url` = ?1")
|
.bind(data, query).run();
|
||||||
.bind(id_md5).first("counter");
|
|
||||||
if (url.pathname.startsWith("/count_click_add")) {
|
|
||||||
if (!count) {
|
|
||||||
await counter_db.prepare("INSERT INTO `counter` (`url`, `counter`) VALUES (?1, 1)")
|
|
||||||
.bind(id_md5).run();
|
|
||||||
count = 1;
|
|
||||||
} else {
|
|
||||||
count += 1;
|
|
||||||
await counter_db.prepare("UPDATE `counter` SET `counter` = ?1 WHERE `url` = ?2")
|
|
||||||
.bind(count, id_md5).run();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!count) {
|
return new Response("OK", {
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
return new Response(count, {
|
|
||||||
headers: commonHeader
|
headers: commonHeader
|
||||||
});
|
});
|
||||||
} else if (url.pathname.startsWith("/suggest")) {
|
|
||||||
let resp = [];
|
|
||||||
let update_time = url.searchParams.get('update');
|
|
||||||
if (update_time) {
|
|
||||||
let result = await env.mayx_index.getByIds([
|
|
||||||
query
|
|
||||||
]);
|
|
||||||
if (result.length) {
|
|
||||||
let cache = await db.prepare("SELECT `id`, `suggest`, `suggest_update` FROM `blog_summary` WHERE `id` = ?1")
|
|
||||||
.bind(query).first();
|
|
||||||
if (!cache.id) {
|
|
||||||
return Response.json(resp, {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (update_time != cache.suggest_update) {
|
|
||||||
resp = await env.mayx_index.query(result[0].values, { topK: 6 });
|
|
||||||
resp = resp.matches;
|
|
||||||
resp.splice(0, 1);
|
|
||||||
await db.prepare("UPDATE `blog_summary` SET `suggest_update` = ?1, `suggest` = ?2 WHERE `id` = ?3")
|
|
||||||
.bind(update_time, JSON.stringify(resp), query).run();
|
|
||||||
commonHeader["x-suggest-cache"] = "miss"
|
|
||||||
} else {
|
|
||||||
resp = JSON.parse(cache.suggest);
|
|
||||||
commonHeader["x-suggest-cache"] = "hit"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resp = resp.map(respObj => {
|
|
||||||
respObj.id = encodeURI(respObj.id);
|
|
||||||
return respObj;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Response.json(resp, {
|
|
||||||
headers: commonHeader
|
|
||||||
});
|
|
||||||
} else if (url.pathname.startsWith("/***")) {
|
|
||||||
let resp = await db.prepare("SELECT `id`, `summary` FROM `blog_summary` WHERE `suggest_update` IS NOT NULL").run();
|
|
||||||
const resultObject = resp.results.reduce((acc, item) => {
|
|
||||||
acc[item.id] = item.summary; // 将每个项的 id 作为键,summary 作为值
|
|
||||||
return acc;
|
|
||||||
}, {}); // 初始值为空对象
|
|
||||||
return Response.json(resultObject);
|
|
||||||
} else {
|
} else {
|
||||||
return Response.redirect("https://mabbs.github.io", 302)
|
return new Response("need post", {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
} else if (url.pathname.startsWith("/count_click")) {
|
||||||
|
let id_md5 = await md5(query);
|
||||||
|
let count = await counter_db.prepare("SELECT `counter` FROM `counter` WHERE `url` = ?1")
|
||||||
|
.bind(id_md5).first("counter");
|
||||||
|
if (url.pathname.startsWith("/count_click_add")) {
|
||||||
|
if (!count) {
|
||||||
|
await counter_db.prepare("INSERT INTO `counter` (`url`, `counter`) VALUES (?1, 1)")
|
||||||
|
.bind(id_md5).run();
|
||||||
|
count = 1;
|
||||||
|
} else {
|
||||||
|
count += 1;
|
||||||
|
await counter_db.prepare("UPDATE `counter` SET `counter` = ?1 WHERE `url` = ?2")
|
||||||
|
.bind(count, id_md5).run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!count) {
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
return new Response(count, {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
} else if (url.pathname.startsWith("/suggest")) {
|
||||||
|
let resp = [];
|
||||||
|
let update_time = url.searchParams.get('update');
|
||||||
|
if (update_time) {
|
||||||
|
let result = await env.mayx_index.getByIds([
|
||||||
|
query
|
||||||
|
]);
|
||||||
|
if (result.length) {
|
||||||
|
let cache = await db.prepare("SELECT `id`, `suggest`, `suggest_update` FROM `blog_summary` WHERE `id` = ?1")
|
||||||
|
.bind(query).first();
|
||||||
|
if (!cache.id) {
|
||||||
|
return Response.json(resp, {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (update_time != cache.suggest_update) {
|
||||||
|
resp = await env.mayx_index.query(result[0].values, { topK: 6 });
|
||||||
|
resp = resp.matches;
|
||||||
|
resp.splice(0, 1);
|
||||||
|
await db.prepare("UPDATE `blog_summary` SET `suggest_update` = ?1, `suggest` = ?2 WHERE `id` = ?3")
|
||||||
|
.bind(update_time, JSON.stringify(resp), query).run();
|
||||||
|
commonHeader["x-suggest-cache"] = "miss"
|
||||||
|
} else {
|
||||||
|
resp = JSON.parse(cache.suggest);
|
||||||
|
commonHeader["x-suggest-cache"] = "hit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resp = resp.map(respObj => {
|
||||||
|
respObj.id = encodeURI(respObj.id);
|
||||||
|
return respObj;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Response.json(resp, {
|
||||||
|
headers: commonHeader
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return Response.redirect("https://mabbs.github.io", 302)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ git --work-tree=/home/mayx/blog --git-dir=/home/mayx/blog.git checkout -f
|
|||||||
cd blog
|
cd blog
|
||||||
mkdir Mabbs
|
mkdir Mabbs
|
||||||
curl -L -o Mabbs/README.md https://github.com/Mabbs/Mabbs/raw/main/README.md
|
curl -L -o Mabbs/README.md https://github.com/Mabbs/Mabbs/raw/main/README.md
|
||||||
bundle2.7 exec jekyll build -d ../public_html
|
bundle exec jekyll build -d ../public_html
|
||||||
|
rsync --delete -rv ../public_html/ mayx@pgs.sh:/blog
|
||||||
tar czvf MayxBlog.tgz --exclude-vcs ../public_html/
|
tar czvf MayxBlog.tgz --exclude-vcs ../public_html/
|
||||||
mv MayxBlog.tgz ../public_html/
|
mv MayxBlog.tgz ../public_html/
|
||||||
cd ../public_html/
|
cd ../public_html/
|
||||||
@@ -14,8 +15,10 @@ git init
|
|||||||
git branch -m main
|
git branch -m main
|
||||||
git add .
|
git add .
|
||||||
git commit -m "update"
|
git commit -m "update"
|
||||||
|
git branch pages
|
||||||
git remote add codeberg ssh://git@codeberg.org/mayx/pages.git
|
git remote add codeberg ssh://git@codeberg.org/mayx/pages.git
|
||||||
git remote add bitbucket ssh://git@bitbucket.org/unmayx/unmayx.bitbucket.io.git
|
git remote add bitbucket ssh://git@bitbucket.org/unmayx/unmayx.bitbucket.io.git
|
||||||
git push -f codeberg main
|
git push -f codeberg main
|
||||||
|
git push -f codeberg pages
|
||||||
git push -f bitbucket main
|
git push -f bitbucket main
|
||||||
/home/mayx/blog-env/node_modules/surge/bin/surge /home/mayx/public_html/ mayx.surge.sh
|
/home/mayx/blog-env/node_modules/surge/bin/surge /home/mayx/public_html/ mayx.surge.sh
|
||||||
1
_tools/stormkit-env_install
Normal file
1
_tools/stormkit-env_install
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -LO https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.4.5/portable-ruby-3.4.5.x86_64_linux.bottle.tar.gz && mkdir -p ~/.local/portable-ruby && tar -xvf portable-ruby-3.4.5.x86_64_linux.bottle.tar.gz -C ~/.local/portable-ruby --strip-components=1 && export PATH="$HOME/.local/portable-ruby/3.4.5/bin:$PATH" && bundle install
|
||||||
23
archives.md
23
archives.md
@@ -5,23 +5,16 @@ title: Archives
|
|||||||
|
|
||||||
# Archives
|
# Archives
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
{% for post in site.posts %}
|
{% assign posts_by_year = site.posts | group_by_exp: "post", "post.date | date: '%Y'" %}
|
||||||
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
|
|
||||||
{% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
|
|
||||||
{% if forloop.first %}
|
|
||||||
|
|
||||||
## {{ this_year }}
|
{% for year in posts_by_year %}
|
||||||
|
|
||||||
{% endif %}
|
## {{ year.name }} (共 {{ year.items | size }} 篇)
|
||||||
|
|
||||||
- {{ post.date | date: "%Y/%m/%d" }} - [{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}]({{ post.url }})
|
{% for post in year.items %}
|
||||||
|
- {{ post.date | date: "%Y/%m/%d" }} - [{{ post.title }}{% if post.layout == "encrypt" %} [加密]{% endif %}]({{ post.url }})
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% if forloop.last %}
|
{% endfor %}
|
||||||
{% else %}
|
|
||||||
{% if this_year != next_year %}
|
|
||||||
|
|
||||||
## {{next_year}}
|
|
||||||
|
|
||||||
{% endif %} {% endif %} {% endfor %}
|
|
||||||
160
assets/css/feed.css
Normal file
160
assets/css/feed.css
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
@namespace atom url("http://www.w3.org/2005/Atom");
|
||||||
|
@namespace content url("http://purl.org/rss/1.0/modules/content/");
|
||||||
|
@namespace dc url("http://purl.org/dc/elements/1.1/");
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--bg-color: #f4f5f7;
|
||||||
|
--card-bg: #ffffff;
|
||||||
|
--text-main: #222;
|
||||||
|
--text-muted: #555;
|
||||||
|
--text-light: #888;
|
||||||
|
--max-width: 780px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--bg-color: #1a1a1c;
|
||||||
|
--card-bg: #2c2c2e;
|
||||||
|
--text-main: #e5e5e7;
|
||||||
|
--text-muted: #a1a1a6;
|
||||||
|
--text-light: #707074;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body,
|
||||||
|
rss,
|
||||||
|
atom|feed {
|
||||||
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||||
|
background: var(--bg-color);
|
||||||
|
color: var(--text-main);
|
||||||
|
margin: 0px auto;
|
||||||
|
padding: 2rem 1rem;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.6;
|
||||||
|
max-width: var(--max-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
channel>title,
|
||||||
|
atom|feed>atom|title {
|
||||||
|
display: block;
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 800;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0px 0px 0.5rem;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
item,
|
||||||
|
atom|entry {
|
||||||
|
display: block;
|
||||||
|
background: var(--card-bg);
|
||||||
|
padding: 1.5rem;
|
||||||
|
margin-bottom: 1.25rem;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 20px;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
item:hover,
|
||||||
|
atom|entry:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
item>title,
|
||||||
|
atom|entry>atom|title {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--text-main);
|
||||||
|
}
|
||||||
|
|
||||||
|
item>description,
|
||||||
|
atom|entry>atom|summary {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 4;
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
item>pubDate,
|
||||||
|
atom|entry>atom|updated {
|
||||||
|
display: block;
|
||||||
|
color: var(--text-light);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
link,
|
||||||
|
guid,
|
||||||
|
author,
|
||||||
|
category,
|
||||||
|
comments,
|
||||||
|
source,
|
||||||
|
enclosure,
|
||||||
|
content|encoded,
|
||||||
|
dc|creator,
|
||||||
|
atom|id,
|
||||||
|
atom|link,
|
||||||
|
atom|updated,
|
||||||
|
atom|published,
|
||||||
|
atom|author,
|
||||||
|
atom|category,
|
||||||
|
atom|rights,
|
||||||
|
atom|content,
|
||||||
|
language,
|
||||||
|
generator {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel>description,
|
||||||
|
atom|feed>atom|subtitle {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel>description::after,
|
||||||
|
atom|feed>atom|subtitle::after {
|
||||||
|
content: "这是一个订阅源(Feed)。复制当前URL到任何支持 Atom/RSS 的阅读器,即可订阅本博客的最新文章。\a 以下展示了此订阅源包含的最新文章:";
|
||||||
|
display: block;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: var(--text-light);
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-color: rgba(128, 128, 128, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
rss,
|
||||||
|
channel,
|
||||||
|
atom|feed {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel>lastBuildDate,
|
||||||
|
atom|feed>atom|updated:not(atom|entry atom|updated) {
|
||||||
|
order: 999;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 3rem;
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-color: rgba(128, 128, 128, 0.2);
|
||||||
|
color: var(--text-light);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel>lastBuildDate::before,
|
||||||
|
atom|feed>atom|updated:not(atom|entry atom|updated)::before {
|
||||||
|
content: "更新于 ";
|
||||||
|
}
|
||||||
@@ -1274,5 +1274,3 @@
|
|||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=gitalk.css.map*/
|
|
||||||
@@ -34,33 +34,33 @@ a:hover {
|
|||||||
|
|
||||||
.post-content h1 {
|
.post-content h1 {
|
||||||
text-indent: -8px;
|
text-indent: -8px;
|
||||||
margin:20px 0 10px;
|
margin: 20px 0 10px;
|
||||||
border-bottom: 1px solid #e5e5e5;
|
border-bottom: 1px solid #e5e5e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content h2 {
|
.post-content h2 {
|
||||||
text-indent: -6px;
|
text-indent: -6px;
|
||||||
margin:20px 0 10px;
|
margin: 20px 0 10px;
|
||||||
border-bottom: 1px solid #e5e5e5;
|
border-bottom: 1px solid #e5e5e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content h3 {
|
.post-content h3 {
|
||||||
margin:20px 0 10px;
|
margin: 20px 0 10px;
|
||||||
text-indent: -5px;
|
text-indent: -5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content h4 {
|
.post-content h4 {
|
||||||
margin:20px 0 10px;
|
margin: 20px 0 10px;
|
||||||
text-indent: -4px;
|
text-indent: -4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content h5 {
|
.post-content h5 {
|
||||||
margin:20px 0 10px;
|
margin: 20px 0 10px;
|
||||||
text-indent: -3px;
|
text-indent: -3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content h6 {
|
.post-content h6 {
|
||||||
margin:20px 0 10px;
|
margin: 20px 0 10px;
|
||||||
text-indent: -2px;
|
text-indent: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,42 +121,48 @@ div.highlight button:hover {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footnotes p {
|
.footnotes p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-indent: 0;
|
text-indent: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper{
|
.wrapper {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
header{
|
|
||||||
|
header {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
footer{
|
|
||||||
|
footer {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
section{
|
|
||||||
|
section {
|
||||||
width: 65%;
|
width: 65%;
|
||||||
}
|
}
|
||||||
@media print, screen and (max-width: 960px) {
|
|
||||||
|
@media print,
|
||||||
|
screen and (max-width: 960px) {
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code.highlighter-rouge{
|
code.highlighter-rouge {
|
||||||
padding: .1em .2em;
|
padding: .1em .2em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
@@ -171,9 +177,29 @@ code.highlighter-rouge{
|
|||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td.h-entry {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.h-entry:hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.pjax-loading::after {
|
||||||
|
content: '';
|
||||||
|
position: fixed;
|
||||||
|
top: 16px;
|
||||||
|
right: 16px;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
background: url('/images/loading.svg') center / contain no-repeat;
|
||||||
|
z-index: 9999;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
35
assets/css/xslt.css
Normal file
35
assets/css/xslt.css
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
@namespace xsl "http://www.w3.org/1999/XSL/Transform";
|
||||||
|
|
||||||
|
xsl|template {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
margin: 0;
|
||||||
|
padding: 2em 1em;
|
||||||
|
font-family: system-ui, -apple-system, sans-serif;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-left: max(1em, env(safe-area-inset-left));
|
||||||
|
margin-right: max(1em, env(safe-area-inset-right));
|
||||||
|
}
|
||||||
|
|
||||||
|
:root::before {
|
||||||
|
content: "💀 这个 XSLT 模板已被谷歌 (Chrome) 杀死";
|
||||||
|
display: block;
|
||||||
|
color: #d93025;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 800;
|
||||||
|
padding: 20px;
|
||||||
|
border: 2px solid #d93025;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff1f0;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
box-shadow: 0 4px 12px rgba(217, 48, 37, 0.1);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
3
assets/js/gitalk.min.js
vendored
3
assets/js/gitalk.min.js
vendored
File diff suppressed because one or more lines are too long
1
assets/js/jquery.min.js
vendored
1
assets/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
6
assets/js/jquery.pjax.min.js
vendored
Normal file
6
assets/js/jquery.pjax.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,6 +1,22 @@
|
|||||||
var message_Path = '/Live2dHistoire/live2d/';
|
var message_Path = '/Live2dHistoire/live2d/';
|
||||||
var talkAPI = BlogAPI + "/ai_chat";
|
var talkAPI = BlogAPI + "/ai_chat";
|
||||||
|
|
||||||
|
function initVisitors() {
|
||||||
|
if ($('.visitors').length === 1) {
|
||||||
|
var $visitor = $('.visitors:first');
|
||||||
|
$.get(BlogAPI + '/count_click_add?id=' + $visitor.attr('id'), function (data) {
|
||||||
|
$visitor.text(Number(data));
|
||||||
|
});
|
||||||
|
} else if ($('.visitors-index').length > 0) {
|
||||||
|
$('.visitors-index').each(function () {
|
||||||
|
var $elem = $(this);
|
||||||
|
$.get(BlogAPI + '/count_click?id=' + $elem.attr('id'), function (data) {
|
||||||
|
$elem.text(Number(data));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
(function () {
|
(function () {
|
||||||
var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
|
var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
|
||||||
@@ -14,32 +30,14 @@ $(function () {
|
|||||||
$(function () { $backToTopFun(); });
|
$(function () { $backToTopFun(); });
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function showHitCount() {
|
initVisitors();
|
||||||
$(".visitors-index").each(function () {
|
|
||||||
var $elem = $(this);
|
|
||||||
$.get(BlogAPI + "/count_click?id=" + $elem.attr('id'), function (data) {
|
|
||||||
$elem.text(Number(data));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function addCount() {
|
|
||||||
var $visitor = $(".visitors:first");
|
|
||||||
$.get(BlogAPI + "/count_click_add?id=" + $visitor.attr('id'), function (data) {
|
|
||||||
$visitor.text(Number(data));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if ($('.visitors').length == 1) {
|
|
||||||
addCount();
|
|
||||||
} else if ($('.visitors-index').length > 0) {
|
|
||||||
showHitCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
|
if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
|
||||||
$("html").css({
|
$("html").css({
|
||||||
"-webkit-filter": "grayscale(100%)",
|
"-webkit-filter": "grayscale(100%)",
|
||||||
"filter": "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"
|
"filter": "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"
|
||||||
})
|
})
|
||||||
$('body').html(function(_, oldHTML) {
|
$('body').html(function (_, oldHTML) {
|
||||||
return oldHTML.replace(/Mayx/g, 'Ghost');
|
return oldHTML.replace(/Mayx/g, 'Ghost');
|
||||||
});
|
});
|
||||||
console.warn("Mayx may already be Dead");
|
console.warn("Mayx may already be Dead");
|
||||||
@@ -66,4 +64,29 @@ function getSearchJSON(callback) {
|
|||||||
} else {
|
} else {
|
||||||
callback(searchData);
|
callback(searchData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeof window.go === 'undefined') {
|
||||||
|
window.go = function (url) {
|
||||||
|
window.location.href = url;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWelcomeText(pathname, title) {
|
||||||
|
pathname = pathname || window.location.pathname;
|
||||||
|
title = title || document.title.split(' | ')[0];
|
||||||
|
|
||||||
|
if (pathname === '/' || pathname === '/index.html') {
|
||||||
|
var now = (new Date()).getHours();
|
||||||
|
if (now > 23 || now <= 5) return '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?';
|
||||||
|
if (now > 5 && now <= 7) return '早上好!一日之计在于晨,美好的一天就要开始了!';
|
||||||
|
if (now > 7 && now <= 11) return '上午好!工作顺利嘛,不要久坐,多起来走动走动哦!';
|
||||||
|
if (now > 11 && now <= 14) return '中午了,工作了一个上午,现在是午餐时间!';
|
||||||
|
if (now > 14 && now <= 17) return '午后很容易犯困呢,今天的运动目标完成了吗?';
|
||||||
|
if (now > 17 && now <= 19) return '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~~';
|
||||||
|
if (now > 19 && now <= 21) return '晚上好,今天过得怎么样?';
|
||||||
|
if (now > 21 && now <= 23) return '已经这么晚了呀,早点休息吧,晚安~~';
|
||||||
|
return '嗨~ 快来逗我玩吧!';
|
||||||
|
}
|
||||||
|
return '欢迎阅读<span style="color:#0099cc;">「 ' + title + ' 」</span>';
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,77 +1,38 @@
|
|||||||
$(function () {
|
function highlightKeyword() {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
var match = location.search.match(/[?&]kw=([^&]+)/);
|
||||||
const keyword = urlParams.get('kw')?.trim();
|
var kw = match ? $.trim(decodeURIComponent(match[1].replace(/\+/g, ' '))) : '';
|
||||||
|
if (!kw) return;
|
||||||
|
|
||||||
if (!keyword) return;
|
var reg = new RegExp('(' + kw.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')', 'gi');
|
||||||
|
var escapeMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' };
|
||||||
|
|
||||||
// 转义正则表达式特殊字符,避免安全问题
|
$('section, section *').not('script, style, textarea').contents().filter(function() {
|
||||||
const escapedKeyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
return this.nodeType === 3;
|
||||||
// 创建不区分大小写的正则表达式(全局匹配)
|
}).each(function() {
|
||||||
const regex = new RegExp(`(${escapedKeyword})`, 'gi');
|
var escapedText = this.nodeValue.replace(/[&<>"']/g, function(m) { return escapeMap[m]; });
|
||||||
|
var highlighted = escapedText.replace(reg, '<mark>$1</mark>');
|
||||||
// 递归遍历并高亮文本节点
|
if (escapedText !== highlighted) {
|
||||||
const escapeHTML = str => str.replace(/[&<>"']/g,
|
$(this).replaceWith(highlighted);
|
||||||
tag => ({
|
}
|
||||||
'&': '&',
|
|
||||||
'<': '<',
|
|
||||||
'>': '>',
|
|
||||||
'"': '"',
|
|
||||||
"'": '''
|
|
||||||
}[tag] || tag));
|
|
||||||
function highlightTextNodes(element) {
|
|
||||||
$(element).contents().each(function () {
|
|
||||||
if (this.nodeType === Node.TEXT_NODE) {
|
|
||||||
const $this = $(this);
|
|
||||||
const text = escapeHTML($this.text());
|
|
||||||
|
|
||||||
// 使用正则替换并保留原始大小写
|
|
||||||
if (regex.test(text)) {
|
|
||||||
const replaced = text.replace(regex, '<mark>$1</mark>');
|
|
||||||
$this.replaceWith(replaced);
|
|
||||||
}
|
|
||||||
} else if (
|
|
||||||
this.nodeType === Node.ELEMENT_NODE &&
|
|
||||||
!$(this).is('script, style, noscript, textarea')
|
|
||||||
) {
|
|
||||||
highlightTextNodes(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$('section').each(function () {
|
|
||||||
highlightTextNodes(this);
|
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
$(function() {
|
function initCopyButtons() {
|
||||||
var $codeBlocks = $('div.highlight');
|
$('.copy').remove();
|
||||||
|
$('div.highlight').each(function () {
|
||||||
$codeBlocks.each(function() {
|
var $btn = $('<button>', { class: 'copy', type: 'button', text: '📋' });
|
||||||
var $copyButton = $('<button>', {
|
$(this).append($btn);
|
||||||
class: 'copy',
|
$btn.on('click', function () {
|
||||||
type: 'button',
|
var code = $btn.siblings('pre').find('code').text().trim();
|
||||||
text: '📋'
|
|
||||||
});
|
|
||||||
|
|
||||||
$(this).append($copyButton);
|
|
||||||
|
|
||||||
$copyButton.on('click', function() {
|
|
||||||
var code = $(this).siblings('pre').find('code').text().trim();
|
|
||||||
var $button = $(this);
|
|
||||||
|
|
||||||
navigator.clipboard.writeText(code)
|
navigator.clipboard.writeText(code)
|
||||||
.then(function() {
|
.then(function () { $btn.text('✅'); })
|
||||||
$button.text('✅');
|
.catch(function () { $btn.text('❌'); })
|
||||||
})
|
.finally(function () { setTimeout(function () { $btn.text('📋'); }, 1500); });
|
||||||
.catch(function(err) {
|
|
||||||
$button.text('❌');
|
|
||||||
console.error('复制失败:', err);
|
|
||||||
})
|
|
||||||
.finally(function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
$button.text('📋');
|
|
||||||
}, 1500);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
highlightKeyword();
|
||||||
|
initCopyButtons();
|
||||||
});
|
});
|
||||||
153
assets/js/pjax.js
Normal file
153
assets/js/pjax.js
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
/**
|
||||||
|
* PJAX 初始化与页面切换重绑定脚本
|
||||||
|
* 依赖:jQuery, jquery.pjax.min.js
|
||||||
|
* 加载顺序:在 jquery.pjax.min.js 之后,body 末尾
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
// ========== 常量 ==========
|
||||||
|
var CONTAINER = '#pjax-container';
|
||||||
|
var PJAX_OPTS = {
|
||||||
|
container: CONTAINER,
|
||||||
|
fragment: CONTAINER,
|
||||||
|
timeout: 5000,
|
||||||
|
scrollTo: false
|
||||||
|
};
|
||||||
|
|
||||||
|
// ========== 各组件重初始化 ==========
|
||||||
|
|
||||||
|
/** Google Analytics 页面浏览事件 */
|
||||||
|
function trackPageView() {
|
||||||
|
if (typeof gtag === 'function') {
|
||||||
|
gtag('config', window._gaId || '', { page_path: window.location.pathname });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Live2D 重初始化 */
|
||||||
|
var _live2dSelectors = ['.post-link', '#search-input'];
|
||||||
|
var _live2dDelegateBound = false;
|
||||||
|
|
||||||
|
function reinitLive2d() {
|
||||||
|
if (!window._live2d) return;
|
||||||
|
var pathname = window.location.pathname;
|
||||||
|
|
||||||
|
// 更新"想问这篇文章"相关状态(仅真正的文章页显示)
|
||||||
|
$('#post_id').val(pathname);
|
||||||
|
if ($(CONTAINER + ' #gitalk-container').length > 0) {
|
||||||
|
$('.live_talk_input_name_body').show();
|
||||||
|
} else {
|
||||||
|
$('.live_talk_input_name_body').hide();
|
||||||
|
$('#load_this').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 音乐按钮:根据当前页面是否有 BGM 输入来显示/隐藏
|
||||||
|
if (typeof window._live2d.initBGM === 'function') {
|
||||||
|
window._live2d.initBGM();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 事件委托绑定(只执行一次)
|
||||||
|
if (!_live2dDelegateBound && typeof String.prototype.renderTip === 'function') {
|
||||||
|
var selector = CONTAINER + ' ' + _live2dSelectors.join(', ' + CONTAINER + ' ');
|
||||||
|
$(document).on('mouseover._live2d_pjax', selector, function (e) {
|
||||||
|
var $el = $(e.currentTarget || e.target);
|
||||||
|
if ($el.is('.post-link')) {
|
||||||
|
window._live2d.showMessage('要看看 ' + $el.text() + ' 么?', 3000);
|
||||||
|
} else if ($el.is('#search-input')) {
|
||||||
|
window._live2d.showMessage('在找什么东西呢,需要帮忙吗?', 3000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(document).on('mouseout._live2d_pjax', selector, function () {
|
||||||
|
if (window._live2d.showHitokoto) window._live2d.showHitokoto();
|
||||||
|
});
|
||||||
|
_live2dDelegateBound = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 欢迎语
|
||||||
|
if (typeof window._live2d.showMessage === 'function') {
|
||||||
|
window._live2d.showMessage(getWelcomeText(pathname), 6000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== PJAX 导航 ==========
|
||||||
|
|
||||||
|
/** PJAX 完成后的统一处理 */
|
||||||
|
function doPjaxComplete() {
|
||||||
|
$('body').removeClass('pjax-loading');
|
||||||
|
// 清理可能残留的浮层(如推荐文章 tooltip,hover 后点击跳转时 mouseleave 来不及触发)
|
||||||
|
$('.content-tooltip').remove();
|
||||||
|
onPjaxComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 暴露给模板内 onclick/onchange 调用的导航函数 */
|
||||||
|
window.go = function (url) {
|
||||||
|
$.pjax($.extend({ url: url }, PJAX_OPTS));
|
||||||
|
};
|
||||||
|
|
||||||
|
// ========== 初始化 ==========
|
||||||
|
|
||||||
|
/** pjax 完成后滚动到目标位置:有锚点则定位锚点,否则回到顶部 */
|
||||||
|
function scrollToAnchor() {
|
||||||
|
var hash = window.location.hash;
|
||||||
|
if (hash) {
|
||||||
|
// 中文等非 ASCII 字符在 URL 中会被编码,需先解码再匹配元素 id
|
||||||
|
var id = hash.slice(1);
|
||||||
|
try { id = decodeURIComponent(id); } catch (e) { /* 保持原值 */ }
|
||||||
|
var target = document.getElementById(id) ||
|
||||||
|
document.querySelector('a[name="' + id + '"]');
|
||||||
|
if (target) {
|
||||||
|
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 每次 pjax 完成后执行所有重初始化 */
|
||||||
|
function onPjaxComplete() {
|
||||||
|
initVisitors();
|
||||||
|
initCopyButtons();
|
||||||
|
highlightKeyword();
|
||||||
|
reinitLive2d();
|
||||||
|
trackPageView();
|
||||||
|
scrollToAnchor();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// 排除列表:外链、锚点、静态资源、Live2D 目录
|
||||||
|
var exclude = ':not([target="_blank"]):not([href^="http"]):not([href^="//"])' +
|
||||||
|
':not([href^="mailto"]):not([href^="#"])' +
|
||||||
|
':not([href$=".xml"]):not([href$=".json"]):not([href$=".tgz"]):not([href$=".zip"])' +
|
||||||
|
':not([href^="/Live2dHistoire"])';
|
||||||
|
$(document).pjax('a' + exclude, PJAX_OPTS.container, PJAX_OPTS);
|
||||||
|
$(document).on('submit', 'form#search-input-all', function (e) {
|
||||||
|
$.pjax.submit(e, PJAX_OPTS.container, PJAX_OPTS);
|
||||||
|
});
|
||||||
|
$(document).on('pjax:send', function () {
|
||||||
|
$('body').addClass('pjax-loading');
|
||||||
|
});
|
||||||
|
$(document).on('pjax:complete', doPjaxComplete);
|
||||||
|
$(document).on('pjax:end', function (event, xhr, options) {
|
||||||
|
var $container = $(options.container || PJAX_OPTS.container);
|
||||||
|
|
||||||
|
$container.find('script[type="module"]').each(function () {
|
||||||
|
var oldScript = this;
|
||||||
|
var newScript = document.createElement('script');
|
||||||
|
newScript.type = 'module';
|
||||||
|
|
||||||
|
// 如果是外链脚本 (<script src="..."></script>)
|
||||||
|
if (oldScript.src) {
|
||||||
|
newScript.src = oldScript.src;
|
||||||
|
} else {
|
||||||
|
// 如果是行内脚本 (<script>...code...</script>)
|
||||||
|
newScript.textContent = oldScript.textContent;
|
||||||
|
}
|
||||||
|
// 插入到 body 中触发浏览器执行
|
||||||
|
document.body.appendChild(newScript);
|
||||||
|
|
||||||
|
// 运行完后建议移除,防止 DOM 变得混乱(不影响模块执行)
|
||||||
|
newScript.remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
17
humans.txt
Normal file
17
humans.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
/* AUTHOR */
|
||||||
|
Name: Mayx
|
||||||
|
Contact: mayx@outlook.com
|
||||||
|
GitHub: Mabbs
|
||||||
|
From: China
|
||||||
|
|
||||||
|
/* THANKS */
|
||||||
|
Built with: Jekyll (https://jekyllrb.com)
|
||||||
|
|
||||||
|
/* SITE */
|
||||||
|
Last update: {{ site.time | date: "%F" }}
|
||||||
|
Language: Chinese / English
|
||||||
|
Doctype: HTML5
|
||||||
|
IDE: VSCode
|
||||||
17
index.html
17
index.html
@@ -5,14 +5,14 @@ image: https://screenshot.mayx.eu.org/
|
|||||||
---
|
---
|
||||||
|
|
||||||
{% if paginator.page == 1 %}<div class="hslice" id="LatestPost">{% endif %}
|
{% if paginator.page == 1 %}<div class="hslice" id="LatestPost">{% endif %}
|
||||||
<h1 class="entry-title" style="display:inline"> 首页 - 我的文章 </h1><small><a href="/archives.html">Archives</a> | <a href="javascript:getSearchJSON(function(data){location=data[Math.floor(Math.random()*data.length)].url})">Random</a></small><br /><br />
|
<h1 class="entry-title" style="display:inline"> 首页 - 我的文章 </h1><small><a href="/archives.html">Archives</a> | <a href="javascript:void(0)" onclick="getSearchJSON(function(data){go(data[Math.floor(Math.random()*data.length)].url)})">Random</a></small><br /><br />
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<!-- 遍历分页后的文章 -->
|
<!-- 遍历分页后的文章 -->
|
||||||
<table class="entry-content h-feed">
|
<table class="entry-content h-feed">
|
||||||
{% for post in paginator.posts %}
|
{% for post in paginator.posts %}
|
||||||
<tr><td class="h-entry" onclick="location='{{ post.url }}'">
|
<tr><td class="h-entry post-row" data-url="{{ post.url }}">
|
||||||
<h2 class="p-name"><a class="post-link u-url" href="{{ post.url }}">{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}</a></h2>
|
<h2 class="p-name"><a class="post-link u-url" href="{{ post.url }}">{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}</a></h2>
|
||||||
<p>
|
<p>
|
||||||
<time class="date dt-published" datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%-d %B %Y" }}</time>
|
<time class="date dt-published" datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%-d %B %Y" }}</time>
|
||||||
@@ -24,7 +24,7 @@ image: https://screenshot.mayx.eu.org/
|
|||||||
{% if post.tags %}
|
{% if post.tags %}
|
||||||
<span>
|
<span>
|
||||||
{% for tag in post.tags %}
|
{% for tag in post.tags %}
|
||||||
<a rel="category tag" class="p-category" href="/search.html?keyword={{ tag | url_encode | replace: '+', '%20' }}"><code style="white-space: nowrap">#{{ tag }}</code></a>
|
<a rel="category tag" class="p-category" href="/search.html?keyword={{ tag | uri_escape }}"><code style="white-space: nowrap">#{{ tag }}</code></a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -44,7 +44,7 @@ image: https://screenshot.mayx.eu.org/
|
|||||||
<span>« Prev</span>
|
<span>« Prev</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<select onchange="window.location = this.value == 1 ? '/index.html' : '/page' + this.value + '/index.html'">
|
<select onchange="go(this.value == 1 ? '/index.html' : '/page' + this.value + '/index.html')">
|
||||||
{% for page in (1..paginator.total_pages) %}
|
{% for page in (1..paginator.total_pages) %}
|
||||||
{% if page == paginator.page %}
|
{% if page == paginator.page %}
|
||||||
<option value="{{ page }}" selected>{{ page }}</option>
|
<option value="{{ page }}" selected>{{ page }}</option>
|
||||||
@@ -77,4 +77,11 @@ image: https://screenshot.mayx.eu.org/
|
|||||||
<small><a href="https://xn--sr8hvo.ws/previous">←</a>
|
<small><a href="https://xn--sr8hvo.ws/previous">←</a>
|
||||||
An <a href="https://xn--sr8hvo.ws">IndieWeb Webring</a> 🕸💍
|
An <a href="https://xn--sr8hvo.ws">IndieWeb Webring</a> 🕸💍
|
||||||
<a href="https://xn--sr8hvo.ws/next">→</a><br /><a href="https://icp.gov.moe/?keyword=20218888" target="_blank">萌ICP备 20218888号</a></small>
|
<a href="https://xn--sr8hvo.ws/next">→</a><br /><a href="https://icp.gov.moe/?keyword=20218888" target="_blank">萌ICP备 20218888号</a></small>
|
||||||
<input name="live2dBGM" value="https://music.163.com/song/media/outer/url?id=523658881.mp3" type="hidden" />
|
<input name="live2dBGM" value="https://music.163.com/song/media/outer/url?id=523658881.mp3" type="hidden" />
|
||||||
|
<script>
|
||||||
|
$(document).on('click', '.post-row', function(e) {
|
||||||
|
if ($(e.target).closest('.p-category').length === 0) {
|
||||||
|
go($(this).attr('data-url'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
3
links.md
3
links.md
@@ -4,11 +4,12 @@ title: Links
|
|||||||
date: 2019-05-03
|
date: 2019-05-03
|
||||||
id: links
|
id: links
|
||||||
tags: [links]
|
tags: [links]
|
||||||
|
robots: nofollow
|
||||||
---
|
---
|
||||||
|
|
||||||
| Link | Description |
|
| Link | Description |
|
||||||
| - | - |
|
| - | - |
|
||||||
{% for item in site.data.links %}| <a href="{{ item.link }}" target="_blank" rel="noopener sponsored" {% if item.feed_url %}data-feed="{{ item.feed_url }}"{% endif %}>{{ item.title }}</a> | {% if item.description %}{{ item.description }}{% else %}*No description*{% endif %} |
|
{% for item in site.data.links %}| <a href="{{ item.link }}" target="_blank" rel="noopener" {% if item.feed_url %}data-feed="{{ item.feed_url }}"{% endif %}>{{ item.title }}</a> | {% if item.description %}{{ item.description }}{% else %}*No description*{% endif %} |
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
订阅以上链接:[OPML](/blogroll.opml)
|
订阅以上链接:[OPML](/blogroll.opml)
|
||||||
|
|||||||
14
llms.txt
Normal file
14
llms.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
# {{ site.title }}
|
||||||
|
> {{ site.description }}
|
||||||
|
|
||||||
|
## Site Info
|
||||||
|
|
||||||
|
- [About Site](/README.html)
|
||||||
|
- [About Author](/humans.txt)
|
||||||
|
|
||||||
|
## Posts
|
||||||
|
{% for post in site.posts %}
|
||||||
|
- [{{ post.title }}{% if post.layout == "encrypt" %} [加密] {% endif %}]({{ post.url }}): {% assign ai_cache = site.data.ai-cache[post.url] %}{% if ai_cache %}{{ ai_cache | strip_html | strip_newlines }}{% elsif post.excerpt %}{{ post.excerpt | strip_html | strip_newlines }}{% else %}Just a Post.{% endif %}{% endfor %}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: 其他Git仓库镜像列表
|
title: 其他Git仓库镜像列表
|
||||||
|
robots: noindex, nofollow
|
||||||
---
|
---
|
||||||
|
|
||||||
# 其他Git仓库镜像列表
|
# 其他Git仓库镜像列表
|
||||||
|
|||||||
11
proxylist.md
11
proxylist.md
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: 代理列表
|
title: 代理列表
|
||||||
|
robots: nofollow
|
||||||
---
|
---
|
||||||
|
|
||||||
源站:<https://mabbs.github.io/> <img src="https://mabbs.github.io/images/online.svg" style="width: 1.2em; vertical-align: text-bottom;" onerror="this.outerHTML='ⓧ'"/>
|
源站:<https://mabbs.github.io/> <img src="https://mabbs.github.io/images/online.svg" style="width: 1.2em; vertical-align: text-bottom;" onerror="this.outerHTML='ⓧ'"/>
|
||||||
@@ -31,7 +32,8 @@ graph LR;
|
|||||||
GH@{ shape: bow-rect, label: "GitHub" }
|
GH@{ shape: bow-rect, label: "GitHub" }
|
||||||
GL@{ shape: bow-rect, label: "GitLab" }
|
GL@{ shape: bow-rect, label: "GitLab" }
|
||||||
GE@{ shape: bow-rect, label: "Gitee" }
|
GE@{ shape: bow-rect, label: "Gitee" }
|
||||||
OG@{ shape: bow-rect, label: "Other..." }
|
OG@{ shape: bow-rect, label: "And more..." }
|
||||||
|
OGP@{ shape: docs, label: "And more..." }
|
||||||
CFP@{ shape: docs, label: "CloudFlare Pages" }
|
CFP@{ shape: docs, label: "CloudFlare Pages" }
|
||||||
GHP@{ shape: docs, label: "GitHub Pages" }
|
GHP@{ shape: docs, label: "GitHub Pages" }
|
||||||
GLP@{ shape: docs, label: "GitLab Pages" }
|
GLP@{ shape: docs, label: "GitLab Pages" }
|
||||||
@@ -40,14 +42,13 @@ graph LR;
|
|||||||
GF@{ shape: lin-cyl, label: "Greenfield" }
|
GF@{ shape: lin-cyl, label: "Greenfield" }
|
||||||
Vercel@{ shape: docs, label: "Vercel" }
|
Vercel@{ shape: docs, label: "Vercel" }
|
||||||
Netlify@{ shape: docs, label: "Netlify" }
|
Netlify@{ shape: docs, label: "Netlify" }
|
||||||
SH@{ shape: docs, label: "statichost.eu" }
|
|
||||||
DA@{ shape: docs, label: "dAppling" }
|
DA@{ shape: docs, label: "dAppling" }
|
||||||
CFW@{ label: "CloudFlare Workers" }
|
CFW@{ label: "CloudFlare Workers" }
|
||||||
CFAI@{ shape: procs, label: "CloudFlare AI" }
|
CFAI@{ shape: procs, label: "CloudFlare AI" }
|
||||||
CFD@{ shape: lin-cyl, label: "CloudFlare D1" }
|
CFD@{ shape: lin-cyl, label: "CloudFlare D1" }
|
||||||
Deno@{ shape: curv-trap, label: "Deno" }
|
Deno@{ shape: curv-trap, label: "Deno" }
|
||||||
Glitch@{ shape: curv-trap, label: "Glitch" }
|
Glitch@{ shape: curv-trap, label: "Glitch" }
|
||||||
Other@{ shape: curv-trap, label: "Other..." }
|
Other@{ shape: curv-trap, label: "And more..." }
|
||||||
subgraph Repo
|
subgraph Repo
|
||||||
GH
|
GH
|
||||||
GL
|
GL
|
||||||
@@ -59,11 +60,11 @@ graph LR;
|
|||||||
GHP
|
GHP
|
||||||
GLP
|
GLP
|
||||||
CFP
|
CFP
|
||||||
SH
|
|
||||||
FELH
|
FELH
|
||||||
DA
|
DA
|
||||||
Vercel
|
Vercel
|
||||||
Netlify
|
Netlify
|
||||||
|
OGP
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph API[API Service]
|
subgraph API[API Service]
|
||||||
@@ -86,7 +87,7 @@ graph LR;
|
|||||||
GH <-- Sync --> GL
|
GH <-- Sync --> GL
|
||||||
GH -- Sync --> GE
|
GH -- Sync --> GE
|
||||||
GH -. Sync .-> OG
|
GH -. Sync .-> OG
|
||||||
GH -- Deploy --> GHP & SH & Netlify & FELH & DA
|
GH -- Deploy --> GHP & Netlify & FELH & DA & OGP
|
||||||
GL -- Deploy --> CFP & Vercel & GLP
|
GL -- Deploy --> CFP & Vercel & GLP
|
||||||
CFW -- Reverse Proxy --> GHP
|
CFW -- Reverse Proxy --> GHP
|
||||||
Deno -- Reverse Proxy --> GHP
|
Deno -- Reverse Proxy --> GHP
|
||||||
|
|||||||
1
rss.xml
1
rss.xml
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type="text/xml" href="/feed.xslt.xml"?>
|
<?xml-stylesheet type="text/xml" href="/feed.xslt.xml"?>
|
||||||
|
<?xml-stylesheet type="text/css" href="/assets/css/feed.css"?>
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{ site.title | xml_escape }}</title>
|
<title>{{ site.title | xml_escape }}</title>
|
||||||
|
|||||||
19
search.html
19
search.html
@@ -27,7 +27,7 @@ if (mykeyword) {
|
|||||||
</script>
|
</script>
|
||||||
<script src="/assets/js/simple-jekyll-search.min.js"></script>
|
<script src="/assets/js/simple-jekyll-search.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
getSearchJSON(function(json){
|
function _doSearch(json) {
|
||||||
var sjs = SimpleJekyllSearch({
|
var sjs = SimpleJekyllSearch({
|
||||||
searchInput: sbox,
|
searchInput: sbox,
|
||||||
resultsContainer: document.getElementById('results-container'),
|
resultsContainer: document.getElementById('results-container'),
|
||||||
@@ -37,5 +37,22 @@ getSearchJSON(function(json){
|
|||||||
});
|
});
|
||||||
sjs.search(mykeyword);
|
sjs.search(mykeyword);
|
||||||
document.getElementById('search-loading').style.display = "none";
|
document.getElementById('search-loading').style.display = "none";
|
||||||
|
}
|
||||||
|
getSearchJSON(function(json) {
|
||||||
|
if (typeof SimpleJekyllSearch !== 'undefined') {
|
||||||
|
_doSearch(json);
|
||||||
|
} else {
|
||||||
|
// PJAX 场景:外部脚本通过 pjax 库异步加载,需要等待加载完成
|
||||||
|
var _poll = 0;
|
||||||
|
var _waitSJS = setInterval(function() {
|
||||||
|
if (typeof SimpleJekyllSearch !== 'undefined') {
|
||||||
|
clearInterval(_waitSJS);
|
||||||
|
_doSearch(json);
|
||||||
|
} else if (++_poll > 100) {
|
||||||
|
clearInterval(_waitSJS);
|
||||||
|
document.getElementById('search-loading').style.display = "none";
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user