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迁移gitalk #82

Open
fnsflm opened this issue Feb 23, 2021 · 3 comments
Open

gitment迁移gitalk #82

fnsflm opened this issue Feb 23, 2021 · 3 comments

Comments

@fnsflm
Copy link

fnsflm commented Feb 23, 2021

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
详细讨论: gitalk/gitalk#429

@shaoting0730
Copy link

我配置了,在本地 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
Copy link
Author

fnsflm commented Dec 4, 2021

我配置了,在本地 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
Copy link

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

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

No branches or pull requests

2 participants