Block ads on Sailfish 4.4

Why check? Wouldn’t it be easier to rewrite the entire file with new and updated content?

I guess it’s to prevent removing user or OS specific entries in the host file, and to avoid duplicates.

1 Like

I know many people are wary of DNS changing, but I have used Keweon for years on SF and Android, and seems solid to me. It’s been around for a long time, and is trusted. Filtering is good, support is good. Just install cert and change resolv.conf…

1 Like

Can we help here somehow?

Always! and thanks for asking! The biggest problem is communication and organization. The latter is dependent on priorities. I have to give some thought to how to organize. Some previous help I managed badly and the progress that was made reverted which lead to the insight that I need more ‘process’.

But in short, bug / issue related work:

Those are two larger bits.

1 Like

I had problems with peterleinchen’s defender, too.

And no disrespect, but hosty seems way too complex for such a simple task.

In the end I just created a systemd timer & service to curl Steven Black’s host file. Instructions. And thanks to the hosty developer for providing a tip on how to make /etc/hosts available for Android apps, too.

Problem: it seems a full reboot is required before sailfish-browser reads the new /etc/hosts. Any ideas?

3 Likes

Well, reboot will not blow the phone out of your hand. :wink:

2 Likes

I tried your script, but I am getting an error message:
line 8: syntax error near unexpected token newline' line 8: curl --retry 20 --retry-all-errors --retry-connrefused --retry-delay 5 “$url” | grep ‘^0.0.0.0’ > ’
I understand that the problem is with the output redirection operator, >, but I am not sure why it doesn’t work on the phone as the same code runs fine on the computer. Do you have any suggestions what could be causing it on SFOS 4.4?

1 Like

Thanks for the nice instructions. One thought: /home/nemo/ might better be stated as ~ since some users will have /home/defaultuser and no nemo user?

1 Like

Yes. I only noticed this after writing the article. Thanks for the tip; I made some minor edits to the article.

What remains is my bad habit to have files under $HOME executed by root services, so the Exec path in the systemd service has to remain absolute.

But of course all this is just a suggestion for how to implement something yourself.

1 Like

I suspect a copy-paste error because in my article the line does not end at “>”.

2 Likes

Bummer. I should have spotted it that the rest of the line was moved to new line. Thanks for the hint. Works great now.

So does Defender now works again out-of-the-box?

I would like specially to block all google-ads

1 Like

No, you have to update the script /usr/share/harbour-defender/qml/python/defender.py. I replaced baseDomain with host on line 124, 126, 147, 155, 157, 165 and 233.

You need to close the browser before starting Defender. That’s because the DB get locked by the browser when it’s open.

2 Likes

No, you have to update the script /usr/share/harbour-defender/qml/python/defender.py . I replaced baseDomain with host on line 157.

You need to close the browser before starting Defender. That’s because the DB get locked by the browser when it’s open.

I did that but defender (installed from Chum, V0.6.0-1.1.1.jolla) still shows no Sources when selecting Update now.

I think a din´t make any mistake… but look what it says when i launch it…
/tmp/tmp.srukKv: line 22: syntax error: unexpected "("

Do you want to always run the latest version of hosty? (recommended) y/n
y

Installing hosty…
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1277 100 1277 0 0 3659 0 --:–:-- --:–:-- --:–:-- 3659

Fixing permissions…

Checking optional dependencies…

Do you want to automatically update your hosts file with latest ads list? (recommended) y/n
n

Done.
[root@Xperia10III defaultuser]# sudo hosty
======== hosty v1.7.6 (10/Mar/21) ========
======== astrolince.com/hosty ========

/tmp/tmp.srukKv: line 22: syntax error: unexpected “(”
[root@Xperia10III defaultuser]#

Check if you missed any steps. If not, try to run ‘sudo hosty’ again.

1 Like

Try to start defender from Terminal.

When starting defender from app-grid, it doesn´t show me the Sources either.

There are a few lingering problems:

  • execution permissions aren’t granted and thus defender.py cannot call wc -l (but it’s possible to rewrite this in Python).
  • there are a few files that aren’t made visible within the sailjail: /etc/hosts.editable is missing, the browser cookie files is missing too, causing the code to fall back to an older filepath which isn’t used anymore, etc. (I think /etc/defender.conf is missing, too)

BUT

in defender, the actual engine is separate from the GUI.
so you can manually edit / fetch from backup a copy of .config/harbour-defender/defender.conf (warning, it will be overwritten on defender’s startup as it can’t read the list of sources - presumably from /etc/defender.conf? I haven’t checked that). then either run systemctl status harbour-defender.service (or touch ~/.config/harbour-defender/update to use the .path automatic trigger)

2 Likes

Is anyone already fixing defender for 4.4? Its a bit of a shame that we have no usable userfriendly adblocker right now

1 Like