Skip to content

Commit

Permalink
Merge pull request #1 from darrena092/feature/firefox-support
Browse files Browse the repository at this point in the history
Add firefox support.
  • Loading branch information
darrena092 committed Feb 18, 2024
2 parents c0d77a0 + 65c7a12 commit ae8b926
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/darrena092)

## Overview
HeaderTools is a versatile and user-friendly extension designed to provide users the capability to manipulate and inject request headers based on regex domain selectors.
HeaderTools is a versatile and user-friendly browser extension supporting Chrome, Brave and Firefox designed to provide users the capability to manipulate and inject request headers based on regex domain selectors.

This was largely created as a replacement for ModHeader due to the author's decision to include Adware in a recent update.

Expand All @@ -21,7 +21,7 @@ This was largely created as a replacement for ModHeader due to the author's deci
* User-friendly Interface: The interface is designed to be intuitive and user-friendly, simplifying the process of creating and managing your rules.

## How to Use
* Install the Extension: Add HeaderTools to your Chrome/Brave browser using the latest release from the releases page.
* Install the Extension: Add HeaderTools to your Chrome/Brave browser using the latest release from the releases page (Firefox release pending review).
* Open the Extension: Click on the HeaderTools icon in your browser's toolbar.
* Create a Rule:
* Click on the "New Rule" button to start creating a rule.
Expand Down
Binary file removed htlogo.png
Binary file not shown.
Binary file added htlogosq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "1.0",
"browser_action": {
"default_popup": "build/index.html",
"default_icon": "htlogo.png"
"default_icon": "htlogosq.png"
},
"permissions": [
"webRequest", "webRequestBlocking", "storage", "<all_urls>"
Expand Down
11 changes: 9 additions & 2 deletions service/background.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Preload rules, as the extension API doesn't support blocking operations.
// Preload rules, as the Chrome extension API doesn't support blocking operations.
let cachedRules = [];

function updateCachedRules() {
Expand All @@ -17,6 +17,13 @@ chrome.storage.onChanged.addListener((changes, namespace) => {
}
});

// Cross browser support
const extraInfoSpec = ["blocking", "requestHeaders"];
if (typeof browser === "undefined") {
// Detect Chrome and add extraHeaders.
extraInfoSpec.push("extraHeaders");
}

chrome.webRequest.onBeforeSendHeaders.addListener(
(details) => {
cachedRules.forEach(rule => {
Expand All @@ -35,5 +42,5 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
return { requestHeaders: details.requestHeaders };
},
{ urls: ["<all_urls>"] },
["blocking", "requestHeaders", "extraHeaders"]
extraInfoSpec
);

0 comments on commit ae8b926

Please sign in to comment.