hexo-theme-gal icon indicating copy to clipboard operation
hexo-theme-gal copied to clipboard

gitment迁移gitalk

Open fnsflm opened this issue 4 years ago • 3 comments

1. 前言 最近试图解决gitment报错:object ProgressEvent, 找到一个能用的gitment issue #175, 结果又冒出来Bad credentials. 重新设置oauth app之类的方法也试过, 没有找到好的解决手段. 再加上考虑gitment已经是四年没维护的项目了, 所以决定还是使用gitalk.

2. 展示 050 调了一下样式, 大概长这样, 比原来的差不少, 但总比用不了强 测试页面: http://testpage.fnsflm.xyz 个人博客: https://fnsflm.xyz

3. 使用 pull 修改后的项目: https://github.com/fnsflm/hexo-theme-gal _config.yml中填上原来gitment需要填的, 并将change_to_gitalk改为true即可. 并没有删掉原来的gitment, 仍然可以选择使用. source/css/_gitalk.scss用来改变评论区的样式 source/js/comment/gitalk.js加载gitalk

4. 迁移 在原来所有的issue上都加上Gitalk的标签: 图片

5. 最后

  • 对比原来的差挺多的, 比如鼠标放上去头像会转的特效, 还有表情一栏等. (有时间再看吧)
  • 如果有谁的gitment能用, 真诚的希望能分享一下引入gitment的js文件, (比如该项目是在layout/layout.ejs<script src="https://myau.moe/js/comment/gitment.browser.js"></script>)
  • 我并没有任何的前端开发的经验也没学过前端语言, 只会东拼西凑在依葫芦画瓢写一点. 所以复制粘贴的代码可能我自己都不懂...希望能有大佬接手评论区的开发, 当然我自己也会偶尔写点

6. bug **[solved]**Error: Request failed with status code 403 详细讨论: https://github.com/gitalk/gitalk/issues/429

fnsflm avatar Feb 23 '21 19:02 fnsflm

我配置了,在本地 sudo hexo server -p 4001 能否看到? 我是直接在原来的本地仓库里面改的,加上这个

# 评论系统, 目前只支持gitment(为了自定义样式)
# 关于gitment如何配置看这篇 https://imsun.net/posts/gitment-introduction/
# 如果不用的话要把下面的use_comment设置为false
comment:
  gitment:
      owner: 12345 # 必填项, 你的GitHub ID
      repo:  https://github.com/pheromone/pheromone.github.io/issues # 必填项  你的存储评论的repo
      oauth:
        client_id: 1123456  # 必填项
        client_secret: 12345 # 必填项
        redirect_uri: # 可以填也可以不填
  # 是否改成gitalk, gitment的必填项也是要填的
  gitalk:
    change_to_gitalk: false
    # 出现403错误, 增加proxy, default: https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token
    # 具体讨论: https://github.com/gitalk/gitalk/issues/429
    proxy: https://netnr-proxy.cloudno.de/https://github.com/login/oauth/access_token

# 是否使用评论系统
use_comment: true

shaoting0730 avatar Dec 04 '21 03:12 shaoting0730

我配置了,在本地 sudo hexo server -p 4001 能否看到? 我是直接在原来的本地仓库里面改的,加上这个

# 评论系统, 目前只支持gitment(为了自定义样式)
# 关于gitment如何配置看这篇 https://imsun.net/posts/gitment-introduction/
# 如果不用的话要把下面的use_comment设置为false
comment:
  gitment:
      owner: 12345 # 必填项, 你的GitHub ID
      repo:  https://github.com/pheromone/pheromone.github.io/issues # 必填项  你的存储评论的repo
      oauth:
        client_id: 1123456  # 必填项
        client_secret: 12345 # 必填项
        redirect_uri: # 可以填也可以不填
  # 是否改成gitalk, gitment的必填项也是要填的
  gitalk:
    change_to_gitalk: false
    # 出现403错误, 增加proxy, default: https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token
    # 具体讨论: https://github.com/gitalk/gitalk/issues/429
    proxy: https://netnr-proxy.cloudno.de/https://github.com/login/oauth/access_token

# 是否使用评论系统
use_comment: true

你说的原来的本地仓库是我修改之前的版本吗? 这些设置在我修改后的版本才能用

fnsflm avatar Dec 04 '21 06:12 fnsflm

谢谢~,那直接重新改下了,我的本地代码仓库是两年前的那干脆把你的分支合并到主分支吧。 @fnsflm

shaoting0730 avatar Dec 05 '21 04:12 shaoting0730