From 73661fb549fb6d18958c1d336540bca7d0fa2062 Mon Sep 17 00:00:00 2001 From: kabir-afk Date: Fri, 19 Jul 2024 15:49:10 +0530 Subject: [PATCH 1/3] update : development structure --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d297b9d..767b885 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,10 @@ See also [Mozilla's web-ext](https://github.com/mozilla/web-ext) ## Development ``` -├── manifest.json (v.2) — defines extensions and dependencies rights. +├── _locales/ (inactive) +├── manifest.json (v.3) — defines extensions and dependencies rights. ├── background-script.js — main script. +├── sw.js — main script for Chromium browsers. ├── SignItCoreContent.js — creates duo panels "Video | Definition" ├── SignItVideosGallery.js — given urls, creates gallery of videos. ├── content_scripts/ From 8aa66e15e5f27aa3b05839a9e45bf3e99f928475 Mon Sep 17 00:00:00 2001 From: kabir-afk Date: Fri, 19 Jul 2024 15:51:22 +0530 Subject: [PATCH 2/3] remove : not needed since DNR API is not in use --- rules.json | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 rules.json diff --git a/rules.json b/rules.json deleted file mode 100644 index 855c669..0000000 --- a/rules.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "id": 1, - "priority": 1, - "action": { - "type": "modifyHeaders", - "responseHeaders": [ - { - "header": "Content-Security-Policy", - "operation": "set", - "value": "media-src https://commons.wikimedia.org https://upload.wikimedia.org" - } - ] - }, - "condition": { - "urlFilter": "|https*", - "resourceTypes": [ - "main_frame" - ] - } - } -] \ No newline at end of file From fd9d84a74da9c4670a9a7229c2edae1f7efc5fc3 Mon Sep 17 00:00:00 2001 From: kabir-afk Date: Fri, 19 Jul 2024 16:50:23 +0530 Subject: [PATCH 3/3] docs : MV2 -> MV3 brief --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 767b885..b33e2ac 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,18 @@ See also [Mozilla's web-ext](https://github.com/mozilla/web-ext) └── SearchWidget.js — handle the search queries ``` +### MV2 -> MV3 Brief + +Chrome web store had started deprecating the web extensions with manifest version 2 and since we were moving to chrome for bigger market share , we had to migrate our extension as per MV3 in order to publish it. Below are a few points on the achievements , challenges faced and hurdles that still persist :- + +* In `popup.js` messages have been passed for various functions that are present in `sw.js` or `background-script.js` , well i.e., because popup and other content scripts no longer have context of background page which happened to be the case in MV2. +* i18n : Even for `banana.i18n` , message passing is used. Reason being , earlier we could fetch banana when we fetched the context of background page using `browser.rutime.getBackgroundPage()`,but since we can no longer do that , message passing seemed the only right option. Setback of using this approach is that things become asynchronous , and you have to `await` until the message is fulfilled. It did become problematic when working inside constructor functions. Still has a lot of room for improvement and it is something that should be worked upon in future. + + While there were other options like making your own i18n function , based on the arguments received from `sw.js` , but that was a repetitive task when using i18n inside multiple files. + + Other option was to use `browser.i18n` native API. This was an ok option but didn't allow users to change to their desired language , only changed them when browser's language was different. For someone who didn't want the extension to run in his native language or wanted to run it in different language had no control. +* iframe instead of video tag : While this fix was made so that extension could work on sites with stricter CSPs like github or X, this broke the `twospeed` feature. The `twospeed` feature , when enabled allowed the users to see sign language video first in normal speed then in slow mo. It's code worked with event listeners of video tag , but since we replaced it with iframe , this feature no longer works. While you might think that accessing content document inside iframe is no biggie , it doesn't work as the video embedded and the parent inside which the iframe is embedded in belong to different origins. Again this is something that can and should be improvised by future devs reading this. + ## Contribute ### Contributors We look for volunteers: