conwnet / github1s

One second to read GitHub code with VS Code.
https://github1s.com
MIT License
22.74k stars 851 forks source link

Github Enterprise support #114

Open gragib opened 3 years ago

gragib commented 3 years ago

For a Github Enterprise server hosted behind a firewall at https://git.example.co/, what changes need to be made use it with a self-hosted version of github1s?

xcv58 commented 3 years ago

https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/client.ts#L11 and API url in the file https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/api.ts

gragib commented 3 years ago

It would be mighty convenient if https://api.github.com/ was replaced with a configurable variable. In my hypothetical situation, GHE equivalent is https://git.example.co/api/v3/.

gragib commented 3 years ago

~1. How do I ensure basic authentication is used for all API calls?~ ~2. Where do I add the token?~ ~3. What permissions are required when generating the token?~

Figured it out.

gragib commented 3 years ago

I have a hit a roadblock with the GraphQL API: path was added in GHE 3.0. I am on an older release.

https://github.com/conwnet/github1s/blob/182a6196cd585c975a3735bb6bb097de3b79c723/extensions/github1s/src/client.ts#L25-L30

gragib commented 3 years ago

Removing path seems to get things in working order. What are the downsides?

Shegox commented 3 years ago

One additional thing, which I noticed when setting it up for GitHub Enterprise Server that using GitHub pages is probably not the best idea for hosting because of two reasons:


Another more generic idea would be to allow github1s to open urls in the form of github1s.com/$hostname/$ORG/$repo and adding support for multiple token/server. Then even Enterprise users could use github1s, even behind a firewall as requests are sent from the browser directly to the Enterprise Server and don't go over github1s.

gragib commented 3 years ago

At our place of work, we are supposed to use a Confluence wiki instead of GitHub Pages. Anybody who needs this will need to self-host it on localhost.

I will try to sort out all the changes that need to be made and submit a PR in the near future.

ajay-sreeram commented 3 years ago

~1. How do I ensure basic authentication is used for all API calls?~ ~2. Where do I add the token?~ ~3. What permissions are required when generating the token?~

Figured it out.

@gragib can you please elaborate the answers to these questions

gragib commented 3 years ago

https://github.com/conwnet/github1s/issues/123#issuecomment-779288452

The UI for generating and adding a token is in the above comment. You will need to modify the GutHub URL to point to your instance of GHE.

ajay-sreeram commented 3 years ago

Thankyou @gragib

rpgeddam commented 3 years ago

https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/client.ts#L11 and API url in the file https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/api.ts

These URLs aren't valid anymore. nor can I find an api.ts file in the repo. What's the new location for these settings?

Siddhant-K-code commented 3 years ago

https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/client.ts#L11 and API url in the file https://github.com/conwnet/github1s/blob/master/extensions/github1s/src/api.ts

These URLs aren't valid anymore. nor can I find an api.ts file in the repo. What's the new location for these settings?

you will get all your answers at: https://github.com/conwnet/github1s/tree/master/extensions/github1s/src/interfaces

rpgeddam commented 2 years ago

you will get all your answers at: https://github.com/conwnet/github1s/tree/master/extensions/github1s/src/interfaces

FWIW, this link isn't valid anymore either.

conwnet commented 2 years ago

FWIW, this link isn't valid anymore either.

@rpgeddam Now you can visit here: https://github.com/conwnet/github1s/tree/1e814e91eeab88e4139c2ce57be78bd161c594a6/extensions/github1s/src/adapters