Adaway: How To Import a hosts sources from the github??

Created on 15 Dec 2015  ยท  41Comments  ยท  Source: AdAway/AdAway

Hi,
Like this hosts source: https://github.com/hackson99/hosts/blob/master/20151212/hosts
I put this url into the adaway's hosts source, it can't work.
How can i do?
Thanks a lot!

Most helpful comment

I just coded the workaround ๐Ÿ˜‰
I will be testing it for some days before pushing it into a future beta.

screenshot_adaway_20180927-111331

All 41 comments

Thanks a lot!

2015-12-15 12:53 GMT+08:00 weedy [email protected]:

Specifically for that URL
https://raw.githubusercontent.com/hackson99/hosts/master/20151212/hosts

But you probably want this
https://raw.githubusercontent.com/hackson99/hosts/master/hosts

Hit "raw" on git hub files

โ€”
Reply to this email directly or view it on GitHub
https://github.com/Free-Software-for-Android/AdAway/issues/700#issuecomment-164644788
.

Hi,
As your guide ,i use the raw URL: https://raw.githubusercontent.com/hackson99/hosts/master/hosts in AdAway's hosts source, But it still can't work. Adaway just quickly read the source and finished.

I think maybe the time that Adaway read the hosts source is too short ??

My AdAway's version is 3.0.2(54).

Thanks a lot!

In AdAway the hosts file is used to direct sites to localhost so that the sites don't load. The idea is the hosts file will contain ad servers, hence blocking ads from loading. The hosts file you link to has real dns entries for sites/servers you surely would want to visit. The main reason for this is to get around censorship from state/corp controlled dns servers. This is simply NOT a hosts file you would even want to load in AdAway. Completely different purpose and no clue why you think you want to load it in AdAway unless you are misunderstanding what I explained above.

Thank you kaladin.
I want to use the hosts source in github,Just because i want to pypass China Gov's GFW.If adaway can use my hosts source utomatically every weeks, updating the hosts file manuly could be avoided.That will be save my much time.
But it looks like that i must update the hosts file by hand.

However , thanks a lot!

Doesn't "allow redirections" take IPs as is?

@hackson99 @0-kaladin It is a valid use case, see https://github.com/Free-Software-for-Android/AdAway/wiki/HostsSources#censorship-circumvention

The URL you posted should work actually, not sure what goes wrong there.

hmm, let me see what is wrong with this then...

@hackson99 Can you try going to preferences, and check allow redirections?
I do see it isn't showing the source as online but it does load the redirections now at the bottom of the localhost entries.

I too am unable to import a hosts file from github:
Added to hosts sources: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
Enabled "allow redirections" in preferences
After updating, hosts sources shows "local: not available, online: not available"
Tried with http too and github.com/..../raw/..../hosts
AdAway 3.1 from F-Droid on Android 4.4.2

Same problem with GitHub here.

+1 Same problem here. AdAway does not work the same with lists on GitHub (githubusercontent.com) as it does with lists from other sources. Lists from GitHub always show as "not available", although there are reports that they might get merged despite that indicator. Can you fix it, or is it a GitHub issue?

It applies the GitHub hosts, but it does not confirm it. I unchecked all hosts in my list but one GitHub list, updated and applied, then checked hosts file and it was there.

6P stock rooted 7.1.1, AdAway 3.1.2 (sanjay900)

@udpPigeons I performed some tests, and have the same experience. What's interesting is that AdAway shows the local list as "not available" even though it is included.

This issue still exists. ANY hosts lists from raw.githubusercontent.com is being shown as:

"local: not available, online: not available"

Any fix planned after 2 years? Thanks :)

yeah can confirm this bug still exist

So it show that don't work but is really working?

Hum, it seems some of you have an issue with hosts file hosted on GitHub: #859 #917 #964 #1038
I just tried with the latest dev version and it works. Did you always have this issue?

The problem is gone indeed with the latest dev version!

Nice, thanks! So I can this old issue ๐Ÿ˜…

Hey,
I just installed the suggested version but I still have the bug...
With these for example:
https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileAds.txt
https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/EasyPrivacy3rdParty.txt

Edit: they seem to be actually working in fact, only the update info is missing

correct, update info is not available for github sources

@FlorentLM I haven't tried it yet, but perhaps try https://rawgit.com/

If you (or anyone else) tries it, please comment back whether or not it works for this purpose.

Alright, I guess this is not yet resolved as it seems?

nope

@FlorentLM This issue is about using GitHub to store and download hosts source file.
It works on the latest version: the hosts source file is downloaded and merge in your system hosts file.

Having the modification date is not the subject of this issue. It is the subject of #1034
So this issue is well fixed. The other one can't be fix until GitHub send the needed information.

@Gitoffthelawn

perhaps try https://rawgit.com/

It doens't look that way:
rawgit

Thanks @Vankog

Iย might implement a hack later (and if I have time ๐Ÿ˜“ ) to:

  • check raw.githubusercontent.com domain
  • parse the project and the file to get
  • create request to GitHub API v3 to get latest commit for this file
  • extract the commit date which is the last modified information I need
  • and obviously download the file content.

It is a hack but it should work.
As GitHub seems to be one of the main "storage" provider, adding this hack seems reasonable.
But it will have to wait for the v4 stable release and the new hosts cache implementation.

Wouldn't it be easier to just treat hosts that did not respond with a last modified header a bit different?
Maybe like saving the checksum of the file from these hosts. Upon checking the update status, you simply download the files and compare.
It is not the most data efficient way, but we check for updates, like... once a day? And host files are not extraordinarily huge in data size.
It's meant only as a workaround for those hosts without proper header anyway.

XDA users currently reports issue with 16+ mb hosts file. If I daily download it, it is about 1/2 gb! ๐Ÿ˜จ
Whereas the current check only get the HTTP headers but do not download the file content.

Doing this will require some text to explain what will happen (download file content) and what it implies (a huge data bill) and some extra option to disable this behavior. I don't know if it will be easier ๐Ÿ˜…

Every heard of WIFI? ;-)

@dabugen It is not that simple.

For example, you could be connected to a tethering device offering WiFi hotspot, that will be a metered connection, whereas my 4G plan is unlimited ๐Ÿ˜…

That is why the udpate service now check metered connection status instead of connection type inthe last dev versions.

Well, we could add a warning box that tells the user about this issue.
Like:

  1. user puts in a host url
  2. AdAway does the first download (or first check after the AdAway app was updated)
  3. already checks the header
  4. if the header doesn't provide the last modified attribute, tell the user about it and its consequences (about daily or so downloads and the possibility of configuring the check against metered connection etc).
  5. give the user the ability to keep the affected host(s) or remove (or maybe just disable) the host(s) again.

I just coded the workaround ๐Ÿ˜‰
I will be testing it for some days before pushing it into a future beta.

screenshot_adaway_20180927-111331

I know this is old but I'm having this problem on the latest version of the app. Is my list too long? https://gist.githubusercontent.com/mr4ffe/145de04fb2b7a01e5041c5f44f36c71f/raw/6ab3b81b4556d87d824a0b206aa86905291bb482/hosts.txt

@mr4ffe commented on 12 nov. 2018 ร  16:17 UTCโˆ’5:

I know this is old but I'm having this problem on the latest version of the app. Is my list too long? https://gist.githubusercontent.com/mr4ffe/145de04fb2b7a01e5041c5f44f36c71f/raw/6ab3b81b4556d87d824a0b206aa86905291bb482/hosts.txt

From my understanding it is because you used a"gist" instead of using a Github repo.

@PerfectSlayer When your commit will be merged/pushed in the official app ?

Regards :octocat:

@mr4ffe Gist are not supported. Only GitHub repository.
It does not seem a very common use. Is there anyone else using it?
If so, maybe I should make a workaround for this hosting too.

@PerfectSlayer Thing is, I tried with a pastebin link as well. Doesn't work.

@PerfectSlayer commented on 16 nov. 2018 ร  02:32 UTCโˆ’5:

@mr4ffe Gist are not supported. Only GitHub repository.

It does not seem a very common use. Is there anyone else using it?

If so, maybe I should make a workaround for this hosting too.

Gist can be useful too, they have an advantage you can make secret/hidden Gist for free also it's more quick to setup a gist quickly for small project that involve only one file like hosts file ๐Ÿ˜‰ .

So it could be a good idea if you can find a workaround to make Gist work too.

BTW @PerfectSlayer do you know when your fix that show the "last updated" date will come to the Adaway "public"release ? ๐Ÿค”

Regards :octocat:

Hello everyone,

I just add rewrote the GitHub support to add Gist! ๐ŸŽ‰

There is already a 4.2.4 version built already to fix auto-update issue.
So the Gist support will come for the next minor build (4.2.5?) in few weeks (the issue is 3+ years old, it should not be that long to wait ๐Ÿ˜… ).

Feel free to post feedback once the feature is released and support the app if you like it ๐Ÿ˜‰

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RenaKunisaki picture RenaKunisaki  ยท  8Comments

Tobias-B-Besemer picture Tobias-B-Besemer  ยท  4Comments

Indranil012 picture Indranil012  ยท  10Comments

patrickdrd picture patrickdrd  ยท  4Comments

GuardianMajor picture GuardianMajor  ยท  3Comments