写作不易,资瓷一下呗!本文首发于个人博客:https://raycoder.me
最近在GitHub上面发现了一个很有趣的项目,名叫Mirror,官方Demo在这里:https://mirror.am0200.com/

哎哟我艹,貌似有那么一丢丢好康,但是这个release就有点过粪了吧?


这个绝对是我见过最简单的博客了,使用动态路由分发视图,单页面应用。
I了I了~
搭建,也很简单,从这里下载最新版Mirror,解压后在index.html里进行配置即可。
打开index.html,找到window.config开头,进行修改。
获取Token
获取Token很简单,去https://github.com/settings/tokens/new获取即可,这个 token 只需要只读权限,只需要勾选以下:
- read: user Read all user profile data
- user: email Access user email addresses (read-only)
如果你的项目是属于一个组织的,还需要勾选一个权限:
- read: org Read org and team membership
像这样。

添加 token 说明,然后点击 Generate token,就可以获得你的 token。要记得保存。
获取Hash
据作者说,Hash加密一层是为了防止GitHub看到Token删仓库。
下面是获取 hash 的步骤
- 获取 token(已经完成)
- 获取你的主域名
hostname,例如https://mirror.am0200.com的主域名为mirror.am0200.com - 打开 Mirror 网站,并打开
开发者工具界面 - 在开发者工具的
consoletab 页面,输入 js 代码window.encrypt('你的token', '你的主域名'),注意不要写协议头,www是敏感的。

得到的字符就是 hash 串。
接下来只需要修改index.html即可。
修改index.html
window.config = {
organization: false, // 默认是 false,如果你的项目是属于 GitHub 组织 的,请设置为 true
order: 'UPDATED_AT', // 文章排序,以 创建时间 或者 更新时间,可选值 'UPDATED_AT','CREATED_AT'
title: 'Ray的记事小栈', // 博客标题
user: 'FFRaycoder', // GitHub 用户名,必须
repository: 'mirrorBlog', // GitHub 项目名,指定文章内容来源 issues,必须
authors: 'Ray', // 博客作者,以 ',' 分割,GitHub 用户名默认包含在内
ignores: '', // 文章忽略的 issues ID
host: '', // 博客的主域名,不填自动获取,请注意这个值会影响 hash 的值
hash: '', // 必须
perpage: 5, // 分页
}
然后把它推送到GitHub上,即可。
接下来只需要在仓库的Issue里写作即可。