LukasLen / Privacy-Extension-For-WhatsApp-Web

Hides your WhatsApp messages until you hover over them.
https://pfwa.lukaslen.com
MIT License
131 stars 44 forks source link

Update to support WhatsApp Version 2.3000.xx #66

Closed aryomuzakki closed 7 months ago

aryomuzakki commented 7 months ago

Update the selectors to support WhatsApp Version 2.3000.1012572464

Tested in my local development environment: Browser : Brave v1.64.113 with Chromium v123.0.6312.86 OS: Windows 10 22H2 64Bit Build 19045.4170

This should close issue #56 #57 #60 #62 #64 and #65 And after rough checking, this should blur more compared to pull request #61 and #63

Changes :

I leave the former selectors on purpose for version compatibility.

Dear Owner, please review soon @LukasLen , Thank You

Allow me to mention people who might need this @Tgentil, @mclorand, @roniekas, @nikhilnk2206, @cruzy67, @Ahmed-Soli, @techsamy, @Usama171, @amithm7, @aritrakrbasu, @UsmanAhmadSaeed, @hndko, @Spacetaxfiling, @GodAnt12, @asim-hawklogix, @vvarl0cks, @satishgadhave, @MvrckTheBald, @ticmaidev, @LivreAcessoPro, @URODESUKA, @fabianodellano, @TejasMishr

Tgentil commented 7 months ago

I tested the update in this PR and found it to be solid. It successfully resolves the major issue of having to repeatedly clear the cache. It also seems to address all the issues highlighted in PR #61 effectively. Additionally, the code appears to be cleaner and better commented than in the previous PR, making it a robust solution for the extension’s functionality with WhatsApp's latest version.

LivreAcessoPro commented 7 months ago

image It not works for Firefox ESR.

TejasMishr commented 7 months ago

@aryomuzakki Please Check it For Firefox.

Tgentil commented 7 months ago

@TejasMishr and @LivreAcessoPro

I've tested PR #66 and can confirm it works perfectly on Firefox. For those interested, to use this updated version on Firefox, you'll need to download the repository from LukasLen/Privacy-Extension-For-WhatsApp-Web. Install GitHub CLI and run gh pr checkout 66 to fetch the PR.

Due to a known issue with service workers in Firefox and the Manifest V3 update, some modifications are necessary. You can read more about this issue in these links: background.service_worker is currently disabled, W3C WebExtensions, and Manifest v3 background scripts/service worker on Firefox.

In brief, remove the chrome manifest (manifest.json) and rename manifest_firefox.json to manifest.json. This workaround should make the extension work. If you're using Firefox version lower than 120, you might need to tweak the background script setting in the manifest changing it:

From:

  "background": {
    "scripts": ["background.js"],
    "service_worker": "background.js"
  },

To:

"background": {
    "scripts": ["background.js"]
},

Then you import the manifest in Firefox through about:debugging#/runtime/this-firefox.

temporary extension

Here's a screenshot showing the extension working in Firefox:

extension working fine

Hope this helps, and let's encourage @LukasLen to merge PR #66 soon for wider availability.

aryomuzakki commented 7 months ago

Sorry I haven't got the chance for testing in firefox. Thank you @Tgentil for testing and checking the code, also thanks for your helpful guide.

guisithos commented 7 months ago

@TejasMishr and @LivreAcessoPro

I've tested PR #66 and can confirm it works perfectly on Firefox. For those interested, to use this updated version on Firefox, you'll need to download the repository from LukasLen/Privacy-Extension-For-WhatsApp-Web. Install GitHub CLI and run gh pr checkout 66 to fetch the PR.

Firefox 124.0.2, working flawless doing as described by @Tgentil

LukasLen commented 7 months ago

I just tested this PR and moving forward with this change for version 3.2.0. Thanks for contributing! This essentially resolves #56, #57, #60, #62, #64, #65. I am also closing #61 and #63.

LivreAcessoPro commented 7 months ago

Houve um erro ao instalar a extensão temporária. Detalhes do erro

Add-on contact@lukaslen.com is not compatible with application version. add-on minVersion: 121.0.

Minversion changed to "115".

Still not working on Firefox ESR 115.9.1esr (64-bits)

Tgentil commented 7 months ago

Houve um erro ao instalar a extensão temporária. Detalhes do erro

Add-on contact@lukaslen.com is not compatible with application version. add-on minVersion: 121.0.

Minversion changed to "115".

Still not working on Firefox ESR 115.9.1esr (64-bits)

@LivreAcessoPro, please download the update version 3.2.0 on the Firefox Add-ons Store: Updated Version. it should fix your problem.

mclorand commented 7 months ago

I just tested this PR and moving forward with this change for version 3.2.0. Thanks for contributing! This essentially resolves #56, #57, #60, #62, #64, #65. I am also closing #61 and #63.

Plugin works now, thanks

ticmaisdev commented 7 months ago

@LivreAcessoPro have you tried clicking on the extension icon? firefox won't enable the extension, unless you'll click on the icon

Tgentil commented 7 months ago

@LivreAcessoPro, it seems like the issue might be due to your Firefox ESR version (115.9.1esr) not supporting service workers of the new Manifest V3, which is needed for the extension to function properly. Firefox added support for Manifest V3 service workers starting from version 120. Upgrading to a newer version of Firefox might resolve the compatibility issue. You can read more about these limitations and their solutions in the Firefox documentation and community discussions.

LivreAcessoPro commented 7 months ago

@

@LivreAcessoPro, it seems like the issue might be due to your Firefox ESR version (115.9.1esr) not supporting service workers of the new Manifest V3, which is needed for the extension to function properly. Firefox added support for Manifest V3 service workers starting from version 120. Upgrading to a newer version of Firefox might resolve the compatibility issue. You can read more about these limitations and their solutions in the Firefox documentation and community discussions.

A managed to make it work, partially, Firefox ESR version (115.9.1esr). I removed the worker part, and downgraded the version number. The blur taken action on the message panel, but not on the left panel.

aryomuzakki commented 7 months ago

@LivreAcessoPro , yeah, I remove service_worker option, then change or remove strict_min_version option too. I also use this step, sorry I forgot if this required or not.

  1. Enter about:config in your address bar, and continue to the list of preferences.
  2. Find the xpinstall.signatures.required preference and set it to false.

source https://support.mozilla.org/en-US/kb/install-system-add-ons-firefox-enterprise

This make extension work in my local, Firefox ESR v115.9.1esr WA v2.3000.1012868116 Windows 10 22H2 64Bit Build 19045.4170

image

All the blurs are working

image

can you provide a screenshot for which part are not bluring?

LivreAcessoPro commented 7 months ago

Done: Captura de tela de 2024-04-19 17-10-02

LivreAcessoPro commented 7 months ago
{
  "manifest_version": 3,
  "default_locale": "en",
  "name": "__MSG_extensionName__",
  "description": "__MSG_extensionDescription__",
  "version": "3.2.0",
  "action": {
    "default_title": "__MSG_extensionName__",
    "default_popup": "popup/popup.html",
    "default_icon": {
      "16": "images/icon16.png",
      "24": "images/icon24.png",
      "32": "images/icon32.png"
    }
  },
  "icons": {
    "16": "images/icon16.png",
    "32": "images/icon32.png",
    "48": "images/icon48.png",
    "128": "images/icon128.png"
  },
  "permissions": [
    "storage"
  ],
  "host_permissions": [
    "https://web.whatsapp.com/*"
  ],
  "background": {
    "scripts": [
      "background.js"
    ]
  },
  "browser_specific_settings": {
    "gecko": {
      "id": "contact@lukaslen.com",
      "strict_min_version": "115.0"
    }
  },
  "content_scripts": [
    {
      "matches": [
        "https://web.whatsapp.com/*"
      ],
      "js": [
        "scripts/contentScript.js"
      ]
    }
  ],
  "web_accessible_resources": [
    {
      "resources": [
        "images/statusOn.png",
        "images/statusOff.png",
        "css/messages.css",
        "css/messagesPreview.css",
        "css/mediaPreview.css",
        "css/mediaGallery.css",
        "css/textInput.css",
        "css/profilePic.css",
        "css/name.css",
        "css/noDelay.css",
        "css/unblurActive.css"
      ],
      "matches": [
        "https://web.whatsapp.com/*"
      ]
    }
  ],
  "commands": {
    "toggle": {
      "suggested_key": {
        "default": "Alt+X"
      },
      "description": "Toggle On/Off"
    }
  }
}
LivreAcessoPro commented 7 months ago

Done: Captura de tela de 2024-04-19 17-10-02

After reloading Firefox ESR, it's working. Thanks, @aryomuzakki

LivreAcessoPro commented 2 months ago

Hello. After the update 2.3000.1016136353 the blurring of the lateral panel stop working again. I have done the removal of the service_worker line after reinstalling the XPI, but it stills not working.

aryomuzakki commented 2 months ago

@LivreAcessoPro sorry i just have time to tested this today. Is it still not working? Because it is working when I just install Firefox ESR.

Can you make sure you've done this :

  1. Remove original manifest.json then rename manifest_firefox.json into manifest.json (or copy paste file).
  2. Remove service_worker option in new manifest.json file.
  3. Remove strict_min_version option in new manifest.json file.
  4. Go to about:config, find xpinstall.signatures.required preference and set it to false.
  5. Reinstall extension.
  6. Press CTRL + Shift + R in whatsapp web.
  7. Deactivate then re-activate extension.

if it doesn't work, maybe you need to reinstall ESR first, then follow the steps above. In my pc, the extension works with debug mode and normal mode (adding zip file).

image

image

LivreAcessoPro commented 2 months ago

image Thanks! It's working when the manifest file is loaded. I only need to edit one line: service_worker Can I modify the XPI, edit the contents and load it?