部署友链朋友圈
后端
配置 Leancloud
账号注册
前往 Leancloud 国际版官网(推荐国际版)注册账号,登录。
新建应用
进入控制台创建一个应用,名字随意。
选开发版,任意描述。
获取应用 Keys
转到设置 - 应用 Keys,将应用 ID(AppID)和应用密钥(AppKey)保存下来,方便后面步骤使用。
配置 Github Action
Fork 仓库
地址:https://github.com/Rock-Candy-Tea/hexo-circle-of-friends/
vim [root]/hexo_circle_of_friends/setting.py
:
1 | LINK = [ |
添加环境变量
转到 Settings - Secrets - New repository secret。
Name 分别为 APPID、APPKEY、LINK。
Value 分别为刚刚保存的 Leancloud 应用 ID(AppID)和应用密钥(AppKey)以及你的友链链接(https://www.casecori.top/link/)。
启用 Fork 仓库的 Github Action,点击 Actions - I understand my workflows, go ahead and enable them。
点击 update-friends-posts、Enable workflow。
配置 Vercel
导入仓库
前往 Vercel 登录,点 New Project,找到 Import Git Repository,应该可以看见 Fork 仓库,点击 Import。
添加环境变量
Name 分别为 APPID、APPKEY。
Value 分别为保存的 Leancloud 应用 ID(AppID)和应用密钥(AppKey)。
Star
Star Fork 项目,就可以开始爬取数据了。
当执行完成后,访问你的 Leancloud 后台,进入刚刚创建的项目,如果出现 friend_list 的 Class 和 friend_poor 的 Class,则说明配置成功。
访问
在 Vercel 找到 DOMAINS 下面的地址,如:hexo-circle-of-friends-rosy.vercel.app
,前端需要的就是这个地址。
在这个地址后面拼接 /all
尝试访问,出现数据就说明配置成功。
前端
1 | hexo new page circle |
vim source/circle/index.md
:
1 | --- |
访问 /circle,大功告成。