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

Add support for github enterprise #59

Open
philipcraig opened this issue Jul 9, 2020 · 6 comments
Open

Add support for github enterprise #59

philipcraig opened this issue Jul 9, 2020 · 6 comments

Comments

@philipcraig
Copy link

Hi, could this please be extended to support github enterprise setups?

@fiatjaf
Copy link
Owner

fiatjaf commented Jul 9, 2020

I don't know how does a GitHub Enterprise look and what would it take, never used one.
I imagine you just have to change some URLs, right?
How does the API work for GitHub Enterprise? We use GitHub API to fetch repository trees.

@philipcraig
Copy link
Author

It's exactly the same API, just some URLs change, as you said. Whereever github.com is hard-coded, it needs to be replaced with the github enterprise's URL

@fiatjaf
Copy link
Owner

fiatjaf commented Jul 10, 2020

What is that URL?

@AlexWayfer
Copy link

What is that URL?

I guess, it's a custom URL, especially with self-hosted version of GitHub. So, I think, base URL (domain) should be configurable in the extension.

@fiatjaf
Copy link
Owner

fiatjaf commented Jul 10, 2020

But the base URL should change depending on which repository the person is visiting.
So if I'm in https://my.custom.github.url/myuser/myrepo what is the API URL?
Or does a person who uses GitHub Enterprise also browses public repositories through that always?

@philipcraig
Copy link
Author

philipcraig commented Jul 10, 2020

Hi, here is an example curl session to an enterprise server. It shows basic use of GitHub API.

It shows that the API URL is the server's hostname (this needs to be configurable as it's different for every Enterprise git server). Also, for most (all?) Enterprise git servers, nothing useful happens unless you authenticate with your username and a Personal Access Token, so there needs to be a way to provide those also.

curl -i -u gitusername:gitpersonalaccesstoken https://enterprise.gitserver.tld/api/v3/zen

HTTP/1.1 200 OK
Server: github.com
Date: Fri, 10 Jul 2020 20:12:09 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 26
Status: 200 OK
X-RateLimit-Limit: 30000
X-RateLimit-Remaining: 29970
X-RateLimit-Reset: 1594414252
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 98ae8059-d8bb-46be-a5fb-e3ec8d94467e
Strict-Transport-Security: max-age=31536000; includeSubdomains
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-Runtime-rack: 0.029544

Favor focus over features.

The gory details are all here:

https://docs.github.com/en/enterprise/2.21/user/rest/guides/getting-started-with-the-rest-api

and you could compare with the public GitHub version of the same thing by contrasting the above with the page here:

https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api

Essentially, URLs in this extension that are written beginning as http(s)://api.github.com/command would need to become a configurable hostname, in the form: http(s)://enterprise.gitserver.tld/api/v3/command

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

3 participants