chancancode / blame_parent

A chrome extension to make blaming easy on github
BSD 3-Clause "New" or "Revised" License
51 stars 3 forks source link

GitHub enterprise support? #3

Open jasonkarns opened 9 years ago

chancancode commented 9 years ago

I don't have access to the enterprise UI/markup. Is it pretty close to the public one? Guthub "recently" changed the markup and broke the extension. I'll fix it over the weekend, perhaps that would fix this also

jasonkarns commented 9 years ago

That's not the problem (I would only expect this to work with recent-ish versions of github enterprise that mirrored similar markup).

The issue is that the manifest restricts the extension to only running on github.com domains. What needs to happen is to add an options page that lets user's add in their own list of urls that the extension can be active for.

See github-notifier for an example: https://github.com/sindresorhus/github-notifier-chrome

(the options page has a url input, and options.js then requests permissions to run on that URL)

chancancode commented 9 years ago

Ah. I see! I wouldn't mind supporting that if someone can send a pull request ;)

— Sent from Mailbox

On Thu, Apr 16, 2015 at 2:26 PM, Jason Karns notifications@github.com wrote:

That's not the problem (I would only expect this to work with recent-ish versions of github enterprise that mirrored similar markup). The issue is that the manifest restricts the extension to only running on github.com domains. What needs to happen is to add an options page that lets user's add in their own list of urls that the extension can be active for. See github-notifier for an example: https://github.com/sindresorhus/github-notifier-chrome

(the options page has a url input, and options.js then requests permissions to run on that URL)

Reply to this email directly or view it on GitHub: https://github.com/chancancode/blame_parent/issues/3#issuecomment-93843379

jasonkarns commented 9 years ago

Yeah, it would be an awesome feature but isn't a trivial change :)

On Thu, Apr 16, 2015 at 5:34 PM, Godfrey Chan notifications@github.com wrote:

Ah. I see! I wouldn't mind supporting that if someone can send a pull request ;)

— Sent from Mailbox

On Thu, Apr 16, 2015 at 2:26 PM, Jason Karns notifications@github.com wrote:

That's not the problem (I would only expect this to work with recent-ish versions of github enterprise that mirrored similar markup). The issue is that the manifest restricts the extension to only running on github.com domains. What needs to happen is to add an options page that lets user's add in their own list of urls that the extension can be active for. See github-notifier for an example: https://github.com/sindresorhus/github-notifier-chrome (the options page has a url input, and options.js then requests

permissions to run on that URL)

Reply to this email directly or view it on GitHub:

https://github.com/chancancode/blame_parent/issues/3#issuecomment-93843379

— Reply to this email directly or view it on GitHub https://github.com/chancancode/blame_parent/issues/3#issuecomment-93844627 .

chancancode commented 9 years ago

I fixed the extension! So we have one less blocker for this. It's tricky though, because we are only injecting the script based on the URLs hardcoded in manifest.json.

I don't think you can have dynamic values there, so we will have to switch to injecting on all pages by default, but only run the function if it matches a check inside the JavaScript file (which would allow us to read the settings, etc).

jasonkarns commented 9 years ago

can't have dynamic values in the content_scripts: matches value, but you don't have to use the content_scripts in the manifest. Content scripts can be injected programatically. The extension would use the permissions API in the manifest, and the valid URLs still stored via options. Then the content scripts are injected programatically: https://developer.chrome.com/extensions/content_scripts#pi

jasonkarns commented 9 years ago

I keep intending to spend some time to spike this out. (I maintain a couple of github-related chrome extensions of my own that don't yet support Enterprise) But I haven't done it yet. I'll certainly use sindre's extension as a blueprint.