xingty / gitalk-anonmously-comment

gitalk-anonmously-comment
gitalk-anonmously-comment.bigbyto.vercel.app
0 stars 2 forks source link

Run in Vercel #1

Open marlluslustosa opened 3 years ago

marlluslustosa commented 3 years ago

Hi. How can I run this code in vercel? I tried to run it, changing the parameters of config.example.js but I called it as you describe here but it didn't work. Is any additional hack needed?

You did an excellent job! Congratulations!

CN-lang

嗨,我如何在 vercel 中运行此代码? 我尝试运行它,更改了 config.example.js 的参数,但我按照您在此处描述的方式调用它,但它不起作用。 前端/后端是否需要额外的东西?

你的工作做得非常出色! 恭喜!

xingty commented 3 years ago

Hi. How can I run this code in vercel? I tried to run it, changing the parameters of config.example.js but I called it as you describe here but it didn't work. Is any additional hack needed?

You did an excellent job! Congratulations!

CN-lang

嗨,我如何在 vercel 中运行此代码? 我尝试运行它,更改了 config.example.js 的参数,但我按照您在此处描述的方式调用它,但它不起作用。 前端/后端是否需要额外的东西?

你的工作做得非常出色! 恭喜!

Hello marlluslustosa. You must rename the config.example.js to config.js and fill in the correct configuration,such as the following:

#config.js
module.exports = {
    appId: 'your appid',
    appSecret: 'your secret',
    origin: 'CROS domain, * if allow any',
    accessToken: 'your personal access token',
    state: 'random string',
    redirectURI: 'accessToken url, used by api/authorize.js'
}

Thank you for your compliments,it makes my day to hear that.

marlluslustosa commented 3 years ago

I managed to run the code in my vercel account. :) However, I noticed some bugs, such as:

1 - on pages without comments, it does not enable the anonymous comment option. alt text However, if I log in to my account and then log out, it to open the screen to comment anonymously, even without any comments. as shown below: alt text

2 - in the first opening comment of the issue, it includes the token in the url (security issue). alt text

But on your blog these problems don't exist, so I think it's something on the frontend. Can you help me?

link to my tests: https://a5851e3a.myblog-bkz.pages.dev/en/poetry/2015/12/18/whats-over

xingty commented 3 years ago

I managed to run the code in my vercel account. :) However, I noticed some bugs, such as:

It looks like the national firewall is blocking vercel's domain. Are you located in China? Try using a proxy server to access your blog.

marlluslustosa commented 3 years ago

I'm outside China, in Brazil.

I didn't know that the firewall in china was blocking the vercel address.

As I'm not in China, the problems I mentioned seem to be due to some code missing from my website's frontend.

Access this link and see the bug when there is no comment made (the system gives an error of 'and is null'). https://a5851e3a.myblog-bkz.pages.dev/en/technology/2016/02/17/p2v-v2v-conversion-enviromments

xingty commented 3 years ago

I'm outside China, in Brazil.

I didn't know that the firewall in china was blocking the vercel address.

As I'm not in China, the problems I mentioned seem to be due to some code missing from my website's frontend.

Access this link and see the bug when there is no comment made (the system gives an error of 'and is null'). https://a5851e3a.myblog-bkz.pages.dev/en/technology/2016/02/17/p2v-v2v-conversion-enviromments

I found the error on that page. The error was caused by the github's issue cannot created correctly. The length of the label cannot exceed 50 characters,try to do this:


var locationArr = location.pathname.split('/')
var gitalk = new Gitalk({
    clientID: 'xxx'
    repo: 'gitalk_comments',
    owner: 'marlluslustosa',
    admin: ['marlluslustosa'],
    //id: location.pathname,
    id: locationArr[locationArr.length - 1],
    perPage: 20,
    proxy: 'server',
    server: {
      oauth_api: 'api',
      anonymous_api: 'api'
    },
    anonymous: {
      accountName: 'araphen'
    },
    cache: {
      comments: {
        enable: true,
        ttl: 600
      },
      userInfo: {
        enable: true,
        ttl: 3600
      },
      issue: {
        enable: true,
        ttl: -1
      }
    }
  });

You can also use other methods to shorten the length of the label.

marlluslustosa commented 3 years ago

You're still having the same problem. I've tried it with your code and always the two bugs always return ("Error: e is null" and the access token leak in the url in the first post). :/

Other example: https://099931da.myblog-bkz.pages.dev/en/art/2020/12/06/under-optics

In your case, do you have to manually create the issue first or will an anonymous person be able to comment, even without commenting on the post?

marlluslustosa commented 3 years ago

I posted a solution for this on my blog (in Portuguese). It's not translated into English yet, so use a translator. https://marllus.com/tecnologia/2021/06/23/gitalk-comentarios-anon

Thanks @xingty