tjhrulz / WebNowPlaying

A NowPlaying like plugin for rainmeter built for getting music info from websites
GNU General Public License v2.0
203 stars 24 forks source link

Add background page (remove dev tools spam) #25

Closed Revadike closed 1 year ago

Revadike commented 5 years ago

Your chrome extension keeps sending numerous requests. While I normally wouldn't mind that if that's needed for its functionality, I do mind it taking up my dev tools. The console and networks tab of the dev tools keeps getting spammed with your requests.

I believe most extensions use their own background page for requests, so those requests don't show up on other webpages you visit. Perhaps, if possible, you can consider doing the same?

tjhrulz commented 5 years ago

IIRC I would then be sandboxed and not easily able to access and send events to the main webpage. However moving the websocket connecting to its own background page may be a good idea and would may stop making firefox mad about localhost not being secure (Which I find pretty ironic because if localhost is not secure stopping an HTTPS site for using it is the least of your worries)

That is a decent refactor but one that may be worth exploring. Consider this added to my list of long term goals.

keifufu commented 1 year ago

While this is possible, unless we want to open a new websocket in the service-worker for every new tab, it'd completely change how the plugin receives and sends the data. I'd like to add that in modern versions of firefox and chrome the websocket "spam" gets grouped into just one entry either way. It'd still be an improvement to perhaps only have one websocket per browser, instead of one per tab, and if it can fix firefox's insecure issue it might be worth looking into.

keifufu commented 1 year ago

While I'm still not sure if we should move the websockets to the service-worker. I do believe it's better to keep the current architecture of one websocket per tab. This would allow for the rainmeter plugin (and possibly other future adapters) to take input from both the browser extension and other sources like electron apps, as discussed in #49

keifufu commented 1 year ago

I actually can't reproduce the issue with insecure websockets anymore. I made a new profile to make sure I'm using the default settings, installed the current version of WebNowPlaying Redux from the mozilla addon store, and it just.. worked?