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

use staticman v3 api scheme and GitHub App authorization method #483

Open
VincentTam opened this issue Mar 2, 2021 · 2 comments
Open

use staticman v3 api scheme and GitHub App authorization method #483

VincentTam opened this issue Mar 2, 2021 · 2 comments

Comments

@VincentTam
Copy link

Description

You're current using Staticman v2.

staticmanUrl: https://spinningnumbers-staticmandev2.herokuapp.com/v2/entry/willymcallister/willymcallister.github.io/master/comments

Staticman's updated official quick start guide shows the latest API scheme:

{STATICMAN_BASE_URL}/v3/entry/{GIT_PROVIDER}/{GIT_PROVIDER_USERNAME}/{REPO}/{BRANCH}/{property (optional)}

For example

https://staticmaninstance.herokuapp.com/v3/entry/github/eduardoboucas/staticman/gh-pages/comments

The use of a private GitHub App is preferred over a GitHub bot, which can be invited by any GitHub user. Despite the possibility to close the v2/connect route, setting up Staticman v3 with GitHub App according to the official quick start guide should be easier. GitHub App is more resistant to the rate API limit problem (c.f. eduardoboucas/staticman#222 & eduardoboucas/staticman#227). By making your own GitHub App private, you can prevent others from using it.

@willymcallister
Copy link
Owner

willymcallister commented Mar 3, 2021

@VincentTam - Thank you for submitting these four issues on my jekyll/gh-pages web site. Before attempting to do these I have a question about updating Staticman. I'm successfully using Staticman v2 as a bot at Heroku. You are suggesting I move to v3 and make it a private "app" instead of a bot. I'm not super clear on the steps. My memory says I set it up with the "dev" version about a year ago.

  1. What is the proper way to update Staticman to the best version (master)? Do I just click the Deploy button at https://github.com/eduardoboucas/staticman to overwrite the existing deploy?
  2. In the Deploy instructions I don't see where/if I choose it to be an app instead of bot access. These concepts are fuzzy.

I have other uncertainties about modifying my comment

and changing the post method to xmlHttpRequest. I reviewed your PR daattali/beautiful-jekyll#782 to see if I could read the code. It is recognizable but different than my form processing javascript (main.js). But I will ask about that another time.

@VincentTam
Copy link
Author

I'm not super clear on the steps.

If you find the official tutorial unclear, you may try my illustrated guide. However, I didn't think about updating an existing API instance when I wrote that.

  • What is the proper way to update Staticman to the best version (master)? Do I just click the Deploy button at https://github.com/eduardoboucas/staticman to overwrite the existing deploy?
  • In the Deploy instructions I don't see where/if I choose it to be an app instead of bot access. These concepts are fuzzy.

For further questions about the back-end setup, you may ask them in the GitHub repo of Staticman. In this way, you receive feedback from other fellow Staticman users.

For theme/site-specific issues related to Staticman, for example,

  1. comment form UI design
  2. template code (parsed by a static site generator) for parsing data files generated by Staticman
  3. JavaScripts handling the form submit (to a Staticman API instance)

it's better asked in the theme/site's Git* repo, as the parameters vary from theme to theme.

The above questions concern only Staticman's deployment, so they're better asked in the GitHub repo of Staticman. It is technically possible that several projects across different users on both GitHub and GitLab use the same API instance.

changing the post method to xmlHttpRequest. I reviewed your PR daattali/beautiful-jekyll#782 to see if I could read the code. It is recognizable but different than my form processing javascript (main.js).

You may adapt it to your needs. More precisely, you may change the body (and the name) of the functions formSubmitted and formError according to your UI: successformSubmitted; errorformError. I created these function names in my PR. You can rename them to any name you want.

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