Error while comunicating between CS and BGSW.

Hey all! I'm trying to build this extension that reads particular URLs in Discord (web) messages and replaces them with a custom UI that shows images, buttons, etc. This project is for an hackathon and we have a deadline by tomorrow morning, so I guess it's pretty urgent.

The UI part works fine, the problem is that I cannot perform
fetch
calls from the content script since it gets blocked by Discord CSP.

So I'm trying to send a message from the content script to the background service worker using
@plasmohq/messaging
, the problem is that I get a CSP error regarding the connection to
ws://localhost:1815
and the messages stay hanging.

Am I doing something wrong?

The strange thing is that if I remove the
world: "MAIN"
it works fine, but I need the content script to be in the main world in order to access the
window
object because there's some data I need to fetch from other extensions that usually inject it there.

The code is available at:
https://github.com/builders-garden/shortcut-extension
GitHub
Browser extension for rendering and executing EVM Actions in the browser. - builders-garden/shortcut-extension
GitHub - builders-garden/shortcut-extension: Browser extension for ...
Was this page helpful?