Hosts-block (ad-blocking via /etc/hosts) now in Chum

Thanks. So in other words, this Share functionality is more than just one file and requires compilation?

Cloned it, replaced some strings in v1.
@rubdos why does it say Requires: sailfish-version <= 4.2 in the .spec?
What’s the difference between v1 and v2?

@rainemak Can’t we make this a system component? Up to now there is no Adblocking in SFOS, and Addons can neither be installed in Sailfish nor in Firefox Browser, and seen that SFOS considers itself as a privacy friendly OS, Adblocking is a must! Thanks in advance! Greetings

6 Likes

Sailfish Share was officially announced in SFOS 4.2.

AFAIK some lower versions also had it but not as an official/stable API and there were some differences/incompatabilities.

2 Likes

Yeah but it says equal or less, not more. Maybe just a typo :person_shrugging:

4.2 indeed introduced a new API. Our v1 is for pre 4.2 devices (most prominently Jolla users) and v2 for everything after.

<= 4.2 sounds like an issue then though, should probably be < 4.2

1 Like

Shouldn’t it be sailfish-version >= 4.2?

Also:

I removed the “But there was no change” notification. New version in chum:testing.

1 Like

If there are no objections I will submit this package to the main chum repo soon?

8 Likes

I categorically, absolutely and emphatically - do not object ! :rofl:

3 Likes

It seems not yet in main chum repo? But I have anyway an issue with installing it.

I was using it in a previous version of my device without issues so first thing is to thank developers.

One thing I notice with a fresh install is that the package does not seem to be installable from chum-gui? I can see it in chum:testing but it produces an error when I click install (not existing package).

I then tried with a terminal and again a pkcon search can give me a package name hosts-block-0.0.9-master.20250630100009.c2fbso.noarch that exists in chum:testing but when I try to pkcon install it, then it says the package does not exist….

What do I do wrong here?

PS: I think I had a similar issue in the past and I had to go to the web version of chum:testing to get the package and I wanted this time to share my experience.

1 Like

The version currently in chum:testing is 0.0.9+master.20250630100009.c2f2fa8-1.17.1.bso which differs slightly from what you wrote.

I just removed, then re-installed it and it works here.

Maybe you just need to reload the repository.

5 Likes

Am I just being dense in trying to set up my blocklist with this edited cfg.sh?

########################

## This is the default: just one hosts list
## (Steven Black's basic list)
##
uassets=""
##
metalists=""
##
listurls="``https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts``"

## set to 1: keep temporary files in /var/lib/hosts-block
##
debug=1
##
## set to 1, the script will fail as soon as one list
## cannot be downloaded
## set to 0, the script will still fail if some
## crucial steps do not succeed
bail=0
##
## how many seconds to wait before giving up
## (currently only applies when another instance of hosts-block is running)
##
timeout=300

I do this . . .

devel-su systemctl start hosts-block.service

. . . but I seem to just get the default blocklist, not the one with fakenews. To test, I grepped the hosts file for “zombie.news” which is in the list from github but it’s not there, nor are any of the other fakenews URLs that should be there. The cfg does seem to be doing something, because the IPs get set to 127.0.0.1 not 0.0.0.0.

127.0.0.1 ``pixel.facebook.com

Where have I gone wrong?

Edit:

Several days later the changes were applied and a message appeared in notifications that this had happened. I guess the trick was to wait for the periodic scheduled update.

OK to answer my own question,I should’ve used systemctl restart instead of start and also removed the file /var/lib/hosts-block/lastfetch before restarting. Then it will immediately create ths new hosts file without waiting the configured interval. Now it works great, and I’m unbothered by the internet things that annoy me. :slight_smile:

Thanks for hosts-block!

3 Likes

Yes, restart is better.

Your config conatins backticks:

listurls="``https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts``" 

This is wrong.

listurls="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts" 

This is right.


PS:

Package is still in testing. My submission to main got rejected for a minor bureaucratic error, and then real life hit me real hard and hasn’t let go yet. I haven’t forgotten.

3 Likes

It’s right on the phone, but somehow that odd sequence with the ` symbols got stuffed in there by the forum “code” formating . . .

This too?

(…20 chars…)

Yep. I think I was posting on my phone and didn’t even notice until later that those had appeared. Maybe I fat-fingered something . . .

zombie.news is not in my /etc/hosts either.

Do your entries still start with 127.0.0.1 rather than the default 0.0.0.0?

What is wc -l /etc/hosts and have you your own config as ~/.config/hosts-block/cfg.sh - if yes post it.

Or did you say the issue is fixed?

I’d call it fixed. Changing the systemctl call to use “restart” made it behave as I originally expected and update the hosts file immediately. And automatic updates work, too. (I did deliberately change the IP from the default as part of my testing just to sanity-check myself.) I’m really happy with how it’s working now.

Thanks.

3 Likes

Hosts-block is now in the Chum main repository. :tada:

It’s been running nicely on my phone for quite a while. Nothing has changed really, the config variables are still the same.

The README.md as seen in the Chum app is out of date though: the script does overwrite your current /etc/hosts, which should not be a problem unless you know you modified it. The version in chum:testing addresses this issue by creating a backup under /home (different partition, more space), once.
The text in post #1 of this thread reflects the current reality for the main version.

Currently the only default blocklist is Steven Black’s default list (Unified hosts).
This creates a ~2MB hosts file.
Personally I added uAssets and Firebog’s ticked meta list, which brings hosts to ~13MB.
It could be stricter. I’d consider this setup medium.
I have not experienced unwanted blocks.

What is y’all’s opinion, should the default blocklist be mild, medium or strict?

7 Likes