@peterleinchen I have several suggestions for the new release, would you like to hear them?
It seems I’ve messed something up and now I can’t block ads anymore (even though the list loaded successfully). Could someone help me out, please?
Edit: I fixed it in the end
I’d like to hear them
Plus a counter instead of the indefinite progress. How many passed and how many remaining. Just the other day I had to once again quit updating because it had been going on for days and I had no idea where it was.
One could obtain a Content-Length header and count?
I don’t know. I surely hope so. It might have nothing to do with HTTP headers but rather the volume of sources if kept as objects.
Possibly also a noob question: I installed version 0.6 for the first time on SF 4.4. By default I see no sources at all and I don’t see a file /etc/defender.conf. Do I have to add it manually to get sources or is it a bug?
I have the same problems since the 4.4 version of the OS.
It was running fine on previous versions of the OS.
Defender is simply broken on 4.4. For more info you can check out this thread Block ads on Sailfish 4.4 Both sandboxing and other browser things have changed
New issues have been created too: Issues · peterleinchen/harbour-defender · GitHub
But Peter is not the original developer of Defender, he has been keeping it alive for some time, but if anyone could help with rewriting the Python code, it would be a massive help.
Note that only the GUI part is broken (mostly due to jailfish stuff); the service itself still works (in defender, the actual engine is separate from the GUI).
So you can manually edit / restore from backup the file .config/harbour-defender/defender.conf
(warning, it will be overwritten on defender GUI’s start up).
Then touch ~/.config/harbour-defender/update
to use the .path automatic trigger (this in turn will automatically call devel-su systemctl status harbour-defender.service
for you).
Android will disable ads immediately if it has already been restarted after defender’s installation (so its /etc/hosts is mapped to Sailfish’ file).
Sailfish Browser will disable ads next time it is fully restarted (warning, the pre-cache might still have an older copy of /etc/hosts in cache ; you might want to kill any pre-cached instance, or restart the Silica UI or reboot the whole phone)
Out of curiosity, i’ve disabled sailjail for defender and the gui is finally working where i can select which list to apply
Except i’ve selected the youtube no ads list and i’m still having ads on that?is the list not working, or maybe defender is still somehow not working?
(yes, i’ve let the phone update the list)
Can someone provide step by step guide to get this working?After adding with editor app lines to disable sailjail and rebooting device.Then in Defender app it starts neverending update process.Over 12 hrs and still going on.Doing something wrong?
For this Defender configuration file
~/.config/harbour-defender/defender.conf
What do you add or input in? Do you add these ad-block list, and lines, exit and save, for example, from here?
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
Or ‘defender.conf’ is for something else?
And what about within this folder
/etc/hosts
Do we add ad-block lines pertaining hosts, like from here? And what we do name them?
https://winhelp2002.mvps.org/hosts.txt
And then we do have
etc/defender.conf
What difference is between what is within ‘etc/hosts’ folder, and ‘~/.config/harbour-defender/’ folder, and ‘etc/defender.conf’ file.
Thanx
The hosts ‘file’ is local ip → name lookup table:
0.0.0.0 my.host.name
causes that ‘my.host.name’ to reslove to local host.
I only use the hosts file. This doesn’t work with android.
It’s an .INI-like file, one section per source,
and a propertry to enable the source.
I’m using the lists “Unified by StevenBlack” and “Disconnect-me Simple” for both Ads and tracker.
So, mine looks like this:
[SETTINGS]
wlanonly = no
[stevenblack_unified]
sourceenabled = yes
[stevenblack_unified_fakenews]
sourceenabled = no
[stevenblack_unified_gambling]
sourceenabled = no
[stevenblack_unified_porn]
sourceenabled = no
[stevenblack_unified_social]
sourceenabled = no
[stevenblack_unified_fakenews_gambling]
sourceenabled = no
[stevenblack_unified_fakenews_porn]
sourceenabled = no
[stevenblack_unified_fakenews_social]
sourceenabled = no
[stevenblack_unified_gambling_porn]
sourceenabled = no
[stevenblack_unified_gambling_social]
sourceenabled = no
[stevenblack_unified_porn_social]
sourceenabled = no
[stevenblack_unified_fakenews_gambling_porn]
sourceenabled = no
[stevenblack_unified_fakenews_gambling_social]
sourceenabled = no
[stevenblack_unified_fakenews_porn_social]
sourceenabled = no
[stevenblack_unified_gambling_porn_social]
sourceenabled = no
[stevenblack_unified_fakenews_gambling_porn_social]
sourceenabled = no
[adaway]
sourceenabled = no
[yoyos]
sourceenabled = no
[cameleon]
sourceenabled = no
[disconnectme_simple_tracking]
sourceenabled = yes
[disconnectme_simple_ad]
sourceenabled = yes
[mvps]
sourceenabled = no
(0.0.0.0
is an unresolvable address, not the local-host )
@X0X0 :
In the case of Defender: the deamon of defender will automatically auto-fill this file with all the necessary entries so all the adserv.com
etc. get similarly block.
You don’t need to edit this, Defender will do it for you based on what you’ve turned on or off in the .conf
file.
In the case of Defender, it will setup an mount inside /var/lib/lxc/aliendalvik/extra_config
:
lxc.mount.entry = /system/etc/hosts system/etc/hosts none bind,ro 0 0
Thus your system wide hosts file will be mounted inside the LXC container used by AlienDalvik, and it will also auto-fill that /system/etc/hosts
for you, too, so that in fine ads are disabled in most apps.
(Note: this can partially break functionality of some freemium Android games. The “watch an ad to get past this check-point” or “watch an ad to earn extra diamonds/coins/whatever” will typically not work. Some games are still completeable despite this, other are utterly broken).
Two aspects to think about to get rid of ads:
- Making sure the list is actually used.
- Disabling everything inside Youtube.
Regarding 1:
- the simplest is to just reboot Sailfish. (So you’re sure that Defender is running, and you’re sure that the browser is using the latest
/etc/hosts
which got generated by Defender). - try browsing to https://ads.google.com/
- it should fail with “Unable to connect”
Regarding 2:
- this is saddly a limitation of the tech used by Defender: limitation of
hosts
files. - host can only block the entire access to specific servers (in my test above, e.g., block access to ads.google)
- it’s much less sophisticated than uBlock or AdBlock Plus which are able to change the behaviour of the Javascript code running inside the page.
- some ads on youtube are indeed fetched from different servers: these will be blocked by defender.
- some ads are served by the regular https://youtube.com/ servers (e.g., the player will receive a list of video segments to play, one of them is a pre-roll ad). It’s not possible with
hosts
to just block the ad, while at the same time still getting the rest of the videos, both from the exact same server.
Possible workarounds:
- use a native SailfishOS youtube app, like microtube.
- that one understands the info output by youtube and can be much clever about what is is blocking.
- use Firefox for Android in Alien-dalvik and install uBlock Origin (unlike Chromium, android version of Firefox can supports add-ons).
- or use Bromite in Alien-dalvik (an open-source fork of Chromium available on F-Droid) that is modified to include and run Adblock even on mobile (as mentioned the original Chromium doesn’t allow add-ons on Android).
- uBlock and AdBlock are much more sofisticated and will be able to selectively block ads instead of blanket blocking a whole server.
of course. mea culpa you could also make if 127.0.0.1 but that’s nonsense. Thanks for the detailed outline!
I also noticed that some sites, for instance the German news magazine Spiegel, recently switched to proxy ads over their main domain. And of course, youtube. Working on that one. Still, I’m generally happy with 50K line hosts file
While testing the community version of SFOS (on a Pinephone Pro) I notice a different cyclic dependency.
See issue 8.
The more recent version of (kernel and thus of) systemd available there means that systemd automatically detects and solves the dependency.
But it solves it by deactivating paths.target
which is a rather basic unit.
Another difference is that the unlocking service is named differently in the Community edition.
edit: here is the PR