Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitment评论模块接入hexo | 我的博客 #8

Open
jjeejj opened this issue Jul 2, 2017 · 77 comments
Open

gitment评论模块接入hexo | 我的博客 #8

jjeejj opened this issue Jul 2, 2017 · 77 comments

Comments

@jjeejj
Copy link
Owner

jjeejj commented Jul 2, 2017

http://wenjunjiang.win/2017/07/02/gitment%E8%AF%84%E8%AE%BA%E6%A8%A1%E5%9D%97%E6%8E%A5%E5%85%A5hexo/

@yidao620c
Copy link

dddd

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 19, 2018

由于引入的 gitment.js 中有这样的一段代码:

     _utils.http.post('https://gh-oauth.imsun.net', {
        code: code,
        client_id: client_id,
        client_secret: client_secret
      }, '').then(function (data) {
        _this.accessToken = data.access_token;
        _this.update();
      }).catch(function (e) {
        _this.state.user.isLoggingIn = false;
        alert(e);
      });

请求了一个服务接口,由于这个服务接口是作者自己搭建的,已经停止了。

这个存在跨域服务的

@yidao620c
Copy link

谢谢了

@yidao620c
Copy link

难怪我的Github主页会推荐你的链接,原来我的博客评论就是参考你的gitment

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 21, 2018

@yidao620c 现在gitmet 有问题了,作者处理跨域的服务,已经不能用了,现在都是都是自己在搭建服务。不知道你的还可以不可以的?

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 21, 2018

@yidao620c 其实如果 你经常在 github 上提交代码的话,就会把推荐替换下去的,都会显示自己的

@yidao620c
Copy link

我的还是可以用啊,没改

@yidao620c
Copy link

现在你的评论系统用的是自己搭建的?

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 21, 2018

@yidao620c 可以看这个 issue imsun/gitment#170
作者写的一个简单在这 https://github.com/imsun/gh-oauth-server

我自己的 服务还在写 https://github.com/jjeejj/CORS-Proxy-Server 通用的

@yidao620c
Copy link

你写好了更新下你的博客呀,我不去研究这个了。直接偷你的成果可否?^_^

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 21, 2018

@yidao620c 写好后,我会更新一下的

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 23, 2018

hexo 这个评论接了一个自己写的一个通用的跨域服务 https://cors.wenjunjiang.win/ github地址为:https://github.com/jjeejj/CORS-Proxy-Server ,代替作者的 https://gh-oauth.imsun.net 这个接口地址,去请求 github的接口。 可以自己搭建,可以转发所有的前端跨域服务。要注意的是: 在向 github 请求 access_token时 需要带上 Accept: application/json 或者 Accept: application/xml 请求头, 否则回报 406 的错误

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 23, 2018

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 23, 2018

是 fork 源作者的 repo ,在这个基础上改的,接入自己的服务,修改了一些 地方
https://github.com/jjeejj/gitment

@wardseptember
Copy link

我的gitment为啥在我该域名后就失效了,请教一下。http://wardseptember.me/

@jjeejj
Copy link
Owner Author

jjeejj commented Sep 24, 2018

@wardseptember 我刚才试了,你的是可以登录使用的。只不过你还用的原作者的按个 gitment.js 文件,不稳定而已

@wardseptember
Copy link

谢谢你啊,解决了。

@yidao620c
Copy link

我的换了后头像怎么显式不出来了?

@yidao620c
Copy link

哈哈,解决了。是这边网络问题

@eibitme
Copy link

eibitme commented Sep 28, 2018

// 测试 markdown
var express = require('express')

@iT-Boyer
Copy link

iT-Boyer commented Oct 3, 2018

直接把这个文件 https://imsun.github.io/gitment/dist/gitment.browser.js 替换为 https://www.wenjunjiang.win/js/gitment.js 就可以了
直接替换gitment.swig文件中的吗,这样是通过你部署的CORS-Proxy-Server服务了吗?

@jjeejj
Copy link
Owner Author

jjeejj commented Oct 4, 2018

@huos3203 对的,直接替换 gitment.swig 文件中,引用的 gitment.js 相关的文件就可以了

@oouxx
Copy link

oouxx commented Oct 9, 2018

请问一下,新版本的next集成的gitment 要在什么地方修改

@jjeejj
Copy link
Owner Author

jjeejj commented Oct 10, 2018

@oouxx 最新版的 next , 我没有看过对应的文件结构,原理应该也是一样的,修改对应的 swig 文件,把评论框集成进去据可以了,你可以自己尝试一下

@oouxx
Copy link

oouxx commented Oct 10, 2018

@jjeejj 嗯呢,我试试

@leondada
Copy link

弱弱问一句,其他主题能不能这样配置

@jjeejj
Copy link
Owner Author

jjeejj commented Jan 31, 2019

@Dennis8274 把错误信息和你的 hexo 网址发出来,我看看什么什么问题,你这样问,我没法回答

@Dennis8274
Copy link

@Dennis8274 把错误信息和你的 hexo 网址发出来,我看看什么什么问题,你这样问,我没法回答

搞定了,是最新版本的next的环境变量变了,如下图:
image
image ,另外还有一个问题咨询下,
image图中标出的字样怎么样才能用中文表示?谢谢,辛苦

@jjeejj
Copy link
Owner Author

jjeejj commented Jan 31, 2019

@Dennis8274 你可以直接修改 gitment,js 文件,搜索对应文字修改即可,但是不建议这样修改,因为 gitmen 现在只支持的 en-US,如果你非常需要中文,你可以修改对应的源码: 对应源码文件为 https://github.com/jjeejj/gitment/blob/master/src/theme/default.js

@mihone
Copy link

mihone commented Feb 8, 2019

@jjeejj 您好,我按照您说的改了js地址,可是我登录之后无法选中评论,鼠标还是红色禁止符号。。这是怎么回事

@llllfj
Copy link

llllfj commented Feb 8, 2019

测试

@543877815
Copy link

@bladeono +1

@jjeejj
Copy link
Owner Author

jjeejj commented Feb 10, 2019

@bladeono 你这样描述,没有办法定位问题。可以提供报错信息或者你的 hexo 博客地址

@CloudyCity
Copy link

终于找到一个能用的了,射射

@fanhy2114
Copy link

123

@SoliviorX
Copy link

为什么我的在initialize comments 时出现Error: Validation Failed。。。。。。

@jjeejj
Copy link
Owner Author

jjeejj commented Mar 11, 2019

@Shideshanxx 那就是你的 对应的 JS 文件引入错误,你可以打开控制台 看看报的什么错误

@zhanyue0214
Copy link

我是用node 写的,我是将你的两个包下载下来放入静态文件夹替换之前作者的两个包,但是一样报错[object ProgressEvent],还是无法进行登录是怎么回事呢

@jjeejj
Copy link
Owner Author

jjeejj commented Mar 15, 2019

@zhanyue0214 你打开浏览器,看看你实际请求的是之前的文件,还是你替换之后的文件?

@zhanyue0214
Copy link

zone.js:2744 OPTIONS https://gh-oauth.imsun.net/ net::ERR_CERT_DATE_INVALID确实还是之前的文件,但是我在静态文件夹已经进行替换文件了才对

@jjeejj
Copy link
Owner Author

jjeejj commented Mar 16, 2019

@zhanyue0214 这个你要排查你hexo 生产后的文件了,或者清除浏览器缓存 在试试

@pighui
Copy link

pighui commented Mar 28, 2019

我将我的gitment.browser.js的内容修改为 https://www.wenjunjiang.win/js/gitment.js你的这个
引用了
<script src="https://jjeejj.github.io/js/gitment.js"></script>
但在初始化时遇到了以下问题
Error: Validation Failed
可以帮我看一下吗
这是我的博客地址 https://www.xuhuiblog.cn

@jjeejj
Copy link
Owner Author

jjeejj commented Mar 28, 2019

@pighui 我是登录成功的。但是你没有初始化你的评论框,你可以尝试清除缓存试试 disbale cache
image

@pighui
Copy link

pighui commented Mar 28, 2019

@jjeejj
截屏-20190328145519-858x348
点击初始化之后就会出现这个

@jjeejj
Copy link
Owner Author

jjeejj commented Mar 28, 2019

@pighui 你把控制台打开 ,看看报什么错

@pighui
Copy link

pighui commented Mar 28, 2019

@jjeejj
截屏-20190328191005-554x97

@pighui
Copy link

pighui commented Mar 28, 2019

截屏-20190328191005-554x97

@jjeejj
Copy link
Owner Author

jjeejj commented Mar 29, 2019

@pighui
422 Unprocessable Entity
请求格式正确,但是由于含有语义错误,无法响应。

可以看看 你发送请求的时候,发送的参数

@pighui
Copy link

pighui commented Mar 29, 2019

@jjeejj
截屏-20190329183609-1159x475
我重新搭了一遍,把那俩引用文件放到自己的服务器上就莫名其妙的好了,非常感谢您的耐心解答和帮助。

@waynia
Copy link

waynia commented Apr 21, 2019

这个办法竟然真的可以..厉害了

@HenryBeWell
Copy link

你好,我也暂时借用了你的服务,,但是初始化的时候会报认证失败的错误(validation error),能方便看看么,不胜感激! 地址 :zhanghengruic.github.io 模板用的是jekyll

@jjeejj
Copy link
Owner Author

jjeejj commented May 9, 2019

@zhanghengruiC
我这边无法进行初始化
image
你可以报错的具体信息放出来

@HenryBeWell
Copy link

HenryBeWell commented May 9, 2019 via email

@jjeejj
Copy link
Owner Author

jjeejj commented May 9, 2019

@zhanghengruiC
你可以在 gitment.css 文件中搜索 gitment-comment-avatar-img 这个 class
你会看到这样的一段样式

.gitment-comment-avatar,
.gitment-comment-avatar-img,
.gitment-comment-avatar,
.gitment-editor-avatar-img,
.gitment-editor-avatar svg {
  width: 44px;
  height: 44px;
  border-radius: 3px;
}

这里面的 widthheight 就是头像的宽和高

@ZenCracker
Copy link

试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests