Introducing a Falkon extension Cookies.txt

This weekend I decided to test if it is possible to create a Cookies.txt style extensions for Falkon by using QML API.

This work is partially based on Firefox and Chrome extensions.

The GUI is shamelessly copied from the Firefox extension but I had a little trouble porting it to QML since I have still long way to go with this language. I like the GUI being a simple one and to the point. Either export “All” or the “Current Site”, sounds nice.

The harder part was to get the cookies for the current site since the domain set for a cookie can have a leading dot which probably (yeah I am guessing) mean it should apply for all subdomains it is even more trickier. The Firefox extension is cleverly using Firefox API to get the data and it works fine. The Chrome extension is getting all cookies all the time and filters the current domain on its own.

While Falkon Cookie API supports the filtering based on domain, the thing is, I was unable to get it working reliably with this leading dot and everything and I ended up using the approach from Chrome version. This can make sense since QtWebEngine is based on Chromium so there are some similarities. I did not want to import the whole domain thing as the original does and I only used the “fallback” for it and some hacking to get it somehow working.

The hacking consist of checking if the domain ends with the desired one and other way around. I consider it as a brutal hack since it should not work like this. But what am I to say, it is just a feature meant to easy life of people just a little bit. It is always required to check the results.

On top of everything, this short exercise is stretching my QML knowledge a bit.I found that the QML JavaScript is limited and provides only a handful of features and some are available through Qt module (or object, namespace….). The list of available QML JavaScript thing can be found at Qt docs. Yeah we are still on Qt5.

I wanted to use the URL thing to get the hostname or domain name but that is not available in QML JavaScript and executing JavaScript on the webpage is impossible since that would fail (at least in current state) when JavaScript is disabled, and that is a bit NO to me. I may try to look at the way to enable this to allow extensions to execute JavaScript even when the JS for site is disabled, I think there is a way and the Falkon QML API just hides it from me

For icon I wanted something at least a bit nice, so I went to SVG Repo and took one.

That was me rumbling about my latest achievement and partial fail.

Enjoy, or scold me.

The extension can be found at Falkon store and code at my Gitea.

Articles from blogs I follow:

Richard Stallman's political discourse on sex

Richard Stallman, the founder of the Free Software Foundation, has been subject to numerous allegations of misconduct. He stepped down in 2019, and following his re-instatement in 2021, a famous open letter was published in which numerous organizations and i…

via Drew DeVault's blog November 25, 2023

Upgrading to FreeBSD 14 - how to fix a broken BIOS bootcode

A lot of people running ZFS zroot have managed to break their FreeBSD systems upgrading from 13.2 to the new 14.0 release because of a broken BIOS bootcode. In this tutorial I'll show you how you can fix that without having to reinstall.

via November 22, 2023

C++ Guidelines

C++ is definitely a language that has Lots of Ways to do It – kind of like Perl’s TIMTOWTSAC. A consequence is that when writing code, you need to think about which way to do things. When context-switching between projects, employers, or what-have-you, yo…

via [bobulate] November 21, 2023

Generated by openring