trustoverip / spec-up-t

Create technical specifications in markdown. Based on the original Spec-Up, extended with Terminology tooling
https://trustoverip.github.io/spec-up-t-website/
Apache License 2.0
2 stars 2 forks source link

Add authentication to the GitHub API via token #29

Closed kordwarshuis closed 1 month ago

kordwarshuis commented 1 month ago

Add authentication to the GitHub API via token. This will increase the API limit from 60 requests per hour to 5000.

Server side (Node.js):

Client-side: Investigate how to do this.

Client-side API requests are necessary if you want to have real-time information about the versions of an external term accessed via the browser. This could be a button next to each xref.

Currently, a button on the webpage links to the latest version url on GitHub (opens in a new tab). This is not as intuitive as presenting the info inside the specification webpage.

If you are okay with regenerating the specification via the command line (or GitHub Action workflow (to be implemented)) and then checking if an external reference has changed, then this should be done via the command line (an extra option in the menu).

kordwarshuis commented 1 month ago

If you have ever tried using Github's API, you have probably already run into Github's rate limiting errors. Without authorization, Github only allows 60 requests per hour (!!), and after creating and using your own personal access token, you are upgraded to 5000 requests per hour.

That rate limit can be easily reached in just a few minutes by calling the API to list basic information from a medium sized repository, and you would have to wait 50+ minutes for the rate limit to reset in order to continue or try again. You can up the rate limit to 15,000 with an enterprise account, but the problem remains the same.

https://www.endorlabs.com/learn/how-to-get-the-most-out-of-github-api-rate-limits#:~:text=If%20you%20have%20ever%20tried,to%205000%20requests%20per%20hour.

kordwarshuis commented 1 month ago

Instructions: https://blockchainbird.github.io/spec-up-t-website/docs/github-token

kordwarshuis commented 1 month ago

Handling xrefs works, but the code needs to be refactored to avoid unnecessary requests to the GitHub API.

kordwarshuis commented 1 month ago

Code is now refactored (but not yet published).

kordwarshuis commented 1 month ago

User-friendly client-side handling of GitHub API token implemented (but still needs to be published).

kordwarshuis commented 1 month ago

Modal window implemented (but still needs to be published).

Next up: install Diff library and start showing inline diffs between different versions of terms and definitions, instead of opening pages on Github.

kordwarshuis commented 1 month ago

Modal window ==> published

showing inline diffs between different versions of terms and definitions ==> published

Done