samuraiexx / roll_together

It's an extension for Google Chrome that synchronizes Crunchyroll Videos that are being played at multiple computers
MIT License
52 stars 12 forks source link

Manifest V3 adaptation? #23

Open praabjerg opened 2 years ago

praabjerg commented 2 years ago

Hey! I'm wondering if you're aware that Google is going to turn off all Manifest V2 extensions at the beginning of 2023? https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/

Because it doesn't look like you've worked on an adaptation to MV3 yet? Most significantly (in terms of Roll Together), in MV3 you can no longer have a persistent background page. Instead you have ephemeral service workers that can't persist any global constants/variables. This presents an issue in particular for the backend socket connection which is currently maintained there.

I forked Roll Together a while back (before you switched to typescript) to experiment with making a party watch extension (crosswatch) that would work across several services. I had to drop it half a year ago as I moved to a new home. Then I picked it up again a few weeks ago, and then it was announced today that Wakanim, Funimation and VRV would have their stuff moved to CR, which now maybe kind of makes the idea a bit obsolete :P

In any case, I had actually started restructuring it for MV3. So if you want an idea for how to do it, my approach was to make a pinned "status" page tab instead of a popup when you activate the extension. The status page tab then remains open while watching synced videos, and can run a script with persistent variables and constants (including socket connections). Then you can move most of what was previously the background script over there, while maybe showing some status information on the page. It shouldn't be too hard to adapt to MV3 this way, and it has the added benefit of being backwards-compatible with Manifest V2, which is useful if you intend to maintain a Firefox version as well. The Firefox implementation of MV3 will probably not be ready for a while yet.

Thank you for your work on Roll Together, and best regards!

samuraiexx commented 2 years ago

Thanks for sharing your adaptation idea for Manifest V3. I read about it before but I am waiting to see what kind of solutions will be used for that kind of extension.

One possibility that I think was to move the WebSocket connection to the page itself. And one solution that I saw people using was to have some kind of system to keep the background page always alive.

Again thanks for sharing and please let me know if you have any other ideas. When the time comes I'll need to choose one hahaha.