homerchen19 / github-file-icons

🌈 🗂 A browser extension which gives different filetypes different icons to GitHub, GitLab, gitea and gogs.
https://chrome.google.com/webstore/detail/file-icon-for-github-and/ficfmibkjjnpogdcfhfokmihanoldbfe
MIT License
1.46k stars 70 forks source link

Support Github Enterprise #2

Closed raphaeleidus closed 5 years ago

raphaeleidus commented 6 years ago

Ideally in the same way this works: https://github.com/buunguyen/octotree#enterprise-urls

homerchen19 commented 6 years ago

@raphaeleidus Sorry I haven't used GitHub enterprise before, and I don't have enterprise account. Therefore, I could be difficult for me to develop. Hope someone could help this issue out.

MichielDx commented 6 years ago

I'll take a look at this, after fixing gitlab and bitbucket

matchai commented 6 years ago

I'm a fan of how it was handled as a Browser Action in Refined GitHub: https://github.com/sindresorhus/refined-github/pull/819. Less clicking, less copy-pasting, all-around simpler.

Additionally, it has been spun out into its own npm package: https://github.com/bfred-it/webext-domain-permission-toggle

NickCraver commented 6 years ago

I'm happy to test anything here, as I'd love to see it on Enterprise as well. The UI is nearly identical, and should be for everywhere this is. I agree with @matchai the way Refined GitHub works (where you're simply prompted for a domain) works very well. Ultimately all we're doing is adding a domain of where this extension runs.

charliegroll commented 6 years ago

Any update on this?

homerchen19 commented 6 years ago

@charliegroll So far, nop. Would you want to take it?

stamminator commented 6 years ago

I think I'll take a crack at it 🙂. https://github.com/stamminator/github-file-icon/blob/master/src/js/background.js should be able to compare a list of dynamic URLs to determine whether or not to apply the styles. The only tricky part would be deciding how to pass them in. Perhaps clicking the extension icon could open a little GUI where custom URLs may be entered. Anyone have any feedback on this approach?

FranklinYu commented 6 years ago

Both GitLab and BitBucket support self-hosting. If GitHub Enterprise is supported, I think it would be easy to also support self-hosted GitLab and BitBucket.

@stamminator Not that easy. Domain name also affect content script:

https://github.com/xxhomey19/github-file-icon/blob/222f60d431466dd0205b0e6669c2cce4dc9d93d3/src/js/contentscript.js#L11-L40

stamminator commented 6 years ago

@franklinyu, gotcha, so when the user is entering their custom URL, they'll also need to select which product they're using from a drop-down or something. These custom URLs can be stored as an array of { url: 'enterprise.domain.com', provider: 'github' } objects, just as a concept.

fregante commented 5 years ago

I recently published 2 modules that might help you with this:

https://github.com/fregante/webext-domain-permission-toggle https://github.com/fregante/webext-dynamic-content-scripts

You'd just need:

npm i webext-domain-permission-toggle webext-dynamic-content-scripts
// in background.js
import 'webext-dynamic-content-scripts';
import addDomainPermissionToggle from 'webext-domain-permission-toggle';

addDomainPermissionToggle();

You'll also be able to drop the tabs and webNavigation permissions, together with:

https://github.com/xxhomey19/github-file-icon/blob/a525d94786258b707546abe42b8d5b77dbd1284f/src/js/background.js#L14-L18

I'm sending a PR