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:

Why is your open source project still hosted on GitHub?

Perhaps the younger generation don't know anything about the past "evils" of Microsoft and naively believe that Microsoft is now the good friend to open source, but the truth is that all Microsoft acquisitions of open source projects is a busi…

via unixdigest.com May 22, 2025

StarFive VisionFive v2 and FreeBSD

This week I powered up the StarFive VisionFive v2 board that I have. I figured I would give FreeBSD another whirl on it, in the vague hope that RISC-V boards are a more cohesive family than ARM boards were five years ago. tl;dr: I didn’t get it to work as…

via [bobulate] May 20, 2025

Steve Ballmer was an underrated CEO

There's a common narrative that Microsoft was moribund under Steve Ballmer and then later saved by the miraculous leadership of Satya Nadella. This is the dominant narrative in every online discussion about the topic I've seen and it's a commo…

via danluu.com October 28, 2024

Generated by openring