路径:hemes/next/layout/third-party/comments/gitment.swig
修改文件替换js文件路径1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname %}
{% if theme.gitment.enable and theme.gitment.client_id %}
<!-- LOCAL: You can save these files to your site and update links -->
{% if theme.gitment.mint %}
{% set CommentsClass = "Gitmint" %}
<link rel="stylesheet" href="https://aimingoo.github.io/gitmint/style/default.css">
<!-- 更换此处的js路径为github上的路径 , 同时修改该js文件中的认证登录地址为自己的服务-->
<script src="https://gitmenta.github.io/gitmenta/gitmint.browser.js"></script>
{% else %}
{% set CommentsClass = "Gitment" %}
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
{% endif %}
<!-- END LOCAL -->
``
修改文件中:
查找 https://gh-oauth.imsun.net 并替换为自己的服务器地址
https://gitmenta.github.io/gitmenta/gitmint.browser.js"
this.state.user.isLoggingIn = true;
var logging = !proxy_gateway ? _utils.http.post(‘https://gh-oauth.imsun.net ‘, { code: code, client_id: client_id, client_secret: client_secret }, ‘’) : _utils.http.post(‘/login/oauth/access_token’, ‘code=’ + code + ‘&client_id=’ + client_id, proxy_gateway);
logging.then(function (data) {1
2
### 搭建服务器
git clone https://github.com/imsun/gh-oauth-server.git
npm install && npm start`
默认会在3000端口启动服务
问题:在https中调用http的js文件会被浏览器阻止,需要ssl认证