github-custom-tab-size icon indicating copy to clipboard operation
github-custom-tab-size copied to clipboard

Allow custom sites

Open stefanjcollier opened this issue 7 years ago • 7 comments
trafficstars

I predominantly work on github enterprise, which is under https://github.<my company>.com.

Being able to add custom sites, i.e. github enterprise ones would be really handy.

You could achieve this by editing the manifest.json to work on https://github.* as well or go for a more sophisticated user input option like octohint does here (unfortunately this is TypeScript not pure JS but you get just about grasp their options page)

stefanjcollier avatar Apr 16 '18 13:04 stefanjcollier

Thanks for the sugestion, that's a great idea!

I'm pretty tied up on another project at the moment, are you interested in submitting a PR?

lukechilds avatar Apr 17 '18 05:04 lukechilds

Refined GitHub has a very elegant solution:

https://github.com/sindresorhus/refined-github/pull/819

@bfred-it has even kindly wrapped it up in a reusable module!

https://github.com/bfred-it/webext-dynamic-content-scripts#usage

lukechilds avatar Apr 17 '18 06:04 lukechilds

I looked into it (however chrome extensions are a new domain for me) but ended up manually installing it with an edited manifest.

This may be out of my league, so v1 might just be an extra markdown page with custom installation steps and a link to it on the README. That sound ok?

stefanjcollier avatar Apr 18 '18 10:04 stefanjcollier

Oh wait a minute, why not just append the domain? "https://github../*"

stefanjcollier avatar Apr 18 '18 11:04 stefanjcollier

Oh wait a minute, why not just append the domain? "https://github../*"

Because that only works for the specific scenario where GHE is installed on github.company.com. If your install is on git.company.com or ghe.company.com it won't work. It also means if I wanted to list some of my GitHub stats on github.lukechilds.co this extension would kick in and break my styles.

The domains it runs on should be scoped as specific as possible. Locking it only to github.com and gist.github.com and allowing users to manually whitelist their own enterprise instance is a much cleaner solution.

This may be out of my league, so v1 might just be an extra markdown page with custom installation steps and a link to it on the README. That sound ok?

I'd rather not encourage forking with modifications because then they won't benefit from any future updates. No worries if it's not something you feel comfortable with. I'll leave this issue open and hopefully someone else can give it a shot. Or when I have more free time to work on OSS, I'll implement it myself.

lukechilds avatar Apr 18 '18 11:04 lukechilds

That's fair, I'll give it a shot. But it's probably above me atm.

stefanjcollier avatar Apr 18 '18 12:04 stefanjcollier

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();

And some adjustments to manifest.json

fregante avatar Aug 07 '19 18:08 fregante