lukechilds / github-custom-tab-size

Chrome extension - Set custom tab size for code view on GitHub.com
MIT License
70 stars 17 forks source link

Allow custom sites #1

Open stefanjcollier opened 6 years ago

stefanjcollier commented 6 years ago

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)

lukechilds commented 6 years ago

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 commented 6 years ago

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

stefanjcollier commented 6 years ago

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 commented 6 years ago

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

lukechilds commented 6 years ago

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.

stefanjcollier commented 6 years ago

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

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

And some adjustments to manifest.json