All Projects → airtower-luna → referer-mod

airtower-luna / referer-mod

Licence: GPL-3.0 license
Web Extension to modify the Referer header in HTTP requests

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
HTML
75241 projects
go
31211 projects - #10 most used programming language
CSS
56736 projects
Dockerfile
14818 projects
Makefile
30231 projects

Projects that are alternatives of or similar to referer-mod

fb-post-screenshot
Firefox Web Extension to save Facebook posts as images
Stars: ✭ 18 (-51.35%)
Mutual labels:  webextension, firefox-webextension
perfect-home
firefox newtab/home replacement
Stars: ✭ 101 (+172.97%)
Mutual labels:  webextension, firefox-webextension
SixIndicator
SixIndicator is a WebExtension Plugin which indicates via an icon, if you are viewing the website with IPv6 or IPv4.
Stars: ✭ 17 (-54.05%)
Mutual labels:  webextension, firefox-webextension
Session-resurrection
Save your browser sessions and restore them any time
Stars: ✭ 36 (-2.7%)
Mutual labels:  webextension, firefox-webextension
bookmarkdupes
A WebExtension which can display/remove duplicate bookmarks or empty folders
Stars: ✭ 80 (+116.22%)
Mutual labels:  firefox-webextension
time-capsule
A WebExtension to send links to your future self
Stars: ✭ 27 (-27.03%)
Mutual labels:  webextension
trello-super-powers
Repository of the Firefox add-on. (https://addons.mozilla.org/en-US/firefox/addon/trello-super-powers/)
Stars: ✭ 29 (-21.62%)
Mutual labels:  webextension
YTMySubs
Sets the Subscriptions page as your default homepage on YouTube by redirecting all requests at the browser level
Stars: ✭ 25 (-32.43%)
Mutual labels:  firefox-webextension
yt2p
Watch videos in an external player.
Stars: ✭ 22 (-40.54%)
Mutual labels:  webextension
HybridTvViewer
[WIP] Web extension making Firefox & Chrome emulate iTV webpages instead of downloading them.
Stars: ✭ 64 (+72.97%)
Mutual labels:  webextension
darkContrast
Firefox addon that fixes low contrast text when using dark desktop theme
Stars: ✭ 61 (+64.86%)
Mutual labels:  webextension
mercator
Mercator Studio is a script that applies basic camera effects for Google Meet. (no longer actively developed)
Stars: ✭ 56 (+51.35%)
Mutual labels:  webextension
recap-chrome
Recap Chrome and Firefox Extension
Stars: ✭ 41 (+10.81%)
Mutual labels:  webextension
wext-manifest-loader
Webextension Manifest Generator that you specify `manifest.json` properties to appear only in specific browsers and environment
Stars: ✭ 23 (-37.84%)
Mutual labels:  webextension
Turn-Off-the-Lights-Firefox-extension-WebExtensions
Firefox extension (WebExtensions)
Stars: ✭ 19 (-48.65%)
Mutual labels:  firefox-webextension
snoozz-tab-snoozing
A Web Extension to declutter windows by snoozing tabs for later
Stars: ✭ 105 (+183.78%)
Mutual labels:  webextension
tickety-tick
A browser extension that helps you name branches and write better commit messages
Stars: ✭ 55 (+48.65%)
Mutual labels:  webextension
savescreenshot
Save Screenshot Add-on for Firefox. Simple website screenshot maker for Firefox.
Stars: ✭ 16 (-56.76%)
Mutual labels:  webextension
notification-sounds
Makes a sound when a notification is shown
Stars: ✭ 16 (-56.76%)
Mutual labels:  webextension
FireX-Proxy
FireX Proxy for Mozilla Firefox, Google Chrome
Stars: ✭ 96 (+159.46%)
Mutual labels:  webextension

referer-mod

referer-mod logo: cat ears peeking over an edge

Referer Modifier is a Web Extension for Firefox to modify the Referer header in HTTP requests, and the Javascript document.referrer property to match. For each target domain, one of five actions can be configured:

  • Keep: Do not modify the Referer
  • Prune: Send only the origin part of the Referer (scheme, host, and port)
  • Target: Send the origin of the target URL (scheme, host, and port) as Referer
  • Remove: Send no Referer at all
  • Replace: Replace the Referer with a configured value

Rules can optionally be limited to apply only to requests from certain origin domains.

You can configure default actions for requests originating from the same domain, and any other request not matching a domain rule. The "replace" and "target" actions will create a Referer header if necessary, the others only modify or remove existing ones. The configuration can be exported as and imported from JSON files.

Installation

Users should install the add-on from the addons.mozilla.org page.

If you're working on the code you can load your work in progress as a temporary add-on using the Firefox about:debugging page.

Developer information

The following files implement the core functionality:

  • engine.js defines the functions used to determine if and how the referrer values should be modified. This code is shared by background and content scripts.

  • background.js does initialization and contains the handler function modifyReferer(e) to modify headers. The handler function is called from an asynchronous webRequest.onBeforeSendHeaders event listener. background.js also uses event listeners to update the internal configuration if it is changed via the settings page. A dynamic content script containing the configuration is added to sites, for use by content.js.

  • options.html is the settings page. The value attributes of the option elements inside the select elements with class="action" must match the cases handled in the modifyReferer(e) function.

  • options.js handles loading and saving the settings from the settings page.

  • popup.html is the popup menu that opens when you click the toolbar button.

  • popup.js handles setup of the popup menu and communication with the background script.

  • content.js is a content script that modifies the document.referrer property to match the HTTP Referer header.

  • i18n.js handles internationalization of the UI (see below).

Settings are saved in the browser.storage.sync storage area, so if the user is using Firefox sync their settings will be synchronized automatically, otherwise the storage is local.

There is limited localization data in the _locales/ directory. The Makefile serves to build a ZIP archive for upload to AMO.

The repository contains a configuration file for ESLint. ESLint runs in CI (see the "Referer Mod / lint" job), please pay attention to its results when working on a pull request.

Internationalization

All user interface elements are internationalized using the WebExtensions i18n API. Additional translations are welcome! All you need to do is create a subdirectory for the locale in _locales/, and put whatever messages you'd like to translate into a messages.json file there.

When editing any of the HTML files note that elements with the i18n-text class are internationalized. Their text content (and title, if any) is used to look up the actual messages and replaced. If the replacement text contains linebreaks, each line becomes a paragraph and text enclosed in backticks is turned into <code> elements.

Testing

The testserver/ directory of this repository contains a test environment based on Go and Docker that you can use locally. You can use it manually (see the README), or run test.py for automated tests. The automated tests require the Selenium Python client and Geckodriver.

Known issues

The document.referrer modification is a workaround for Firefox bug #1601496, and unfortunately not 100% reliable because there's no way to guarantee that the content script that does the modification always runs before page scripts.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].