Starting year with Falkon Adblock

Falkon is using its own Adblock implementation and can parse AdblockPlus block lists. The compatibility is not the best especially when it comes to newer or more complicated features. In the next Falkon version there will be a small improvement by adding websocket and rewrite support.

WebSocket

While trying to help a user in the IRC channel with an idea on how to make a NoScript-like plugin for Falkon I went over Adblock code to block network traffic and discovered that from Qt 6.4 there is a way to detect and WebSocket connections. Since I already saw it I though “it should not be that hard to add support for it” and it turned out to be a simple task. The already merged Merge Request can by found at invent.kde.org. The implementation also passes the tests at Adblock test pages WebSocket and WebSocket Exception sections.

Rewrite

Rewrite is a feature to redirect to other place. This implementation follows AdblockPlus in that it only redirects to few specific addresses and ignores the rest.

List of supported rewrites:

  • blank-js empty JavaScript
  • blank-css empty Cascading Style Sheet
  • blank-html empty HTML document
  • blank-text empty text document
  • 1x1-transparent-gif 1x1 transparent GIF image
  • 2x2-transparent-png 2x2 transparent PNG image
  • 3x2-transparent-png 3x2 transparent PNG image
  • 32x32-transparent-png 32x32 transparent PNG image
  • blank-mp3 0.1s silent MP3 file
  • blank-mp4 0.1s silent blank (black) 240p MP4 file

As a guide I used AdblockPlus Test Pages as well as the AdblockPlus documentation.

Redirects in adblockers

NOTE This section is my own understanding on the topic.

AdblockPlus

The original implementation of rewrite in AdblockPlus was too powerful and allowed to redirect anything to anything, which could been used to inject malicious code into the seemingly protected web browser and steal users data or worse. The implementation was later changed to only allow redirect to specific internal resources listed above. See rewrite at blog.adblockplus.org.

Brave Adblock

Brave Adblock allows more powerful redirect in essence it can redirect anything to anything but this feature is only active in the official Brave block lists. It is used to shrink the browser size and move a lot of their ads blocking scripts to the server to be downloaded only when needed. This all sounds nice and implementing this feature would mean locking it to only their official block lists. See the redirect-url merge request.

The Brave Adblock, at least its network blocking part is also used in other projects such as Qutebrowser, Angelfish and probably more KDE software. Is it worth it to switch to this instead of own Adblock implementation?

Ending thoughts

WebSockets is a great example of a feature which could have been implemented sooner if I was keeping a better eye on the changes and news in Qt library like the main developer of Qutebrowser does. I selfishly use his work for this. He puts the changes for each version in a separate issue, so it is easy to search and browse.

I will continue my random fixes for Falkon.

Articles from blogs I follow:

It goes to 6!

FreeBSD ports update today: delete mode 100644 x11/plasma5-plasma/ create mode 100644 x11/plasma6-plasma/

via [bobulate] February 3, 2025

Hypocrisy and politics in free and open source software projects

via unixdigest.com January 31, 2025

Signing Android Apps Using a YubiKey (on NixOS)

In my spare time, I currently develop two Android apps using Flutter: AniTrack, a simple anime and manga tracker based on my own needs, and Moxxy, a modern XMPP client. While I don't provide release builds for AniTrack, I do for Moxxy. Those are signed u…

via PapaTutuWawa's Blog July 24, 2023

Generated by openring