Intercept & Modify HTTP Response

Dedicated board for extension releases/support threads

Moderators: FranklinDM, Lootyhoof

Forum rules
Please do not create new topics here unless you are an extension author in need of a dedicated releases&support thread!
User avatar
tellu-white
Lunatic
Lunatic
Posts: 270
Joined: 2022-03-08, 22:02

Intercept & Modify HTTP Response

Post by tellu-white » 2025-11-06, 09:36

****************************************************************************

HELP Page for this add-on:

https://forum.palemoon.org/viewtopic.php?f=70&t=31829


****************************************************************************

I've made a new version (4.5) of this add-on where I fixed a bug in the function ("parseReg") that returns a RegEx "object" if the function argument (a "string") has valid RegEx syntax. In the old version, this function produced an error in a particular case: when the string (the function argument) started with a forward slash and there was a backslash before the last forward slash in the string (see also the code posted below - with comments).

The new function, with comments attached:

Code: Select all


function parseReg(src){
	try{
		// Old "match":
		// var match = src.match(/^\/(.+)\/([igm]{0,3})$/);		// Without "Negative LookBehind" in RegEx, an ERROR occurs (err.message = \ at end of pattern) for src=/xxxxx\/g (for example)
		
		// New "match":
		var match = src.match(/^\/(.+)(?<!\\)\/([igm]{0,3})$/);		// With "Negative LookBehind" in RegEx, this Function Returns a String if Before the LAST / there is \  -->  src=/xxxxx\/g returns a String, NOT a RegEx (for example)
		
		if(match) {
			return new RegExp(match[1],match[2]);
			
		} else{
			return src;
		}
		
	} catch(err){
		// alert(err.message);
		
		return src;		// Just in case, so that the Add-On does not get stuck  -->  An unforeseen error in the RegEx (string) syntax can be seen (examined) by opening "Filters Manager"
	}
}

Download link ( Intercept & Modify HTTP Response 4.5 ):

https://www.mediafire.com/file/61kuzhz9tikcm3p/intercept_&_modify_HTTP_response_4_5.zip/file

User avatar
frostknight
Keeps coming back
Keeps coming back
Posts: 766
Joined: 2022-08-10, 02:25

Re: Intercept & Modify HTTP Response

Post by frostknight » 2025-11-06, 18:59

Recommend not using mediafire and instead using upload.disroot.org

Mediafire gave me a hard time and refused to show the download to me no matter how many times I refreshed.

They are doing some chrome level crap right now.

Ultimately I had to use badwolf browser to download it. Really annoying...
Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Say NO to Fascism and Corporatism as much as possible!
Also, Peace Be With us All!

User avatar
tellu-white
Lunatic
Lunatic
Posts: 270
Joined: 2022-03-08, 22:02

Re: Intercept & Modify HTTP Response

Post by tellu-white » 2025-11-06, 23:14

frostknight wrote:
2025-11-06, 18:59
Recommend not using mediafire and instead using upload.disroot.org

Mediafire gave me a hard time and refused to show the download to me no matter how many times I refreshed.

They are doing some chrome level crap right now.

Ultimately I had to use badwolf browser to download it. Really annoying...
I checked the page https://upload.disroot.org/ and saw that they keep uploaded files for a maximum of 30 days.

https://www.mediafire.com/ also has a time limit, but it is very flexible and depends on the existing demand for the uploaded file. For example, my add-on "Intercept & Modify HTTP Response 4.3" is still available today, 10 months after I uploaded it (on January 7, 2025). I also test the availability of every file uploaded to "mediafire.com" and I've never had an experience like yours.

Screenshots:

"upload.disroot.org":
upload.disroot.png
"mediafire.com":
mediafire_01.png
mediafire_02.png
mediafire_03.png
You do not have the required permissions to view the files attached to this post.

User avatar
frostknight
Keeps coming back
Keeps coming back
Posts: 766
Joined: 2022-08-10, 02:25

Re: Intercept & Modify HTTP Response

Post by frostknight » 2025-11-08, 21:00

tellu-white wrote:
2025-11-06, 23:14
I checked the page https://upload.disroot.org/ and saw that they keep uploaded files for a maximum of 30 days.

https://www.mediafire.com/ also has a time limit, but it is very flexible and depends on the existing demand for the uploaded file. For example, my add-on "Intercept & Modify HTTP Response 4.3" is still available today, 10 months after I uploaded it (on January 7, 2025). I also test the availability of every file uploaded to "mediafire.com" and I've never had an experience like yours.
Fair point, I forgot about the 30 days thing.

Yeah, that is the first time I had that problem with mediafire. Very peculiar...

Still doing it... weird stuff
Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Say NO to Fascism and Corporatism as much as possible!
Also, Peace Be With us All!

dinosaur
Fanatic
Fanatic
Posts: 189
Joined: 2014-06-03, 09:26
Location: France

Re: Intercept & Modify HTTP Response

Post by dinosaur » 2025-11-18, 11:42

How can I migrate mhresponse v1.3.8 filters to your version without having to add the filters host-per-host in you new extension ???

User avatar
tellu-white
Lunatic
Lunatic
Posts: 270
Joined: 2022-03-08, 22:02

Re: Intercept & Modify HTTP Response

Post by tellu-white » 2025-11-18, 19:48

dinosaur wrote:
2025-11-18, 11:42
How can I migrate mhresponse v1.3.8 filters to your version without having to add the filters host-per-host in you new extension ???
HELP to Transfer ALL Existing Filters from Modify "HTTP Response 1.3.8 (JustOff)" add-on to "Intercept & Modify HTTP Response 4.5 (Tellu White)" add-on:

https://forum.palemoon.org/viewtopic.php?f=70&t=31829#p257566

Note: After you've copied the filters from "Modify "HTTP Response 1.3.8" (see step 1 from Screenshots in the help opened with the link above), it would be a good idea to save them in a text file as well, in case you want to use "HTTP Response 1.3.8 (JustOff)" again instead of "Intercept & Modify HTTP Response 4.5 (Tellu White)".

dinosaur
Fanatic
Fanatic
Posts: 189
Joined: 2014-06-03, 09:26
Location: France

Re: Intercept & Modify HTTP Response

Post by dinosaur » 2025-11-19, 14:14

tellu-white wrote:
2025-11-18, 19:48
HELP to Transfer ALL Existing Filters from Modify "HTTP Response 1.3.8 (JustOff)" add-on to "Intercept & Modify HTTP Response 4.5 (Tellu White)" add-on:
Thanks.

It worked, but I find the procedure a bit clunky (and quite unintuitive): why using the clipboard as an intermediary between the conversion and the enrollment of the filters ?

User avatar
tellu-white
Lunatic
Lunatic
Posts: 270
Joined: 2022-03-08, 22:02

Re: Intercept & Modify HTTP Response

Post by tellu-white » 2025-11-19, 15:33

dinosaur wrote:
2025-11-19, 14:14
It worked, but I find the procedure a bit clunky (and quite unintuitive): why using the clipboard as an intermediary between the conversion and the enrollment of the filters ?
This add-on has three options for adding filters:

1. Using the "Filters Manager," which can be opened with click on the add-on Button (not relevant in this particular case).

2. With right-click on the add-on Button + "Restore Filters From Backup (Replaces Existing Filters!)"

3. With right-click on the add-on Button + "Add Filters From Backup (To Current Filters)"

So, after the user makes the filters conversion, he/she has two options:

A. To replace all existing filters.

B. To add the new filters to the existing ones.

I could not know which option the user would choose, so I chose to save the converted filters to the Clipboard. I could have created an additional pop-up dialog box where the user could check the desired option. I chose the Clipboard option because it also allows you to save filters in a text file (backup).

Screenshot:
01.png
You do not have the required permissions to view the files attached to this post.