[object ProgressEvent]
haig233 opened this issue · 53 comments
现在全网的gitment登录都报[object ProgressEvent] 错误
希望作者能修复
这似乎是个间断出现的错误,我自己的网页每次登录都有1/3的几率报这个错误...
P.S.:作者好像已经弃坑了
看起来作者提供给使用者的加 CORS header 的服务已经停了,如果想继续使用我们就得自己搭一个这样的服务,不过作者已经把这个开源了,很简单的 nodejs 代码,项目地址
@SeasideLee 这个怎么弄的啊
方便发下教程吗?
关键我这个主题把gitment集成在里面,关键的配置文件和代码在哪我都还要一个个去找
@haig233 全局搜https://gh-oauth.imsun.net/ 应该能找到gitment的js文件
我是萌新站长,不懂那么多
@haig233 服务器源代码在这https://github.com/imsun/gh-oauth-server ,由于是nodejs写的所以需要安装nodejs环境 如何安装自己Google; 然后git clone 该项目并进入目录, 执行npm install
安装依赖, 依赖安装成功后执行npm start
, 如果输出start on port 300
表示开启成功,;为了支持ssl 可以安装nginx代理, 这个可以自己百度, 有很多教程的
试了下@shlyren @SeasideLee 的方法,可行,就是http好像还是会报错,https就可以了
估计是证书到期导致
这个证书签发时间有点短吧
对不起,给各位大佬添麻烦了。
本人在别人的issue里面发了这个issue的链接,然后发现居然自动创建了一个引用。(真不知道
(搜索的结果都是不可删除,怕是真的删除不了了
请大家忽视这个引用吧,给大家添麻烦了~
由于引入的 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);
});
请求了一个服务接口,由于这个服务接口是作者自己搭建的,已经停止了。
这里可以直接改为请求 github 认证的接口
_utils.http.post('https://github.com/login/oauth/access_token', {...}
就可以了,不用经过作者的服务
同样出现这种情况
但不是永远无效
我等了一会之后又可以使用了
然而换一个浏览器登录又出现了这个问题
=_=
我自己搭建了 一个通用的跨域服务,可以解决这个问题。 具体可以看 https://www.wenjunjiang.win/2017/07/02/gitment%E8%AF%84%E8%AE%BA%E6%A8%A1%E5%9D%97%E6%8E%A5%E5%85%A5hexo/
@shlyren 感谢!我现在使用你的 https://auth.baixiaotu.cc 来授权啊,现在正常使用啊~
oh no
@shlyren 感谢给出解决办法。根据你的提示,我自己搭了一个服务器,一切运行正常.
有需要的小伙伴,可以来用 https://bak.smalbox.club
我写了一个详细的搭建过程,想自己搭建的可以来做个参考。帖子在这里
如果使用Hexo nexT主题中集成的gitment,该如何修复这个问题呢?
@fuhailin next 的gitment插件在hexo-theme-next/layout/_third-party/comments/gitment.swig
,
直接把该文件中的 gitment js引用地址(https://imsun.github.io/gitment/dist/gitment.browser.js
)改为修改后的js地址就好了
@fuhailin next 的gitment插件在
hexo-theme-next/layout/_third-party/comments/gitment.swig
,
直接把该文件中的 gitment js引用地址(https://imsun.github.io/gitment/dist/gitment.browser.js
)改为修改后的js地址就好了
你私服地址换了记得更新一下哦,暂时用你的啦
@shlyren 你好, 我按照你上面的简单步骤搭建服务了, 可以看到服务监听在端口3000上, 但是在log in时仍然是这个错误, 请问有什么解决办法吗? 地址https://github.com/Evil-crow/Evil-crow.github.io
谢谢
@Evil-crow https://evil-crow.github.io/2017/09/22/Guide/Linux/how_to_install_linux/
可以的啊,
目前撸了一个 PHP 的实现:https://gh-oauth.openapi.link
,如果需要自己搭建的话可以参考:isecret/gh-oauth-server。
由于引入的 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); });
请求了一个服务接口,由于这个服务接口是作者自己搭建的,已经停止了。
这里可以直接改为请求 github 认证的接口
_utils.http.post('https://github.com/login/oauth/access_token', {...}
就可以了,不用经过作者的服务
我改成这个,可以了,没问题!感谢!www.tanrd.com
我自己搭建了 一个通用的跨域服务,可以解决这个问题。 具体可以看 https://www.wenjunjiang.win/2017/07/02/gitment%E8%AF%84%E8%AE%BA%E6%A8%A1%E5%9D%97%E6%8E%A5%E5%85%A5hexo/
-
修改文件themes\next\layout_third-party\comments\gitment.swig:
https://imsun.github.io/gitment/style/default.css 修改为 https://www.wenjunjiang.win/css/gitment.css
https://imsun.github.io/gitment/dist/gitment.browser.js 修改为 https://www.wenjunjiang.win/js/gitment.js -
修改文件themes\next_config.yml:
gitment下的mint修改为false
3.重启服务器就可以了
感谢大佬!!!
@shlyren 你的这个 https://auth.baixiaotu.cc 服务器链接已经不能使用了😭
如果是换了post也不行,试试将gitment.ejs的script src项,改成https://jjeejj.github.io/js/gitment.js或者https://www.wenjunjiang.win/js/gitment.js
也可以使用这个:
<script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"/>
建议转gitalk,可以兼容之前gitment的评论。
还有问题的可以看下教程:
https://sherry0429.github.io/2019/02/12/gitment%E4%BF%AE%E5%A4%8D/
我这边自己参考楼上的各位大佬做了一遍,主要就是建立服务器,修改gitment中的browser.js并上传至一个某个oss或静态文件服务器,在引用gitment对应js的地方替换为自己上传的js。
上述的博客是可以评论的(用的就是gitment),有问题可以交流
自己搭建服务器解决方案可以参考这篇文章,完整讲述如何部署nodejs项目到阿里云ECS服务器上,
阿里云ECS服务器部署Node.js项目全过程详解
可以参考 https://awen.me/post/64465.html 文档说明配置。
主要是作者的这个仓库不提供default.css和itment.browser.js,导致读取这两个链接的时候出错
🍉 :
解决
打开你的blog本地仓库themes\yilia\layout_partial\post\gitment.ejs将
<link rel="stylesheet" href="//imsun.github.io/gitment/style/default.css">
<script src="//imsun.github.io/gitment/dist/gitment.browser.js"></script>
修改为:
<link rel="stylesheet" href="https://wzxjayce.github.io/gitment.css">
<script src="https://wzxjayce.github.io/gitment.js"></script>
[参考链接](https://blog.csdn.net/wardseptember/article/details/82828391)
目前撸了一个 PHP 的实现:
https://gh-oauth.openapi.link
,如果需要自己搭建的话可以参考:isecret/gh-oauth-server。
目前用的是您的服务,如果您有变动,还请告知一下。@isecret
目前撸了一个PHP的实现:
https://gh-oauth.openapi.link
,如果需要自己搭建的话可以参考:isecret / gh-oauth-server。目前用的是你的服务,如果您有变动,还请告知一下。@isecret
我也用的这个,千万别崩啊
目前网上大部分解决方案都失效了,可以使用下面的方法解决:
打开你的blog本地仓库themes\next\layout_third-party\comments\gitment.ejs将
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
修改为:
<link rel="stylesheet" href="https://billts.site/extra_css/gitment.css">
<script src="https://billts.site/js/gitment.js"></script>
上面给出的是gitment汉化版
teet
@Chiang97912 亲测可用,不过确实是汉化版的,有没有原版的地址?thx~
测试了网上一些英文版基本都失效了,暂时只知道这个汉化版可以使用。
@Chiang97912 亲测可用,不过确实是汉化版的,有没有原版的地址?thx~
【弃坑,转 GitTalk】
方法:把 gitment 转为 GitTalk ,只需要修改 gitment.ejs 文件:
<div id="gitment-ctn"></div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script>
var gitalk = new Gitalk({
clientID: 'xxxxx', //Client ID
clientSecret: 'xxxx', //Client Secret
repo: 'newban_comment',//仓库名称
owner: 'iHTCboy',//仓库拥有者
admin: ['iHTCboy'],
id: location.href, // Ensure uniqueness and length less than 50
distractionFreeMode: false // Facebook-like distraction free mode
})
gitalk.render('gitment-ctn')
</script>
其中的参数可以用配置文件的值:
clientID: '<%=theme.gitment_oauth.client_id%>',
clientSecret: '<%=theme.gitment_oauth.client_secret%>',
repo: '<%=theme.gitment_repo%>',
owner: '<%=theme.gitment_owner%>',
最后,如果需要迁移原评论,需要在 issues 中添加 label 标签 “Gitalk” 才能识别原有的评论。
文件参考:https://github.com/iHTCboy/hexo-theme-yilia/blob/master/layout/_partial/post/gitment.ejs