NeverDecaf / discord-PWA

A wrapper for the Discord web client as a PWA, made for Chromium browsers on desktop.
MIT License
145 stars 13 forks source link

Supporting manifest v3 impossible? #23

Closed NeverDecaf closed 3 years ago

NeverDecaf commented 3 years ago

The extension needs to hook into the discord client in order to enable notifications, it does this by running some inline javascript (found in postMessage.js). In manifest v3 this is seemingly impossible. To be more precise, it is still possible to inject and run some javascript on a page via chrome.scripting.executeScript or similar, but this injected js will not have access to the environment used by discord. Unless there is a workaround this extension and PWA will probably never work with manifest v3. This is an issue I am sure other extensions like Tampermonkey must also face, so if Google allows some workaround for them it can also be used to make this PWA work on v3.

NeverDecaf commented 3 years ago

The solution I found was to inject static scripts that listen for messages. Those messages then contain dynamically generated scripts which the static script executes. This workaround seems like something that shouldn't be allowed but hey, if it works it works.