前言

由于github访问太慢,且vercel似乎好像被墙了,且该博客没有进行资源压缩导致加载太慢,所以部署到阿里云服务器

介绍

基于Hexo框架博客的部署,本地hexo三连后再由该插件同步远程仓库

源代码

已设置只有主人才能使用,可到第25行修改qq号

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

import { execSync } from 'child_process'


export class randomPic extends plugin {
constructor() {
super({
name: 'hexo仓库',
dsc: 'hexo仓库更新',
event: 'message',
priority: -1000,
rule: [
{
reg: '^#?hexo更新$',
fnc: 'updateGitRepo'
}
]
})
}


async updateGitRepo(e) {
if (e.user_id != 2331329306) {
e.reply(`该命令仅主人可下达`)
return;
}
const command = 'cd .. && cd hexo-blog/lingyatou.github.io && git pull';
try {
const result = execSync(command, { stdio: 'pipe' })
e.reply(`资源更新成功,请打开博客查看\n www.pardofelis.icu \n 日志为:\n` + result.toString().trim())
}
catch (error) {
e.reply(`资源更新失败,报错为\n ` + error.message.toString().trim())
}
}
}

图片来源于网络,侵删