The-CodingSloth / haha-funny-leetcode-extension

MIT License
396 stars 75 forks source link

someone to go full genius and get this to support firefox #42

Closed The-CodingSloth closed 10 months ago

The-CodingSloth commented 10 months ago

Yeah I need someone to help get this extension to function correctly on firefox. I've been trying but I think i'm too dumb. What I've seen so far:

  1. Redirecting is not working (declartiveNetRequest issue) even though the rule is being applied.
  2. The listeners don't seem to be working either (runtime.onMessage and webRequest.onCompleted) If anyone can fix this I'd appreciate it so much lol I'd like to keep using this framework, since it feels really convenient. But if you can get this working by reverting back to no framework, we can work with it at least.

To get this working on firefox do these steps: Add modify the manifest part of package.json to this:

"manifest": {
    "browser_specific_settings": {
      "gecko": {
        "id": "{743ff2c1-74c2-4384-a218-2c33d6a765a5}"
      }
    },
    "permissions": [
      "declarativeNetRequest",
      "declarativeNetRequestFeedback",
      "storage",
      "tabs",
      "activeTab",
      "alarms",
      "webRequest",
      "declarativeNetRequestWithHostAccess"
    ],
    "web_accessible_resources": [
      {
        "resources": [
          "leetcode-problems/*"
        ],
        "matches": [
          "https://www.plasmo.com/*"
        ]
      }
    ],
    "host_permissions": [
      "https://*/*"
    ]
  }

In your firefox browser type in for the url: about:debugging Click the "This Firefox" button You'll see the temporary extension area. Now in the code in your terminal run "pnpm run dev --target=firefox-mv3" You'll see a build folder with a folder called "firefox-mv3-dev" In your Firefox browser click "Load Temporary Add-on" and select any file from the firefox-mv3-dev The extension should be applied.

BiaDd commented 10 months ago

Wish I could help, but i can't get the firefox build to work lol, have you tried putting "webRequestBlocking" in instead of "declarativeNetRequestWithHostAccess"?

Basically just referencing what chat gpt spews out

The-CodingSloth commented 10 months ago

whoops I forgot to close this issue, I actually figured out the problem. The extension worked the whole time, but apparently whenever you develop in Firefox you don't get extension permissions automatically like chrome. You have to manually enable them, and the extension needs these permissions to work