nightTab icon indicating copy to clipboard operation
nightTab copied to clipboard

implement rudimentary service worker

Open sansmoraxz opened this issue 3 years ago • 7 comments

Service worker sw.js Injector code to register service worker when running natively (non extension) webv action to deploy on web (non extension mode)

sansmoraxz avatar Jan 21 '22 18:01 sansmoraxz

Refer #334

sansmoraxz avatar Jan 21 '22 18:01 sansmoraxz

Nice work. I tried this out locally. When I disabled network access and refresh the page nothing loads. Is this intended behaviour?

zombieFox avatar Jan 23 '22 09:01 zombieFox

Really cool to have more contributors to the project, however it be nice if you explained a bit more what and why you're doing certain things in your PR.

We've added comments to those sections where we're unsure what you're doing. (and I've also added a few suggestions regarding readability and code cleanliness)

(If this is a WIP and you were planning on fleshing this out more, might wanna consider making that clear in the body of the PR.)

metruzanca avatar Jan 23 '22 11:01 metruzanca

Here's a patch to maintain compatibility with firefox for the time being.

Basically, build with no service worker.

sansmoraxz avatar Jan 24 '22 12:01 sansmoraxz

Otherwise, it's OK to merge this. Didn't observer any other bugs in my system.

sansmoraxz avatar Jan 24 '22 12:01 sansmoraxz

Quick update. This is looking good - hope to merge it soon. The project is currently in testing gearing up for the next big release (Internationalisation support). Releasing multiple big features in a single update to Chrome and Firefox stores is difficult and will be avoided going forward.

zombieFox avatar Feb 27 '22 08:02 zombieFox

Then this may be put on hold for the time being. Unless we implement something like what was done here, it may make sense to wait for Firefox to officially support manifest v3.

sansmoraxz avatar Mar 17 '22 19:03 sansmoraxz

I was overthinking it. We don't nescessarily need to use manifest v3. Native injection with plain js just works.

For firefox extensions can't use sw, but for any other url it works.

sansmoraxz avatar Nov 21 '22 20:11 sansmoraxz

Anyway I scrapped all the old changes, and making fresh pr just for the service worker.

Cleaner this way.

Service workers should work for most chrome based browsers. Although I admit I didn't test extensively other than chrome and edge.

For firefox service worker wouldn't load when installed as extension though.

But yeah I think this is ready to be merged now.

sansmoraxz avatar Nov 21 '22 20:11 sansmoraxz

Closing this as it was related to code that's no longer used, and I will probably use this branch as active development.

Gonna send a fresh pr from a different branch.

sansmoraxz avatar Dec 06 '22 15:12 sansmoraxz