ember-service-worker icon indicating copy to clipboard operation
ember-service-worker copied to clipboard

allow overriding the service worker scope to values other than rootURL

Open meirish opened this issue 6 years ago • 11 comments

Hello! Thanks for this project. I'm opening this to add the ability to override the service worker scope to something other than rootURL. This is useful in two situations: you want to scope the service worker more tightly, or if you want to control network requests higher up than the rootURL.

My current use case is that I have an ember app at /ui/, but my api is at /v1/, so to interact with those requests, I need to have a rootURL of /ui/ and scope of / or /v1/, and then set the HTTP header Service-Worker-Allowed to the same value.

To accomplish this, in the PR I added a new config option - serviceWorkerScope - that will be used instead of rootURL if it's defined.

meirish avatar Aug 31 '19 18:08 meirish

@meirish I like this idea and is a feature I needed a while ago. Any chance you can add info on this to the documentation and a test?

Ravenstine avatar Nov 07 '19 05:11 Ravenstine

@Ravenstine 👋 - I added a blurb in the registration docs about the new setting. I tried to add a test, but noticed there's not any tests that are currently testing the rollup replacement that's happening already. It also seems that the rollup replacement isn't happening in the tests. Do you know what I need to do to get that to work (assuming we want this test)?

meirish avatar Nov 07 '19 22:11 meirish

@Ravenstine ok this is ready to go - it looks like travis isn't working, but all of the tests pass locally for me. wanted to thank @johncowen for pointing me in the right direction for getting rollup to work (it needed to be in a ember-service-worker folder). I felt a bit like we're just testing rollup at that point, but it did surface a bug where if you didn't provide serviceWorkerScope, then registration wouldn't happen properly so I'm fine leaving this in just to show the expected output if nothing else.

meirish avatar Nov 08 '19 18:11 meirish

Travis is resolved and the dependencies updated. Try pulling it in to see if it resolves the failed build here.

eshtadc avatar Dec 18 '19 20:12 eshtadc

@eshtadc thanks! I just rebased so hopefully tests will be 🙆‍♂

meirish avatar Dec 19 '19 16:12 meirish

I'm having this exact same issue, and I'd like to see the PR merged. What is the current status? Is anything withholding it from being merged? If so, is that anything I would be able to help with?

NetForce1 avatar Dec 21 '20 20:12 NetForce1

Bump on ☝️ - I have a project where this would also be useful. Is there any progress to be made on this? Happy to contribute if it's blocked by anything concrete.

NoahFisher avatar Apr 16 '21 01:04 NoahFisher

OK! I think I've addressed all of the feedback, thanks (and sorry) for hanging in there folks. Maybe we can squeak this in before the ... checks calendar ... two year mark?! Really, again, sorry! 😬

Let me know if there's other things to fix up.

Thanks!

meirish avatar Apr 16 '21 03:04 meirish

@Ravenstine @eshtadc bump on this as I think it's ready to go! thanks!

meirish avatar May 04 '21 13:05 meirish

Hi there! 👋 Friendly bump, any updates on this?

hashishaw avatar May 18 '23 21:05 hashishaw

Hi @hashishaw! Unfortunately, neither I nor Lisa are working at DockYard anymore, so we don't have the capability of merging this.

I recommend that someone maintain a separate fork of this add-on or any other add-ons from DockYard that are still useful. DockYard isn't focusing much attention on Ember projects anymore and I highly doubt their add-ons will see any support in the foreseeable future.

Ravenstine avatar May 18 '23 21:05 Ravenstine