hypertrons / hypertrons-crx

A browser extension for insights into GitHub projects and developers.
https://crx.hypertrons.io
Apache License 2.0
344 stars 98 forks source link

[Bug] Widgets do not show at GreptimeDB repo #773

Open tisonkun opened 8 months ago

tisonkun commented 8 months ago

Version

No response

Current Behavior

https://github.com/greptimeteam/greptimedb

I cannot see the OpenRank widgets as well as Perceptor.

Expected Behavior

I'd like to check the data for this repo.

Environment

- OS: MacOS Ventura M1
- Browser: Chrome Version 120.0.6099.234 (Official Build) (arm64)

Any additional comments?

No response

frank-zsy commented 8 months ago

@tisonkun The data URL is strictly identical with the GitHub repo name and it is case sensitive. So you should visit this URL: https://github.com/GreptimeTeam/greptimedb and the data will show up. We should check if there is another way to get the repo name from page meta data rather than the URL path so we can know the actually name of the repo.

tisonkun commented 8 months ago

SGTM. How can this plugin currently resolve the name? GitHub treats repo name case insensitive though.

frank-zsy commented 8 months ago

Right now, Hypercrx parses the window.location to get the repo name, I found there are some places in the web page to find out the real repo name, but we can not ensure to get the name since GitHub change the page content constantly while refactoring the website.

tisonkun commented 8 months ago

If you can access GitHub API, here are two methods you can resolve the name with "greptimeteam/greptimedb" to the proper fullname:

With REST API:

gh api -H "Accept: application/vnd.github.VERSION.sha" repos/greptimeteam/greptimedb | jq -r '.full_name'

You can rewrite this command with the JS API trivially.

With GraphQL API:

query {
  repository(owner: "greptimeteam", name: "greptimedb", followRenames: true) {
    nameWithOwner
  }
}
frank-zsy commented 8 months ago

Yes, this is a good method, although GitHub API call without token is limited by IP so it will be quite easy to hit the rate limit. If we support login to GitHub from the extension, we can use API calls to get the data and even more other interactions with GitHub.

tisonkun commented 8 months ago

I'm using GitHub Issue Link Status plugin also which should apply the tech you mention. You can check its code for how to do it.

frank-zsy commented 8 months ago

I installed the extension and it requires a GitHub token input manually on installation to call the API, actually we also provide the functionality before but removed in recent versions. I think we should add it back for further features.