lingua-libre / SignIt

🌻 Lingua Libre SignIt web-browser extension translates selected word in French Sign Language via an elegant pop up so you learn sign language while reading online.
https://addons.mozilla.org/en-US/firefox/addon/lingua-libre-signit/
MIT License
11 stars 13 forks source link

Content Security Policy changed as per Manifest V3 and Service Worker file added #60

Closed kabir-afk closed 3 months ago

kabir-afk commented 3 months ago

This PR arose because of issue#55 . Apparently upon unpacking the extension file it showed

Failed to load extension
File 
~\Downloads\SignIt\SignIt-master
Error
'content_security_policy.extension_pages': Insecure CSP value "https://commons.wikimedia.org" in directive 'object-src'.
Could not load manifest.

The issue could have been resolved by simply removing object-src 'self' https://commons.wikimedia.org; from extension pages but I not only removed it but also updated it as per the syntax of manifest V3 which changed extension_pages to a dictionary and introduced the sandbox key. Now upon unpacking it won't show CSP related issues in chrome dev mode.

Regarding the service worker file , I have built it on top of old background-script.js using GPT so might not work as intended . . . feel free to make it work better

hugolpz commented 3 months ago

@kabir-afk can you clarify :

  1. you work with manifest v3.0, are you working on chrome or FF ?
  2. you confirm the main elements (popup ; modal) both work ?

I cloned your branch, attempted loading, FF rejects it and Chrome's SignIt popup stales. (but I got this issue with my own code all day)

kabir-afk commented 3 months ago

@kabir-afk can you clarify :

  1. you work with manifest v3.0, are you working on chrome or FF ?
  2. you confirm the main elements (popup ; modal) both work ?

I cloned your branch, attempted loading, FF rejects it and Chrome's SignIt popup stales. (but I got this issue with my own code all day)

  1. I am working on chrome with manifest 3.0
  2. I see the popup but it stales after a while like you mentioned , the background script runs for a while and then stops....modal ? no , couldn't get to that part
  3. It is indeed true , FF initially rejects it , in order to fix that I replaced background scripts in manifest with that of V2 , and I can get the popup to come...I think directly switching to an unreliable service_worker isn't gonna help so I say we stick to mainfest V2 background script for a while