Compare commits

..

2 Commits

Author SHA1 Message Date
renovate[bot]
b073daee19 Merge 2a998ccca9 into ba2308151b 2024-06-21 11:44:46 +00:00
renovate[bot]
2a998ccca9 Update dependency web-ext to v8.2.0 2024-06-21 11:44:43 +00:00
17 changed files with 2829 additions and 1180 deletions

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install jq
@@ -29,11 +29,11 @@ jobs:
with:
cmd: build
source: .
filename: "rfd-affiliate-stripper-${{steps.vars.outputs.version}}-${{steps.vars.outputs.sha_short}}.xpi"
filename: "rfd-redirect-stripper-${{steps.vars.outputs.version}}-${{steps.vars.outputs.sha_short}}.xpi"
ignoreFiles: '[ "package.json","package-lock.json","yarn.lock" ]'
- name: "Upload Artifact"
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v4
with:
name: "rfd-affiliate-stripper-${{steps.vars.outputs.version}}-${{steps.vars.outputs.sha_short}}.xpi"
name: "rfd-redirect-stripper-${{steps.vars.outputs.version}}-${{steps.vars.outputs.sha_short}}.xpi"
path: ${{ steps.web-ext-build.outputs.target }}

View File

@@ -12,10 +12,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
node-version: 16
cache: 'npm'
cache-dependency-path: package-lock.json
- run: npm ci

View File

@@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Install gomplate
run: |
@@ -25,4 +25,4 @@ jobs:
- name: Run gomplate
run: gomplate < script.js.tmpl > script.js
- uses: stefanzweifel/git-auto-commit-action@v7
- uses: stefanzweifel/git-auto-commit-action@v5

View File

@@ -1,27 +1,28 @@
# rfd-affiliate-stripper
# rfd-redirect-stripper
<a href="https://addons.mozilla.org/en-US/firefox/addon/rfd-redirect-stripper/"><img src="https://user-images.githubusercontent.com/585534/107280546-7b9b2a00-6a26-11eb-8f9f-f95932f4bfec.png" alt="Get rfd-affiliate-stripper for Firefox"></a>
<a href="https://chromewebstore.google.com/detail/rfd-affiliate-stripper/nhjomcijhonhoggkckbjjfnjdcefbblo?authuser=0&hl=en"><img src="https://user-images.githubusercontent.com/585534/107280622-91a8ea80-6a26-11eb-8d07-77c548b28665.png" alt="Get rfd-affiliate-stripper for Chrome"></a>
Strips affiliate redirects from deal links posted on RFD.
On every page load, it transforms a link with tracking such as
```
http://www.amazon.ca/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Fwww.amazon.ca%2Fdp%2FB09YXY3DKN%3Fref%3Dcm_sw_r_apan_dp_NX4HJ8HZ3XX2YK1J900A%26ref_%3Dcm_sw_r_apan_dp_NX4HJ8HZ3XX2YK1J900A%26social_share%3Dcm_sw_r_apan_dp_NX4HJ8HZ3XX2YK1J900A%26starsLeft%3D1%26skipTwisterOG%3D1&tag=redflagdealsc-20&linkCode=ur2&camp=15121&creative=330641
```
into
```
https://www.amazon.ca/dp/B09YXY3DKN
```
rfd-redirect-stripper strips affiliate redirects from deal links posted on https://forums.redflagdeals.com.
## Why?
This helps navigate around broken links when using certain adblockers.
## Building the extension
## Tampermonkey Script
This was originally a [Tampermonkey](https://www.tampermonkey.net/) userscript before evolving into a browser extension.
Copy [script.js](./script.js) into Tampermonkey.
## Browser Extensions
### Firefox
The extension is available [here](https://addons.mozilla.org/en-US/firefox/addon/rfd-redirect-stripper/).
Ensure that permissions are granted. If this is not done, the extension will not have permission to execute.
<img width="712" alt="image" src="https://user-images.githubusercontent.com/4519234/231030083-5ff5156a-deec-4e4d-8f35-ebba84a24be8.png">
### Building the extension
To build the extension, run:
@@ -40,14 +41,10 @@ An easy way to test regex: [regex101.com](https://regex101.com/).
New config can be tested by pointing the config url of the extension to your own branch.
![image](https://user-images.githubusercontent.com/4519234/230703252-a7e09cf6-d0e5-4f54-8973-3b93d4a4a5a2.png)
For example:
```text
https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/my-new-branch/redirects.json
https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/my-new-branch/redirects.json
```
## Tampermonkey Script
This was originally a [Tampermonkey](https://www.tampermonkey.net/) userscript before evolving into a browser extension.
To use as a tampermonkey script, copy [script.js](./script.js) into Tampermonkey.

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8" />
<title>rfd-affiliate-stripper</title>
<title>rfd-redirect-stripper</title>
<link rel="stylesheet" href="../css/popup.css" />
</head>
<body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -5,7 +5,7 @@ const saveButton = document.getElementById("save-button");
const resetButton = document.getElementById("reset-button");
const defaultConfig =
"https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/redirects.json";
"https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/redirects.json";
chrome.storage.local.get("config").then((result) => {
const value = result.config;

View File

@@ -20,6 +20,6 @@ export function updateRedirects() {
export function setDefaultConfig() {
chrome.storage.local.set({
config:
"https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/redirects.json",
"https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/redirects.json",
});
}

View File

@@ -1,16 +1,12 @@
{
"manifest_version": 3,
"name": "rfd-affiliate-stripper",
"name": "rfd-redirect-stripper",
"description": "Strip tracking redirects on rfd",
"version": "0.5.3",
"version": "0.4",
"content_scripts": [
{
"matches": [
"*://forums.redflagdeals.com/*"
],
"js": [
"js/content.js"
],
"matches": ["*://forums.redflagdeals.com/*"],
"js": ["js/content.js"],
"run_at": "document_end"
}
],
@@ -19,16 +15,12 @@
"default_popup": "html/popup.html"
},
"background": {
"scripts": [
"js/background.js"
],
"scripts": ["js/background.js"],
"service_worker": "js/background.js",
"type": "module"
},
"permissions": [
"storage",
"alarms"
],
"permissions": ["scripting", "storage", "alarms"],
"host_permissions": ["*://forums.redflagdeals.com/*"],
"browser_specific_settings": {
"gecko": {
"id": "davegallant@gmail.com",

3837
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"devDependencies": {
"web-ext": "^9.0.0"
"web-ext": "^8.0.0"
},
"scripts": {
"start:firefox": "web-ext run --source-dir .",

View File

@@ -5,11 +5,11 @@
},
{
"name": "Best Buy",
"pattern": "bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)"
"pattern": "bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)\\?.*"
},
{
"name": "HP",
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)"
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)&.*"
},
{
"name": "Samsung",

View File

@@ -1,8 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"schedule": [
"every weekend"
],
"extends": [
"config:recommended"
]

View File

@@ -1,13 +1,13 @@
// ==UserScript==
// @name RedFlagDeals Affiliate Stripper
// @name RedFlagDeals Redirect Stripper
// @author Dave Gallant
// @description Strip redirect links on forums.redflagdeals.com
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js
// @grant none
// @match *://forums.redflagdeals.com/*
// @namespace http://tampermonkey.net/
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @version 2025-12-13
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js
// @version 0.0.1
// ==/UserScript==
(function() {
@@ -22,11 +22,11 @@
},
{
"name": "Best Buy",
"pattern": "bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)"
"pattern": "bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)\\?.*"
},
{
"name": "HP",
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)"
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)&.*"
},
{
"name": "Samsung",

View File

@@ -1,13 +1,13 @@
// ==UserScript==
// @name RedFlagDeals Affiliate Stripper
// @name RedFlagDeals Redirect Stripper
// @author Dave Gallant
// @description Strip redirect links on forums.redflagdeals.com
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js
// @grant none
// @match *://forums.redflagdeals.com/*
// @namespace http://tampermonkey.net/
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @version {{ (time.Now).Format "2006-01-02" }}
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js
// @version 0.0.1
// ==/UserScript==
(function() {