Bypass Cloudflare with Firefox Cookies

Dedicated board for extension releases/support threads

Moderators: Lootyhoof, FranklinDM

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
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2801
Joined: 2012-08-19, 20:32

Re: Bypass Cloudflare with Firefox Cookies

Unread post by back2themoon » 2025-02-23, 23:18

Thanks again for this update, tellu-white.

Is your last screenshot (Options/Register/Unregister) supposed to appear when right-clicking? Nothing happens here with a right-click, except for a small white arrow (?) that changes its position randomly on the icon.

Also, I cannot locate an entry related to the HTTP Observer in prefs.js. At least nothing beginning with: "extensions.bypass_cloudflare".

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

Re: Bypass Cloudflare with Firefox Cookies

Unread post by dinosaur » 2025-02-24, 07:39

tellu-white wrote:
2025-02-23, 22:45
I made version 5.0 of this add-on in which I removed the checking of the browser name and the "sqlite" file's name. However, if the database with cookies is not compatible with the following query:
.../...
In this version I've also added the option to disable "HTTP Observer" for those who want to use the "uBlock Origin" add-on instead. Enabling and disabling "HTTP Observer" is done by right-clicking on the add-on button. The default setting is with "HTTP Observer" enabled, since not all users have "uBlock Origin" installed. The "HTTP Observer" setting is saved in "prefs.js" so it doesn't change when restarting Pale Moon.
Perfect !

Thank you ! :thumbup:

EDIT: however back2themoon is right and the HTTP observer toggle does not seem to work and it does not register a "httpObserver_registered" setting in prefs.js, as it should...

User avatar
tellu-white
Fanatic
Fanatic
Posts: 182
Joined: 2022-03-08, 22:02

Re: Bypass Cloudflare with Firefox Cookies

Unread post by tellu-white » 2025-02-24, 15:27

@back2themoon, @dinosaur

I made an update in which I removed some code from the function that creates "menupopup" and fixed a bug in the same function. However, I haven't had any problems with version 5.0 of the add-on so I don't know if these changes will fix the problem for you. If the problem persists, please let me know what operating system you are using. I've checked version 5.0 in Linux Mint as well and had no problems there either.

I also checked the "prefs.js" file and found no problems there as well.

Screenshots in Windows:
01.png
02.png
03.png
04.png
05.png
06.png
07.png
08.png
09.png
*****

Download link ( Bypass Cloudflare with Firefox Cookies 5.1 ):

https://www.mediafire.com/file/8s8pk0mt4kwb08i/bypass_cloudflare_with_firefox_cookies_5_1.zip/file
You do not have the required permissions to view the files attached to this post.

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2801
Joined: 2012-08-19, 20:32

Re: Bypass Cloudflare with Firefox Cookies

Unread post by back2themoon » 2025-02-24, 15:39

Nothing changed for me with v.5.1 (Windows 10), however: I installed it in a clean Pale Moon portable profile and it worked as expected. Perhaps there's a conflict with something else, nearby icons or maybe even your other extension if installed? (I have it installed)

Also: in the clean PM portable profile, I went in about:config to find the related observer entry. It was present but when I right-click/reset it, the problem appeared in that profile, too. No other extension installed - totally clean.

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2801
Joined: 2012-08-19, 20:32

Re: Bypass Cloudflare with Firefox Cookies

Unread post by back2themoon » 2025-02-24, 16:27

Manually adding the boolean in about:config seems to fix the problem:

Code: Select all

extensions.bypass_cloudflare_with_firefox_cookies.httpObserver_registered
Looks like this entry is not handled entirely correctly and can disappear if reset, or not appear at all during extension installation/update.

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

Re: Bypass Cloudflare with Firefox Cookies

Unread post by dinosaur » 2025-02-24, 17:07

tellu-white wrote:
2025-02-24, 15:27
I made an update in which I removed some code from the function that creates "menupopup" and fixed a bug in the same function. However, I haven't had any problems with version 5.0 of the add-on so I don't know if these changes will fix the problem for you. If the problem persists, please let me know what operating system you are using. I've checked version 5.0 in Linux Mint as well and had no problems there either.
The problem is that you do not check in your code for the existence of the setting before reading it, meaning a non-boolean is returned when the setting is not already present in prefs.js.

Here is the patch to fix that bug:
bcfwfc-v5.1-httpObserver_registered.patch
You do not have the required permissions to view the files attached to this post.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37352
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Bypass Cloudflare with Firefox Cookies

Unread post by Moonchild » 2025-02-24, 17:52

Or, the recommended alternative is to declare the pref defaults in your extension instead of doing the "get-check-write" dance.

You may create these default preferences in a file within your defaults\preferences directory (in the extension, so create this where your install.rdf resides). All .js files within this directory will be loaded by the Preference System when necessary, so the name of your file doesn't matter.
You do not have the required permissions to view the files attached to this post.
"The world will not be destroyed by those who do evil, but by those who watch them without doing anything." - Albert Einstein
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
tellu-white
Fanatic
Fanatic
Posts: 182
Joined: 2022-03-08, 22:02

Re: Bypass Cloudflare with Firefox Cookies

Unread post by tellu-white » 2025-02-24, 18:43

@Moonchild, @back2themoon, @dinosaur

This was a bug that I found pretty hard. I did not update the add-on but uninstalled the old version, then installed the new version. So, the variable "firstRunDone" in "prefs.js" file had the value "false" and this caused the add-on to save the variable "httpObserver_registered" in "prefs.js" file. You have updated the add-on and so the variable "firstRunDone" had the value "true" and the add-on didn't save the variable "httpObserver_registered", considering that it was already saved (although this variable didn't exist in the previous version of the add-on). That's why it worked for me and it didn't work for you. I have fixed this bug and I am waiting for your feedback.

*****

Download link ( Bypass Cloudflare with Firefox Cookies 5.2 ):

https://www.mediafire.com/file/ideqbxi0nij503y/bypass_cloudflare_with_firefox_cookies_5_2.zip/file

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2801
Joined: 2012-08-19, 20:32

Re: Bypass Cloudflare with Firefox Cookies

Unread post by back2themoon » 2025-02-24, 18:55

It works better now. No issues with extension update.

You can still break it by resetting the pref (it disappears), but it comes back after a browser restart.

I believe resetting an extension pref should reset it to its default state, not make it go away.

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

Re: Bypass Cloudflare with Firefox Cookies

Unread post by dinosaur » 2025-02-24, 19:17

back2themoon wrote:
2025-02-24, 18:55
It works better now. No issues with extension update.

You can still break it by resetting the pref (it disappears), but it comes back after a browser restart.

I believe resetting an extension pref should reset it to its default state, not make it go away.
+1

User avatar
tellu-white
Fanatic
Fanatic
Posts: 182
Joined: 2022-03-08, 22:02

Re: Bypass Cloudflare with Firefox Cookies

Unread post by tellu-white » 2025-02-24, 19:19

Moonchild wrote:
2025-02-24, 17:52
Or, the recommended alternative is to declare the pref defaults in your extension instead of doing the "get-check-write" dance.

You may create these default preferences in a file within your defaults\preferences directory (in the extension, so create this where your install.rdf resides). All .js files within this directory will be loaded by the Preference System when necessary, so the name of your file doesn't matter.
Thanks for the explanation on the "recommended alternative". It obviously simplifies preference management.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5517
Joined: 2015-12-09, 15:45

Re: Bypass Cloudflare with Firefox Cookies

Unread post by moonbat » 2025-02-25, 02:39

tellu-white wrote:
2025-02-24, 19:19
It obviously simplifies preference management.
Suggest you read the XUL Tutorial and XUL School Tutorial for relevant sections on preference management.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2801
Joined: 2012-08-19, 20:32

Re: Bypass Cloudflare with Firefox Cookies

Unread post by back2themoon » 2025-02-26, 10:34

Updated, text-only setup guide (for v.5.2 currently)

1. Install the "Bypass Cloudflare with Firefox Cookies" extension to Pale Moon.
2. Customize/Toolbar and put its icon where you can click it.
3. Ctrl+Shift+click on the icon, point it to firefox.exe (or FirefoxPortable.exe if using that) in your Firefox installation folder.
4. Alt+Shift+click on the icon, point it to cookies.sqlite in your Firefox profile folder.
5. Go to Firefox (updated, current version preferably), create a new bookmark, name it "Get user agent string" (or whatever you want). URL:
javascript:void(prompt('navigator.userAgent',navigator.userAgent))
6. Click on this Bookmark (aka Bookmarklet) and copy the user agent string it'll give you.
7. Back to Pale Moon: Ctrl+Alt+Shift+click on the icon. Paste the above string.
8. (optional) The extension blocks connections to Cloudflare by default. If you are already doing that via other means (uBO, ηMatrix, hosts file etc.) right-click on the icon and select "Unregister HTTP Observer". Blocking challenges.cloudflare.com is recommended to avoid Pale Moon crashes.

The above steps form the initial, one-time setup. Now let's deal with a problem website.

1. Don't open it on Pale Moon. Copy its URL, Alt+click on the extension's icon, paste the URL and click OK.
2. The website opens in Firefox. Pass the malicious Cloudflare checks and log in to the website, if required.
3. Back to Pale Moon: Shift+Click on the icon. Click OK.

You should now be able to access that website on Pale Moon. Repeat steps 1-3 above for each new problem website.
Last edited by back2themoon on 2025-02-26, 12:18, edited 2 times in total.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37352
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Bypass Cloudflare with Firefox Cookies

Unread post by Moonchild » 2025-02-26, 11:09

Suggestion: instead of doing the Ctrl/Shift/Alt dance (that nobody remembers without notes...), why not add a drop-down to the toolbar icon to select the various options?
To see how to do this, see e.g. the locale switcher extension. You might also adopt the standard placement of the toolbar button on the toolbar upon installation from that extension, to avoid another setup step ;)
"The world will not be destroyed by those who do evil, but by those who watch them without doing anything." - Albert Einstein
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5517
Joined: 2015-12-09, 15:45

Re: Bypass Cloudflare with Firefox Cookies

Unread post by moonbat » 2025-02-26, 11:13

When building any piece of software, even if it's just an extension you hacked together, try to make maintainable code so your software doesn't fade away the moment you stop supporting it for whatever reason - to that extent I would recommend going through the extension creation basics that I linked to. The whole of Mozilla's XUL documentation is mirrored on that site, maintained by user RealityRipple.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37352
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Bypass Cloudflare with Firefox Cookies

Unread post by Moonchild » 2025-02-26, 12:49

moonbat wrote:
2025-02-26, 11:13
When building any piece of software, even if it's just an extension you hacked together, try to make maintainable code so your software doesn't fade away the moment you stop supporting it for whatever reason - to that extent I would recommend going through the extension creation basics that I linked to. The whole of Mozilla's XUL documentation is mirrored on that site, maintained by user RealityRipple.
I agree with this; I also understand that this extension was born from a sense of urgency. I don't think Tellu-White expected this to be more than a quick band-aid for what duration was required to deal with CloudFlare. Its future use and maintainability might not be important at all.
"The world will not be destroyed by those who do evil, but by those who watch them without doing anything." - Albert Einstein
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
tellu-white
Fanatic
Fanatic
Posts: 182
Joined: 2022-03-08, 22:02

Re: Bypass Cloudflare with Firefox Cookies

Unread post by tellu-white » 2025-02-26, 15:11

Moonchild wrote:
2025-02-26, 12:49
I also understand that this extension was born from a sense of urgency. I don't think Tellu-White expected this to be more than a quick band-aid for what duration was required to deal with CloudFlare.
I made this add-on to help Pale Moon users who frequently visit websites that use Cloudflare. As I said (before making this add-on):

"I didn't make an add-on, I only did tests because none of the websites I visit every day use Cloudflare, so (for now) I don't need such an add-on."
01.png
https://forum.palemoon.org/viewtopic.php?f=3&t=32045&start=140#p259464

Since I've made this add-on I've never used it because I needed it but only used it to test it (with links posted by other users). It seems that some users - like moonbat - don't appreciate altruistic gestures. Since I've been posting on this forum, I've had nothing but criticism from him (although I've made several add-ons in order to help other users). This statement is a fact (an observation) and not a criticism. Everyone is free to choose how to relate to other users of this forum, within common sense.

I will not respond to any replies to this post (on this topic). Everyone is free to choose how to read my remarks.
You do not have the required permissions to view the files attached to this post.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5517
Joined: 2015-12-09, 15:45

Re: Bypass Cloudflare with Firefox Cookies

Unread post by moonbat » 2025-02-26, 23:38

tellu-white wrote:
2025-02-26, 15:11
It seems that some users - like moonbat - don't appreciate altruistic gestures.
No, you're just too thin skinned to appreciate any kind of constructive criticism or suggestions for improvement. Everyone here in this forum is altruistically helping each other out whether by writing extensions or in troubleshooting. You could explore this as a learning path to making newer and better extensions; I myself got started by forking PureURL for Firefox - but it's up to you.
tellu-white wrote:
2025-02-26, 15:11
Everyone is free to choose how to read my remarks.
Just as how you've chosen to read mine :coffee:
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
PapaiMark
Hobby Astronomer
Hobby Astronomer
Posts: 20
Joined: 2024-12-04, 01:13

Re: Bypass Cloudflare with Firefox Cookies

Unread post by PapaiMark » 2025-02-27, 08:50

I was a moderator of a forum for a few years, dealing with all kinds of irritating and irritated people.
One day, I answered the question I had asked myself many times: 'Why am I doing this?' The answer was simply, 'Enough!'
However, I never offended any member, either in response or proactively.
I also worked for 10 years in the Civil Police Traffic Department, handling fines, seized vehicles, debts, and furious applicants.
I will not be bad-mannered towards someone who is rude to me because that is not who I am, and it would certainly be unproductive.

Please don't take these comments as an offense. Instead, consider them as their own point of view, at that moment, for a reasonable reason.

I enjoy working with NSIS scripts, so I understand you're having fun developing this extension. IMO, I agree with this:
Moonchild wrote:
2025-02-26, 12:49
... was born from a sense of urgency. I don't think Tellu-White expected this to be more than a quick band-aid for what duration was required to deal with CloudFlare.
and
Moonchild wrote:
2025-02-26, 11:09
Suggestion: instead of doing the Ctrl/Shift/Alt dance (that nobody remembers without notes...), why not add a drop-down to the toolbar icon to select the various options?
I imagine you will be proud of the result. I would be, if I could code it.
Please keep going.
Band-aid or not, we are enjoying it.


(Mods, if this is too off-topic, no problem deleting it)

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2801
Joined: 2012-08-19, 20:32

Re: Bypass Cloudflare with Firefox Cookies

Unread post by back2themoon » 2025-02-27, 20:13

Perhaps you could consider adding a way to show which websites have been "added", and the ability to selectively remove them?

I tried removing one website but entries are deeply stored in prefs.js, especially the info about cookies. Having an option to quickly remove stored info (cookies/user agent etc.) would be helpful. It can be done manually of course with some care, so no worries really.